Saturday, September 10, 2011

Play and Stop Flash Movie Clip with ActionScript 3

This tutorial series show how to use Flash ActionScript to control Flash Movie Clip.



Flash Tutorial Content:

The most basic idea of controlling a Flash MovieClip on stage is to Play it, Stop it, Go To next frame, Go To previous Frame, Go To a certain frame and continue the playing and stop it. This tutorial shows how to do it.
The completed Flash Movie of this Flash ActionScript tutorial is shown as above. Please play around to see how it works.


Flash ActionScript Codes:


// Play Square MC Button

play_btn.addEventListener(MouseEvent.CLICK, playSquare);






function playSquare(evt:Event) {

square_mc.play();




}






// Stop Square MC Button

stop_btn.addEventListener(MouseEvent.CLICK, stopSquare);






function stopSquare(evt:Event) {

square_mc.stop();




}






// Square MC Go To Frame 15 STOP Button

gotoFrame15Stop_btn.addEventListener(MouseEvent.CLICK, gotoFrame15Stop);






function gotoFrame15Stop(evt:Event) {

square_mc.gotoAndStop(15);




}






// Square MC Go To Frame 15 PLAY Button

gotoFrame15Play_btn.addEventListener(MouseEvent.CLICK, gotoFrame15Play);






function gotoFrame15Play(evt:Event) {

square_mc.gotoAndPlay(15);




}






// Square MC Go To NEXT Frame Button

gotoNextFrame_btn.addEventListener(MouseEvent.CLICK, gotoNextFrame);






function gotoNextFrame(evt:Event) {

square_mc.nextFrame();




}






// Square MC Go To PREVIOUSFrame Button

gotoPreviousFrame_btn.addEventListener(MouseEvent.CLICK, gotoPreviousFrame);






function gotoPreviousFrame(evt:Event){

square_mc.prevFrame();




}






// Add Event Listener to stage

addEventListener(Event.ENTER_FRAME, countFrame);






function countFrame(evt:Event){

// Display the current frame number
output_txt.text = ("The Current Frame Number is now: " + square_mc.currentFrame);




}




Remarks:


In this Flash ActionScript tutorial, we learn how to control Movieclip - Play, Stop, Go To next frame, Go To previous Frame and Go To a certain frame.








Source:


http://www.flashwonderland.com/control-movie-clip/control-movie-clip-1.html


Networking

IP Addressing So what’s a TCP/IP Address? TCP/IP address works on the Network and Transport layer of the OSI-ISO reference model and Intern...