Share to EffectHub.com

You can earn money or coins from your share:)

Tips: you can use Sparticle for uploading away3D effects.

Tips: you can download Sparticle for uploading effects.

Tips: The ActionScript editor is supporting Away3D, Starling, Dragonbones and Flex frameworks.

Tips: paste the web page URL then click button:)

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.


Tags

3534 views    1 answers

Image The Best Answer
Image

0


Image

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.:)

2014-09-03     0 Comments

Join Effecthub.com


Or Login with Your Email Address:

Or Sign Up with Your Email Address:
This field must contain a valid email
Password should be at least 1 character