View Full Version : Flash : Drag and move [-ve velocity ]


concept | zero
25-10-03, 11:38 AM
Hello. All.
I know how to drag things in flash using action script . But how can I drag something, but when I release the mouse it continues moving on the same direction with changing velocity till it stops. ;)? Where are you Flash master?

Blue_Chi
25-10-03, 01:37 PM
You will have to do that by using the "Get Property" and "Set Property" actions.

How would you move the object?
By using a Set Property, or a set variable action, IN RELATION to the velocity. Moving the _x property by using the speed would be
_x.object = _x.object + speed
"Speed" is going to be a variable in here.


Now how would you get the speed?
Getting the speed IS the most difficult process as it does depend on a human input (your mouse speed movement). The trick is that you will have to get the location of the object in too different place, then substract them for each other, to get an estimated value for the speed.
Lets say in frame one you would put
"Speed1" = _x.object

Then in frame two you would put
"Speed2" = _x.object
"Speed"=Speed1-Speed2

This way, you would get a negative or a positive value, and this would produce the direction.

How are you going to reduce the speed?
Use this action:
"Speed"=Speed*0.9
This would make the speed lost 10% of its speed every frame until it reaches 0.

Making such an action is very difficult indeed, you will have to use both X and Y properties, and you will have to figure a way to stop the movement when you "Press and Hold" the object, plus, you would have to figure a way to make the ball only move AFTER you release the button. It is not impossible, but would take some time for sure.


Hope this was helpful.

GiNgOrO
25-10-03, 01:38 PM
go check my thread

Fast_HacKinG
26-10-03, 02:23 AM
hi Concept | Zero :)

chech this .. hope its help ;)

click here (http://actionscript-toolbox.com/samplemx_bounceCollide.php)

concept | zero
26-10-03, 09:25 AM
thanks . alot . Blue_Chi . and fast hacking .
indeed this was a hard one to understand . ;)

NaBHaN
28-10-03, 03:49 AM
ugh!! flash is way too complicated. gives me a headache! lol