The basic idea of controlling a Flash Movie Clip on the stage is to Play, Stop, Go To the next frame, Go To the previous Frame, Go To a particular certain frame and continue playing and stop it. This tutorial shows how to do it.
The complete Flash Movie of this Flash ActionScript 3 tutorial is shown as above. Please play around to see how it works.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
// Play Square MC Buttonplay_btn.addEventListener(MouseEvent.CLICK, playSquare); function playSquare(evt:Event) {square_mc.play();} // Stop Square MC Buttonstop_btn.addEventListener(MouseEvent.CLICK, stopSquare); function stopSquare(evt:Event) {square_mc.stop();} // Square MC Go To Frame 15 STOP ButtongotoFrame15Stop_btn.addEventListener(MouseEvent.CLICK, gotoFrame15Stop); function gotoFrame15Stop(evt:Event) {square_mc.gotoAndStop(15);} // Square MC Go To Frame 15 PLAY ButtongotoFrame15Play_btn.addEventListener(MouseEvent.CLICK, gotoFrame15Play); function gotoFrame15Play(evt:Event) {square_mc.gotoAndPlay(15);} // Square MC Go To NEXT Frame ButtongotoNextFrame_btn.addEventListener(MouseEvent.CLICK, gotoNextFrame); function gotoNextFrame(evt:Event) {square_mc.nextFrame();} // Square MC Go To PREVIOUSFrame ButtongotoPreviousFrame_btn.addEventListener(MouseEvent.CLICK, gotoPreviousFrame); function gotoPreviousFrame(evt:Event){square_mc.prevFrame();} // Add Event Listener to stageaddEventListener(Event.ENTER_FRAME, countFrame); function countFrame(evt:Event){// Display the current frame numberoutput_txt.text = (“The Current Frame Number is now: ” + square_mc.currentFrame);} |
terakunomiya
October 10, 2011 at 9:53 pm
You really make it appear really easy along with your presentation however I in finding this matter to be actually one thing that I feel I’d never understand. It kind of feels too complicated and very extensive for me. I am having a look ahead to your next submit, I?ll try to get the grasp of it!
designswonder
March 15, 2011 at 3:27 am
Dear Irvin,
This is a jQuery Code Expander.
You can get the code from here. http://www.marcofolio.net/webdesign/jquery_code_e…
Irvin
March 14, 2011 at 1:34 pm
Nice article. But I like the auto-expanding code. Can u plz tell me name of the script and where I can find this.
Eshark
March 14, 2011 at 5:11 am
Again a great tutorial to learn from! Keep it up!
Preethika Jeewanthi
March 14, 2011 at 5:04 am
thanks to doing great dead for us. thanka a lot once again.i like very much it:)
Gaz
March 13, 2011 at 4:36 am
I’m busy coming to grips with Flash, and all the tutorials and tips I’m picking up on this blog is proving to be tremendously handy. A picture speaks a thousand words, but moving pictures tell a story. Mastering the art of making pictures move is an important step towards creating visual magic.
Nehemiah
March 11, 2011 at 1:40 pm
Thanx for sharing basics of AS3. 🙂