How do you create a button to start an animation, in Flash CS6/ActionScript 3?
I have created an animation of some Windmill Sails rotating, it is on a layer called "sails", and has an instance name of "sails". I have also created a button, which is on a layer called "button", and has an instance name of "button". I have also converted them both to a symbol (the sails are a movie clip, and the start button is a button).
What code do I need to write so that when I click the button, the animation starts playing?
Thank you for any help.
A PHP Error was encountered
Severity: Notice
Message: Undefined index: HTTP_ACCEPT_LANGUAGE
Filename: helpers/time_helper.php
Line Number: 22
Public Question, everyone could view answers and download attachments.
Finish this task then you can earn
15
>>Back to Task List
3215 views 1 answers
0
If you are writing code in as3 here are following steps.
1. Double click windmill movieclip and write code stop() at first frame.(by pressing F9 key you'll see actionsctipt editor)
2. Go back to main stage
3.make a new layer and name it actionscript
4.Write down following codes:.
button.addEventListener(MouseEvent.CLICK, startRotation);
function startRotation(e:MouseEvent):void
{
sails.play();
}
it will work.
if you want working .FLA file then i can help.:)
A PHP Error was encountered
Severity: Notice
Message: Undefined index: HTTP_ACCEPT_LANGUAGE
Filename: helpers/time_helper.php
Line Number: 22