all groups > flash actionscript > june 2004 >
You're in the

flash actionscript

group:

Move An Object Continuously


Move An Object Continuously backpages
6/29/2004 10:10:15 PM
flash actionscript:
Hi, I know this is simple, but I can't quite get it. I've created a button to
move an object (bluebox) on the stage. I want the object to move continuously
while the cursor is over the button. I've attached this actionscript to the
button, so that I can easily change the speed at which it moves if I need to:

on (rollOver) {
var speed:Number = 3;
bluebox._x += speed;
}

The problem is, it only moves it 3pixes once each time I roll over the
button. I want it to keep moving as long as the cursor is over the button. What
do I have to add and/or change to make it keep moving until you roll out?

Thanks for any help or guidance.

Steve
Re: Move An Object Continuously Laiverd.COM
6/30/2004 2:40:43 AM
on (rollOver) {
var speed:Number = 3;
bluebox.onEnterFrame = function() {
bluebox._x += speed;
};
}
on (rollOut) {
delete bluebox.onEnterFrame ;
}

John



--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------

Re: Move An Object Continuously David Stiller
6/30/2004 12:20:48 PM
It would be nice if there was an onMouseWithin(), wouldn't it?


David
stiller ( at ) quip ( dot ) net

Re: Move An Object Continuously nilsondelourenco NO[at]SPAM yahoo.com
6/30/2004 10:41:09 PM
Try this, sir


"object" is the name of the thing to be rotated....
If there is a Rollover, r=1 and if r=1 then there is a rotation.
If there is a Rollout, r=0 so, there won´t be any kind of rotation.

The line IF (R) is the same as IF (R=1)


REGARDS!!!

nilsondelourenco@yahoo.com

------------------------------
_root.onEnterFrame=
function () {

rotate_mc.onRollOver=
function () {r=1}

rotate_mc.onRollOut=
function () {r=0}


if (r){object._rotation-=2};
}
--------------------------------























[quoted text, click to view]
Re: Move An Object Continuously backpages
7/3/2004 12:10:11 AM
John:
AddThis Social Bookmark Button