I Don't Understand StartDrag() Bounds
There's my problem...can somebody explain what the numbers mean, and with the use of diagrams? Because I really don't get this.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 03-19-2006, 05:48 PM
View Complete Forum Thread with Replies
Sponsored Links:
StartDrag Bounds
So I'm doing what I would normally do in AS 2 and it's not working. On press of my clip I am getting
Code:
Argument count mismatch on flash.display::Sprite/startDrag(). Expected 0, got 6;
Live docs don't have an example on how to set bounds.
Does startDrag not take any parameters?
Any links or anything?
TIA
View Replies !
View Related
Get Bounds
hey pplz, is get bounds used for games????
coz i want to know how to make it so that when my character moves over a hill he will go over the hill and walk up a little, if u know wot i mean.
also , this has no relation lol , how duz Xiao Xiao make it so that when u push that button, it slows the frame rate and it goes in slow motion ( XIAO XIAO 3 )
thanx pplz
Skribble
_______________________________
www.skribblinteractive.tk
View Replies !
View Related
Out Of Bounds?
Hello... If a user drags a piece off the screen my program goes crazy.
www.enjoychess.com. Grab a piece and take it all the way to the edge of the screen and you will see what I mean.
I have event handlers and boundaries set and they work, but when the user takes the piece all the way to edge it goes nuts.
Any idea? Thanks!!
I am using flash mx 2004 pro
ANDY
View Replies !
View Related
Bounds
Hello,
I have a big problem in my game. I can not make bounds! In a way I can but not in this case. The problem that it's the background that is moving, not the car. So I would really appreciate if someone could explain me how to do it.
Thanks.
Here is the script I put on the background (the car is called "bil") :
onClipEvent (load) {
speed = 8;
}
onClipEvent (enterFrame) {
if (key.isdown(key.LEFT)) {
_x += speed;
}
if (key.isdown(key.RIGHT)) {
_x -= speed;
}
if (key.isdown(key.DOWN)) {
_y -= speed;
}
if (key.isdown(key.UP)) {
_y += speed;
}
}
onClipEvent (enterFrame) {
if (_root.bil.hitTest(_root.Wall4) or _root.bil.hitTest(_root.wall5) or _root.bil.hitTest(_root.wall6) or _root.bil.hitTest(_root.wall7) or _root.bil.hitTest(_root.wall8) or _root.bil.hitTest(_root.wall9) or _root.bil.hitTest(_root.wall10) or _root.bil.hitTest(_root.wall11) or _root.bil.hitTest(_root.wall12)) {
speed = 0.1;
} else {
speed = 8;
}
}
And this one on the car :
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_rotation = 90;
}
if (Key.isDown(Key.LEFT)) {
_rotation = 270;
}
if (Key.isDown(Key.UP)) {
_rotation = 0;
}
if (Key.isDown(Key.DOWN)) {
_rotation = 180;
}
if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {
_rotation = 45;
}
if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {
_rotation = 315;
}
if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {
_rotation = 135;
}
if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {
_rotation = 225;
}
}
View Replies !
View Related
Scrolling Bounds >?
hey ,
i have a mc called pic ,i am tring to have it appear at the _x pos when it scrolls out of the 300 width area to start over again ..
here is what i have for the arrow keys ..
*********i didnt add any of the code examples for the _x pos ..but the stage is 300x50
Code:
myListener = new Object();
myListener.onKeyDown = function() {
if (Key.getCode() == 37) {
picture._x -= 2;
}
};
Key.addListener(myListener);
myListener = new Object();
myListener.onKeyDown = function() {
if (Key.getCode() == 39) {
picture._x += 2;
}
};
Key.addListener(myListener);
cheers ..
View Replies !
View Related
Bounds For DraGging
Does anyone know how to create bounderies for a dragable object, so when the side of it gets to the bounderies it stops moving on either the X or Y axis depending on where ti hits?
thanks in advance
-Stwelin
View Replies !
View Related
[F8] Get Bounds - Whole Screen
I remember reading this code somewhere but now I canīt remeber or find it. If You want to have the "get Bounds" from the whole screen. So if You have a swf with many drag-objects. So the user doesnīt by accident drag something outside the screen and canīt find it again.
View Replies !
View Related
Bounds:Object
Hi
I need to check the bound of a rotating object. The code below has two versions: A) rotates the block itself and B) rotates a block within the movieClip. Only B works but for the purposes of my game I need A to work.
I've attached the test app.
Code:
var bounds:Object;
function rotationControl(evt:Event):void {
// A
this.testBlock.rotation += 5
//
bounds = this.testBlock.getBounds(this.testBlock);
this.guideLine1.x = this.testBlock.x + bounds.x;
this.guideLine2.x = this.testBlock.x + bounds.x + bounds.width;
// B
this.testBlockB.block_gr.rotation += 5
//
bounds = this.testBlockB.getBounds(this.testBlock.block_gr);
this.guideLine3.x = this.testBlockB.x + bounds.x;
this.guideLine4.x = this.testBlockB.x + bounds.x + bounds.width;
}
this.addEventListener(Event.ENTER_FRAME, rotationControl);
Thanks
View Replies !
View Related
[CS3] Scaling With Bounds
Hey all, I'm trying to create a function to zoom/in out on a map with bounds using a scrubber. Was wondering if anyone has ever run into a similar situation/solution. What I have so far doesn't seem to quite work:
PHP Code:
function onZoomAdjust(pct:Number):void {
var cx = stage.stageWidth/2 - map.x //determine center point of map on x
var cy = stage.stageHeight/2 - map.y
scale = maxScale * pct + minScale //new scale pct based on slider
var tx = (cx * scale)/2 //translation of x
var ty = (cy * scale)/2
map.x = tx;
map.y = ty;
map.scaleX = map.scaleY = scale
}
It gets me pretty close but there's no control to stop the user from zooming out of bounds. Is this the sort of thing I need to use a matrix for?
Thanks
View Replies !
View Related
Bounds In Flash?
i have a "circle_mc" movie clip and its registratoin is in the center but it moves and works fine but i dont want it to go off the stage half way i want it to stop before it goes off
anyone?
ActionScript Code:
circle_mc.onRollOver = function() {
this.dx = Math.round(Math.random()*Stage.width);
this.dy = Math.round(Math.random()*Stage.height);
this.onEnterFrame = moveIt;
};
function moveIt() {
this._x += (this.dx-this._x)/10;
this._y += (this.dy-this._y)/10;
if (Math.round(this._x) == this.dx) {
this._x = this.dx;
}
}
-aldo
View Replies !
View Related
Expand Out Of Bounds
Given a flash file with dimensions, like 300x400 embedded on an xhtml page, is there a way to allow the content to spill out of the box and over other elements? Ive seen this done on ads, but I want to use it for a navigation. Does anyone know how they do it?
View Replies !
View Related
Expanding Beyond The Bounds...
I'm attempting to do some Rich Media design, and have run into a snag. I have a banner (768x90) that will expand once hovered over. Best example I've run into is something like THIS where it expands from the 90 high to about 270 total. There's a lot of other examples at PointRoll under the FatBoy category.
I need help on how to get the additional content to display outside of the original Flash file. It appears as though it's all one file, the 'bounds' of the stage simply expand to accomodate it, but I can't figure out exactly how to get this done.
Thanks in advance.
View Replies !
View Related
Mouse Bounds
I currently have a Nav that I am working on that will follow the mouse's _y position. I am wanting to have bounds set that keep the nav in between certain top _y and bottom _y, but am lost on how to do it.
I have tried applying the same techniques that I would to create bounds for a Dragging menu (define top and bottom bounds) but it didn't work with the mouse position.
Here is the code so far that makes the menu follow the mouse:
speed = 25;
menu_mc.onEnterFrame = function () {
target_y = _root._ymouse - this._y;
this._y = this._y + (target_y/speed);
}
Any help would be appreciated.
Thanks,
--
Michael
View Replies !
View Related
Change Scroller Bounds?
Hey guys I found this code that uses duplicate clips and xml to have a gallery, but I need to change the bounds of the scroller (the amount showing at one time) to make it wider. Here are the following movieclips and their script.
Thanks,
Eric Ehle
bb:
while (i < Laenge) {
a1.duplicateMovieClip("a" + i, i);
a = this["a" + i];
a._x = 6 + (123 * i);
a._y = 150;
i++;
dragger:
if (_root._xmouse < 465) {
startDrag ("_root.dragCTRL", true, 25, 0, 465, 282);
} else {
stopDrag();
}
dragCTRL:
var slidePercent = int (((_level0.dragCTRL._x - 25) * 100) / 440);
newX = int (((((_level0.bb.Laenge * 123) - (435 + (20 / (_level0.bb.Laenge / 2)))) / 100) * slidePercent) * -1);
_level0.bb._x = _level0.bb._x + ((newX - _level0.bb._x) / 10);
Laenge = codeArray.length;
View Replies !
View Related
Constraining Mouse OUTSIDE Bounds
Hi all,
Im creating a simple FLASH, shooting game, and trying to implement some
actionscript which constrains where the user can move the mouse.
As an example. Imagine a blank stage, with medium sized rectangle in the
middle. I want the user to be able to position/move their mouse anywhere
around the rectangle, but being unable to position the mouse within the
rectangle.
Basically, i want to contrain the bounds of the mouse OUTSIDE the rectangle.
(constraining the mouse within the rectangle is easy)
If someone could post the code, or point me to an online example i would be
most grateful
Cheers
Paul
View Replies !
View Related
Help Me Solve A Problem Bounds Of MC
Hi all,
Goh, im stuck.
I am trying to get the width and height of a movie clip, disregarding the rotation.
Here is my problem.
I have a MC called "canvas" which holds a few other MCs called "layer1", "layer2", etc.
These layer MCs can be streched, rotated, etc via buttons. If they are rotated or streched, i want to get their new widths.
The problem is, i do not get the right values once i rotate the MC. I figured it wa because flash was going off of the bounding box of the layerMC so i tried the getBounds method and this also only returns the correct value if the MC has not been rotated. How would i get the stage width, stage height of a MC regardless of its rotation. As in if its a rectangle 10x100 pixels, and i rotate it 90 degrees, it should be 100x10 respectivly. So far the only thing that causes problems is the rotation of the MC, scaling returns correct values.
Also, the CANVAS movie clip also gets scaled (zoomed in) though that has not been much of an issue thus far, it may be causing the wrong values.
Any ideas? PLZ HELP!
View Replies !
View Related
[F8] Bounds Of Movie, Stop Car
I want the car not to go off stage basically. I doubt im doing this right at all:
var stage.Width = sw
var stage.Height = sh
if ((this._x>sw) || (this._y>sh)){
_root.object.objectspeed *= -1
}
do I need some math in there somewhere?
View Replies !
View Related
Modifying The Bounds Of A Clip
I have a big movieclip but I just want to show a little peace of this movieclip. So I mask it with another movieclip with rectangles drawn in it and blendmode "alpha". The problem is that the rest of the clip (the masked part) is just then considered with _alpha=0; so actionscript always consider this clip as the whole big movieclip and it takes time to draw it on the screen.
So is it possible to really change (decrease) the bounds of a movieclip?
View Replies !
View Related
AS 3 Random Motion Within Bounds
Ok,
I have a script that produces random motion along the y axis, however, I want that motion to occur within the movie clip that is centered on the stage, or I should say within the bounds of that movie clip.
The movie clip has a height of 335 px
Here is the code:
Code:
var xTween:Tween;
var yTween:Tween;
startTween();
function startTween(e:TweenEvent = null):void {
yTween = new Tween(box, "y", Elastic.easeInOut, box.y, Math.random()*300, 2, true);
yTween.addEventListener(TweenEvent.MOTION_FINISH,startTween);
}
any help is appreciated
Thank you
-D
View Replies !
View Related
Constraining Motion/bounds
Hello.
I'm trying to solve a problem I have. Imagine you have a series of handles sat on a horizontal plane, they can be moved left to right...
___/\_____X_____/\_X_/\___X____/\___________
The X amounts are driven by the distance between the two points, simple. Now, when the objects move the distance shrinks, also simple...
___/\__X__/\_X__/\___X____/\________________
Now, what I want to be able to do is move the first triangle (well, any one but the first for this example) to the right, beyond the point where the second or third objects are. I want it to push those objects along as I move it, then when I drag it back it leaves them there. I then want to be able to drag the second object to the left, where it will 'hit' and push the first object out of the way.
In 3D I'd call this 'bi-directional constraints', I'm not familiar how to do it in AS3.
Any help would be great.
A.
View Replies !
View Related
Control Bounds Of Sliding Mc
I have this script attached to a mc (see below) that makes the mc slide across the x-axis. That part works great, but I only want the mc to go so far to the right and I don't want the mc to move when you are not over the mc (ie. anywhere else on the stage). Does anyone have any suggestions as to what I can add to this script to control that or do I need a different script? Any help would be appreciated.
onClipEvent (enterFrame) {
//x movement
mx=_root._xmouse;
if (mx<_x) {
dx=_x-mx;
}
else {
dx=mx-_x;
}
moveSpeedx=dx/5;
if (mx<_x) {
_x=_x-moveSpeedx;
}
else {
_x=_x+moveSpeedx;
}
}
View Replies !
View Related
Finding The Bounds Of A Movieclip
Version: Flash CS3, AS3
Is there a way to find the bounds (width&height) of a single-frame movieclip in a way that disregards surrounding whitespace?
ie. if a movieclip contains only a 10x10 square at point 5,5 (within the movieclip), width&height is normally returned as 15x15. I want a way to have 10x10 returned.
Flash seems to know of such bounds - the graphic displayed in the library sidebar is set to this size. So are they accessible via AS3?
Thanks
Rick
View Replies !
View Related
Calculating Perimeter - Bounds
Hi,
Here is the task simplified:
You have a grid on which you place boxes that snap together,
all boxes have to touch each other, once you finish you click
i finished and it ouputs the bound measures.
How would one get those measures?
Thank you!
tamagorci
View Replies !
View Related
Setting Bounds With HitTest
Ok this problem is really starting to get annoying
ActionScript Code:
onClipEvent (enterFrame) { if (_root.line.circle.dot.hitTest(_root.mc)) { _root.gotoAndStop("end"); }}
That hittest performs when the two blue edgings around the two objects intersect. So it hittests just a little before it's supposed to. What I need to know and can't figure out is how to get it to Hit test when the actual objects interesect and not their borders.Thanks in advance .
View Replies !
View Related
Setting Bounds For An Mc (using Pixels...y = 300 Etc)
What I wanted to know is how I would be able to make it so that a certain mc could go no higher than say 300 pixels vertically. I know there's a way to limit movement that way but I'm not sure how to put it. My scenario is basically this: I have a character which is moved with the arrow keys, he has vertical and horizontal movement but I don't want him to be able to go any higher than about 300 otherwise it looks like he's walking on the walls .
Thanks,
Fargate
View Replies !
View Related
Setting Bounds With HitTest
Ok this problem is really starting to get annoying
ActionScript Code:
onClipEvent (enterFrame) { if (_root.line.circle.dot.hitTest(_root.mc)) { _root.gotoAndStop("end"); }}
That hittest performs when the two blue edgings around the two objects intersect. So it hittests just a little before it's supposed to. What I need to know and can't figure out is how to get it to Hit test when the actual objects interesect and not their borders.Thanks in advance .
View Replies !
View Related
Setting Bounds For An Mc (using Pixels...y = 300 Etc)
What I wanted to know is how I would be able to make it so that a certain mc could go no higher than say 300 pixels vertically. I know there's a way to limit movement that way but I'm not sure how to put it. My scenario is basically this: I have a character which is moved with the arrow keys, he has vertical and horizontal movement but I don't want him to be able to go any higher than about 300 otherwise it looks like he's walking on the walls .
Thanks,
Fargate
View Replies !
View Related
Set Bounds For Window Component
I have a window component in MX2004 Prof. So it's a SWC and un editable. How can I set limits on where this window can be dragged?
Currently, the window can be dragged off the area it's in and then (when released) it is impossible to drag it back down and close it.
How can I set the boundaries of where it can be dragged (the draggable part, anyway) ?
View Replies !
View Related
Making Text In Bounds...
How can i make shure that every time a textfield reaches maxlimit to the right it automaticly hits enter? Like when i reaches the right limit of this textbok the word is automaticly moved down to a line below... Any1 understood that?
View Replies !
View Related
More Efficient Bounds Checking
Hey... I'm making a side-scrolling game. There are a lot of different objects in the 'room', all of which need hitTest checks to make sure the main character can't walk through them... I don't want to make every object a movie clip, because that would be tedious, and very inefficient (I have started doing this, but it slows down the swf rendered file). I was wondering if there was any other, quicker, better way to make it so my character can't walk through walls and such like that.
Thanks for any help.
View Replies !
View Related
Moving Object Out Of The Movie Bounds
I'm not sure if this is possible or not. I am using Flash5, and what I want to do is have a relatively small movie clip(flash animation) say like 20x20 pixels but have a larger floating, draggable clip that will sit over the HTML in the page... images, tables, background, etc... can anybody give me a hint on how to do this, if it can be done???
Thanks.
paco
View Replies !
View Related
Hit Test To Define Objects, Bounds
I'm creating a game but I have the problem of the characters running off the top of the screen and returning on screen from the bottom. How can I define a perimeter?
Also, if I want the characters to NOT be able to run through other objects on the screen, how do I define that on the actionscripting?
I am using flash mx 2004.
View Replies !
View Related
Clipping Bounds On Sprite/MovieClip
Easy noob question for you: I'm using addChild() to add bitmaps to a 100x100 Sprite. I'm positioning these bitmaps with their x and y parameters. However, if the bitmap 'spills' over the edge of the 100x100 Sprite, I want it to be clipped. In other words, if I place a 50x50 image at the x,y coordinates of 90, 90, I only want the upper-left corner 10x10 pixels of the image to be shown. Does that make sense? How can I do this? Is there some 'clip' parameter?
Thanks in advance!
-Rich
View Replies !
View Related
Click, Drag, Stay In Bounds....Please.
Hey guys, I need help here. I've been searching this forum and found many versions of what I want but not exactly. I know this probably easy for you guys, but I've been spending days trying to figure this out, ...yes I know I'm a newbie.
Basically I have a click and drag MC on the stage, but I want to confine it to the stage, not having it go past it's edges.
...help!
View Replies !
View Related
Loaded .swf Into _mc Wont Stay Within Bounds
Basically I created a slide show (slideshow.swf).... which loads jpgs dynamically into movie clips that I also created dynamically. I also created buttons that I exported for action script and load dynamically on the stage as well...
all contained in SlideShow.swf.....
When I load slideshow.swf into a movieclip (movieClipHolder_mc) in my Main movie
part of the movie ( the jpgs) stay within the bounds of the Slideshow.swf stage...
however the buttons I created dynamically inside of the slideshow.swf movie....
put themselves onto the main stage of my main movie....
I've checked the code and it seems right, but obviously I'm missing something....
View Replies !
View Related
Proportionate Resize Based On Bounds
i have a container that is 100 x 100 and i have various symbols of different shapes and sizes (states for a U.S. map) that i am loading into that box and need to resize
some are bigger, some are smaller
can anyone help me figure out how to scale them proportionately larger or smaller depending on their size relative to the container.
here's what i have so far
Code:
attachMovie(_root.curState, "curState", 100, {_x:25, _y:15});
widthBound = 100;
heightBound = 100;
if (curState._width<widthBound && curState._height<heightBound) {
ratioWidth = Math.round(widthBound/curState._width);
ratioHeight = Math.round(heightBound/curState._height);
if (ratioWidth>ratioHeight) {
curState._width *= ratioWidth;
curState._height *= ratioHeight;
}
}
View Replies !
View Related
Possible To Clip Bounds Of Sprite/Movieclip?
Easy noob question for you: I'm using addChild() to add bitmaps to a 100x100 Sprite. I'm positioning these bitmaps with their x and y parameters. However, if the bitmap 'spills' over the edge of the 100x100 Sprite, I want it to be clipped. In other words, if I place a 50x50 image at the x,y coordinates of 90, 90, I only want the upper-left corner 10x10 pixels of the image to be shown. Does that make sense? How can I do this? Is there some 'clip' parameter?
Thanks in advance!
-Rich
View Replies !
View Related
Player Bounds Not Working Correctly
I'm working on a little space shooter scroller game, and I'm trying to set the bounds of where a player can go (the white ship). Right now, I have the green MovieClip (instance name: wall) acting as a collision object against the player's ship (instance name: player_ship).
This is the actionscript code I have currently on the player_ship.
Code:
onClipEvent(load){
//player ship
moveSpeed=10;
this.gotoAndStop(1);
//laser
_root.player_laser._visible = false;
laserCounter=1;
maxLasers=4;
laserDepthCounter=1;
//scroll scene
scrollStart=true;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
if(!(_root.wall.hitTest(this._x, this._y, true))){
this._x+=moveSpeed;
}
}
else if (Key.isDown(Key.LEFT)) {
if(!(_root.wall.hitTest(this._x, this._y, true))){
this._x-=moveSpeed;
}
}
if (Key.isDown(Key.DOWN)) {
if(!(_root.wall.hitTest(this._x, this._y, true))){
this._y+=moveSpeed;
}
}
else if (Key.isDown(Key.UP)) {
if(!(_root.wall.hitTest(this._x, this._y, true))){
this._y-=moveSpeed;
}
}
if (Key.isDown(Key.SPACE) && (laserCounter<=maxLasers)) {
laserCounter++;
_root.player_laser.duplicateMovieClip( "player_laser"+laserDepthCounter, laserDepthCounter );
_root["player_laser"+laserDepthCounter]._visible=true;
laserDepthCounter++;
if (laserDepthCounter>maxLasers){
laserDepthCounter=1;
}
}
}
Here's the swf too if you're interested in seeing this in action (I'll eventually turn the green box transparent): http://www.mediafire.com/?fkxduyoe2mz
Basically, when the center of the player_ship hits the center of one of the 4 lines, it gets stuck. I've tried using getBounds(this).xMax and whatnot, but that only made it so the player_ship could sometimes escape the bounds box.
Code:
if (Key.isDown(Key.RIGHT)) {
if(!(_root.wall.hitTest(getBounds(this).xMin, this._y, true))){
this._x+=moveSpeed;
}
}
if I do a else statement on the hitTest() to move the player_ship a "moveSpeed" in the opposite direction, it also gets stuck if you don't let go of the arrow key at the right time, so then you have to tap it again to nudge it out.
Code:
if (Key.isDown(Key.RIGHT)) {
if(!(_root.wall.hitTest(this._x, this._y, true))){
this._x+=moveSpeed;
}
else{
this._x-=moveSpeed;
}
}
Any ideas on how you're supposed to properly make a boundary box to constrain a player? I'm stumped now that all these things I tried haven't worked.
View Replies !
View Related
Mouse Detecting Bounds Of Screen
I have a flash file at :http://stalworth.bvdhosting.com/test/properties.php which has a movie clip attached to the mouse using the startDrag() function when you hover over a green county.
It works fine, but if you select a county on the left side of the file, the MC extends past the edge of the screen. So i have an onclipEvent (enterframe) function that says "if the mouse is less than 200 pixels from the left, move the hovering MC 400 pixels to the right" and you can see it works.
The problem is that the code does not execute fast enough, and flickers from the left to teh right. How should i execute that code in order for it to happend before the hover is displayed?
Thanks for your help
View Replies !
View Related
Drag Glitch When Mouse Goes Out Of Bounds
you can see here: http://www.lisag.xtreemhost.com/magicball/new/ball.html
It happens when you drag the scroll slider out of bounds and you release - even when mouse is up the slider still moves. I consider it a glitch. What does somebody has to do to fix it?
the code I use for the slider:
Code:
scroll_btn.buttonMode = true;
var dragging:Boolean = false;
var bounds:Rectangle = new Rectangle(-10,-13,0,138);
up_btn.addEventListener(MouseEvent.CLICK,onUp);
down_btn.addEventListener(MouseEvent.CLICK,onDown);
scroll_btn.addEventListener(MouseEvent.MOUSE_DOWN,onDrag);
stage.addEventListener(MouseEvent.MOUSE_UP,onDrop);
stage.addEventListener(Event.ENTER_FRAME,checkDrag);
lt_txt.addEventListener(Event.SCROLL,onScroll);
function onUp(e:MouseEvent):void{
lt_txt.scrollV-=1;
}
function onDown(e:MouseEvent):void{
lt_txt.scrollV+=1;
}
function onDrag(e:MouseEvent):void{
dragging = true;
scroll_btn.startDrag(false,bounds);
}
function onDrop(e:MouseEvent):void{
dragging = false;
scroll_btn.stopDrag();
}
function checkDrag(e:Event):void{
if (dragging) lt_txt.scrollV=Math.round((scroll_btn.y-bounds.y)/bounds.height*lt_txt.maxScrollV);
}
function onScroll(e:Event):void{
scroll_btn.y = Math.round(bounds.height*lt_txt.scrollV/lt_txt.maxScrollV + bounds.y);
}
Please Help if you can!
View Replies !
View Related
Scroll Any MC Four Directions And Zoom But Within Bounds? How To Structure This?
Hi,
I keep coming back to the same issue, trying to rebuild this navigation system so it will accept any content without modification.
What is it? I'm making a navigation system that will scroll any-sized movieclip content (not text!) left & right & up & down as well as zoom in and out. It scrolls using two typical scrollbars with up & down buttons and a dragger in the middle. The zoom happens using "+" & "-" buttons and also has a dragger in the middle. My problem is, I am trying to do this as dynamically as is possible. And I've run into certain issues:
1. How can I always keep the MC within the bounds of my masked area when scrolling it using the getBounds() function, regardless of the size it's been zoomed or shrunk to? Of course, I will set bounds on the zoom levels too, but the scrolling is more of an issue. I assume i will use the border of the masked area as the MC to getBounds()? Just not familiar with it.
2. If I am scrolling the MC in all four directions and zooming the MC in and out, is it best to put the content's registration point at the center or at the top left corner? Flash uses the registration point to get it's position but I am concerned since it is harder to determine the true position of the MC's top and bottom when it's centered than when it's reg point is at the top left corner. At the same time, when I zoom, I would like it to zoom evenly in all directions and that would not happen if I set the reg point to the top left corner.
The same issue lies with the border MC that would be used with getBounds(). Would the reg point be centered or top left corner?
So to summarize, what's the best way to set up the content and the border of the viewing area (which is likely what will be used with getBounds()?) And how does getBounds() work exactly? I am going through a tutorial using it in "Advanced Flash Actionscript" by Dan Livingston, but it's not really what I'm doing.
Thank you!! Any help is really appreciated. =)
Jessica
View Replies !
View Related
Displaying Beyond Flash Movie Bounds In Html?
Hello,
Is it possible to have an swf embedded in HTML behave the way it does in the standalone flash player?
What I am trying to do is this:
I have a movie that is 650X440 and there are background elements that are approximately 1600X1200.
The 650X440 portion is in the vertical and horizontal center of the 1600X1200 area.
When I test the movie in the Flash Player, the 650x440 portion remains CENTERED in the player without scaling no matter what I do with the window. In addition, since the background elements are so large, there is a seamless BG behing the 650x440 portion that maintains its position as well.
If I embed this in HTML, all I get is the 650x440 window with the BG color of the movie outside the bounds of the 650x440 movie window.
Is there a way to have the html show the full bounds of the 1600x1200 box and keep the content, which is contained within the 650x440 movie box, centered in the browser window.
I do not want to have to scale the movie at all. I am using pixel/screen fonts that will antialias if the movie is scaled.
Thanks in advance,
Damien
View Replies !
View Related
Use Device Fonts Disables Scrollpane Bounds ?
hi
i use a scrollpane to scroll some static text. now when i use "use device fonts" in the textfields properties the text becomes visible before it enters the scollpane. the actual scrollbar is the same size but u can see the text that u d need to scroll for already under the box. is there any other way than turning off "use device fonts" or putting a simple graphic over the text outside the box thus hiding it ?
thnx in advance.
View Replies !
View Related
Easy Qs: Two MCs Looping Problem, Layers Going Out Of Bounds...
Hi,
My first post and my first project in Flash!
This site helped me a lot with the tutorials but there are still some newbie questions that are not addressed (or I didn't understand)and it would mean a lot to me if someone can help me out.
1) I have a scene with one MC that I want to continuously loop from beginning to end to beginning.
This is a very common thing in Flash presentations. http://www6.defjam.com/ludacris/home.php check out the background going "in the circle". Also it's common when you scroll the images in gallery; let's say you scroll to the right and it goes from first image to last then to first again.
How do I do that? Is it AS only or I have to set up the duplicate of the image...
2) I have two MCs that I want to loop. Problem is that they both start looping again at the same time like they are on the same timeline so one gets chopped off in the middle cause it's longer.
One MC has Tween motion of 50 frames and has AS "gotoAndPlay(45)" on frame 100
Other has tween of 120 frames and it also has "gotoAndPlay(45)" but on frame 350
What happens is that both MC start looping from frame 100.
I thought that MCs have independent timelines?!
3) I want some objects to go out of the flash document size and be disappear from the screen as they go away but I can't do that unless I mask every singel layer.
Is there any other way to get layers disappear out of bounds without masking?
Thanx
View Replies !
View Related
[help] Setting Bounds For A Mouse-related Movement
Hi,
I'm trying to build a parallax scenery and have the following so far:
code:
// the "oreja" object is declared because the function was formerly triggered by an onMouseMove event, but can't figure out how to keep it from being choppy
// oreja = new Object();
//scenery settings
var medio=Stage.width/2;
var medioV=Stage.height/2;
//velocity
var velo1=10;
var velo2=20;
var velo3=30;
//movement function
this.onEnterFrame = function() {
//distance between the mouse and the center of the stage
var hacia = Math.floor(_root._xmouse-medio);
var haciaV = Math.floor(_root._ymouse-medioV);
//unsuccessful attemp to set a bound
if(uno._x>0){
//horizontal movement
uno._x += hacia/velo1;
dos._x+=hacia/velo2;
tres._x+=hacia/velo3;
}
//vertical movement
uno._y += haciaV/velo1;
dos._y+=haciaV/velo2;
tres._y+=haciaV/velo3;
}
//Mouse.addListener(oreja);
But can't figure out a way to set bounds for the movement, so when the first plane reach a set position in _x and _y, it stops moving further. So far it only halts completely.
Any suggestions are welcomed. Attached is the result so you can see where I'm heading at.
Thanz in advance, salut!
View Replies !
View Related
SWF Loaded Into Scroll Pane Randomly Going Out Of Bounds
Hi there. I'm having an unusual problem with the SWF file I am loading into a scroll pane randomly going out of the bounds of the scroll pane. I cant seem to figure out why. Has anyone had this problem before?
If you keep clicking back and fourth between the two pages you will see that sometimes the SWF file will be out of bounds.
Here are a few example screenies:
View Replies !
View Related
[F8] Can't Stop Scrolling XML Thumbs. Defining Bounds ?
Hi,
I have learned basics about integrating XML content into Flash. I'm trying to build a gallery which has thumbnails that are pulled from XML. I'm trying to make a scroll with just two arrows in which clicking the right arrow scrolls the thumbnails and so the left one.
If the end point of XML generated thumbs comes to a specific point i want that arrow to stop working. (With an if statement)
The problem is,
How am i going to tell total width of the thumbanil content? They are placed in a MC which is dynamically generated by createEmptyMovieClip method.
I know that there are "i" number of contents(thumbs) but how to specify the width of each thumb so that i can multiply it with "i" and get a whole width measure??
I managed to scroll thumbs clip but it scrolls to infinity without the bounds. How am i going to set the right and left bounds??
Here is my code :
PHP Code:
var thumb_spacingX = 70;
var thumb_spacingY = 5;
var wideness = _root.image_mc._width+200;
targetx = 70;
function setorijin(){
image_mc._x = wideness/2;
}
next_btn.onRelease = function() {
_root.targetx -= 450;
}
prev_btn.onRelease = function() {
_root.targetx += 450;
}
function GeneratePortfolio(portfolio_xml){
var portfolioPictures = portfolio_xml.firstChild.childNodes;
for (var i = 0; i < portfolioPictures.length; i++){
var currentPicture = portfolioPictures[i];
var myThumb = menu_mc.createEmptyMovieClip("thumbnail_mc"+i,i);
myThumb._x = i * thumb_spacingX;
myThumb._y = thumb_spacingY;
myThumb.createEmptyMovieClip("thumb_container",0);
myThumb.thumb_container.loadMovie(currentPicture.attributes.thumb);
myThumb.title = currentPicture.attributes.header;
myThumb.image = currentPicture.attributes.full;
myThumb.brief = currentPicture.attributes.summary;
myThumb.onRollOver = myThumb.onDragOver = function(){
info_txt.text = this.title;
}
myThumb.onRollOut = myThumb.onDragOut = function(){
info_txt.text = "";
}
myThumb.onRelease = function(){
image_mc.loadMovie(this.image);
setorijin();
description_txt.text = this.brief;
}
}
}
// xml related
var portfolio_xml = new XML();
portfolio_xml.ignoreWhite = true;
portfolio_xml.onLoad = function(success){
if (success) GeneratePortfolio(this);
else trace("XML loading undone");
}
// for XML to load
portfolio_xml.load("portfolio01.xml");
stop();
and also this piece of code is embedded in a actions MC on the stage;
PHP Code:
startx = GetProperty(_root.menu_mc,_x) ;
moved = _root.targetx-startx;
setProperty(_root.menu_mc, _x, startx+(moved/3));
Any help is appreciated, THANK YOU.
View Replies !
View Related
Calculate Shape Bounds Related To A Point
Ok, as you can see by the post title, I don't know how to describe this in words, so please see the attached image.
I need to discover the extremities of iregular shapes as seen from a point.
Imagine a clockface with only one hand that is revolving. Imagine there is a shape on that clockface. I need to know the point on the shape at which the clockhand first touches it, then the point the hand is touching before it leaves the shape.
Does anyone know how I would begin?
Thanks
View Replies !
View Related
|