Actionscript Query
- Started
- Last post
- 6 Responses
- dot-matrix
yo,
how do i move an object from one point on the screen to another using action script?
and it would be really dope if it had some inertia
- MX_OnD0
target the x and y properties of the object thus:
object._x = 1;
object._y = 1;in order to give some momentum or inertia or the like then you want to create some sort of "easing" either use Robert Penner's easing equations
http://www.robertpenner.com/easi…
Or you can make a loop with a counter which determines the amount that your object is to move...
something like:
counter = 10;
myClip.onEnterframe = function() {
counter --;
myClip._x += 1*counter;
}hope this helps.
- dot-matrix0
it does quite a bit, ive been out of flash for a while now but its comming back fierce
thanks.....
you wouldnt happen to know anything about using a btn made in flash to change the content of a cell in a webpage...or an equivalent to this, maybe using frames?
- MX_OnD0
just use getURL and add the target luike you would in html.
Or you can use getURL to point at a JavaScript too.
- Anarchitect0
http://www.quirksmode.org/js/cro…
use one of the previous scripts within your button event:myButton.onPress=function(){
getURL("javascript:script(parame...
}
- function820
i think this this is what you're looking for
http://www.uncredited.net/ASmove…
i wrote this a bit ago, hopefully it helps
i'll explain a bit
basicly to move an object you type
objectname.xyMove(X,Y,Style,Spee...
to move only say, the X position
objectname.xyMove(100,S,"noease...
you can leave out the last 2 variables and they will default to whats defined in the script, ie. speed 15, no ease
i use S to move only one axis, ie
to move x only (10,S)
to move y only (S,10)i've found for best results use frame rates over 25
change the movement style to whatever you want, i've inculded 4 samples, generated with http://timotheegroleau.com/Flash…
the key thing about using easing equations formed with this app is you HAVE to change the first + to a - (ie. b+c needs to be b-c) if you dont, it wont respond correctly... anyway, hope this helps, and hopefully my explanation isnt too confusing... oh, one more thing it sets a variable when its done, so you can program it to do things once a movement is finished
- vburo0
*bump