-
Creating a clickable object, how do I do it?
I am doing a kids story book and I have a couple questions, How do I make a object such as a a tree I drew, that when you click on it, a animation happens such as leaves move etc.
How would I do this?
thanks Rob
-
Teacosy is coming
Hey,
This is a simple implementation:
Code:
containerClip.addEventListener(MouseEvent.CLICK, playAnimation, false, 0, true);
containerClip.buttonMode = true;
function playAnimation(event:MouseEvent):void
{
var clickedClip = event.target;
clickedClip.play();
}
Put that code on the main timeline.
basically, you need a MovieClip on the main timeline called containerClip.
Inside that you put your MovieClip with the animation inside it.
On the first frame of that animation you need a stop(); so it doesn't play by itself.
The good thing about doing it this way is you don't have to add an event listener to each MovieClip.
Hope that's a useful start.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|