ActionScript Writing Pattern on Movieclip

ActionScript Writing Pattern on Movieclip
Action writing steps on movieclip are:

  • Make an object with oval tool. Note that an object in flash have two part that is stroke and fill.

  • Select the object (circle) then convert to symbol by press F8 (menu insert>convert to symbol). Select Movie clip in Type option and type ball_mc in Name.

  • Click movie clip ball_mc, then open action panel (press F9 or click menu windows>action). Then type script like this:
onClipEvent(enterFrame){
//moving object to right
_x += 10;
}

  • Run movie by pressing CTRL+Enter, so ball will move to right until disappear from the screen. Press CTRL+W to back in stage.




The explanation in ActionScript writing pattern at movieclip are :

  • Action in movieclip must started by on() or onClipEvent().
  • Inside “()” at script on or onClipEvent contain movie event like load, enterframe, mouse down, release and others. Movie event expressing an event that will executed by it action. For example : movie event enterFrame meant command inside “{}” will run a whole frame.where movieclip is active, but movie event load is run once only when movie clip loading in flash player.
  • Symbol { is starting script block. Script block is a group of command that will run in a whole movie event
  • Symbol // is expressing coment. Line with this symbol wont executed by actionScript, but it very helpful for give information in action script that our write.
  • _x+=10; is command lin. Command in movieclip must written in movie event block. In the end of writing a command is closed by “;”.
  • Symbol } is the end of script block.

Advantage of writing script in movieclip :
  1. Action script writing in movie clip is easy than writing in frame.
  2. For detect mistake on an object, writing script in movie clip is more faster than writing in frame (this effective when we processing script in hundred to thousand line).


Post a Comment

0 Comments

-------- MASUKAN KODE IKLAN 1 --------
-------- MASUKAN KODE IKLAN 2 --------
-------- MASUKAN KODE IKLAN 3 --------
To Top