This may be a common question. If it is, I'd love to be
pointed to where
the answer may already exist.
I want to create an effect where when you move over a sprite,
up the screen and when you move off it, it slides back down.
create this effect by jumping to a new part of the Score
animation is predefined. However, I'd like it to be more
if you move the cursor off mid way through the animation,
then I want it
to animate in reverse from that point.
So, has this type of effect been created as a sample behavior
or does a tutorial exist? Or could you describe how it would
be done? My
Lingo is relatively beginner level.
Attached is a behaviour which does what you want.
I've added comments to the code, which I hope describe how it
works. There are 4 handlers. The beginsprite handler is called
once, which director first encounters the sprite with the
behaviour. In this handler, I store the original vertical location
of the sprite. I also make a reference to the sprite in the
The enterFrame handler is called every frame. It has an 'if'
statement which checks whether the variable 'mWithin' has been set
to true or false, and makes the sprite rise or fall accordingly.
The 'mouseEnter' and 'mouseLeave' handlers are automatically
called by director when the mouse enters or leaves the sprite. In
these, I set the 'mWithin' property to true or false.