2011-09-09

FLASH CS3 - Action Script part 2



Now we have fl001.as and fl001.fla
we use the fl001.fla and now we will continue!! In first tutorial you should ask, what the heck is that code.. actualy my friend.. that's is an example, but learning from now isn't good as basic tutorial for Flash AS 3. For review, we have code like this


package {
    
import flash.display.Sprite;
    public class 
fl005 extends Sprite {
        public function 
fl005(  ) {
    
        }
//  public function fl005(  )

    
// public class fl005 extends Sprite
//package


sory less color.. I will try to explain.. This structure will be same for next actionscript.
Package
In the beginning we should type package, because this  action script treat as package
import
import mean to include whatever script, dll or something that help you script
public
this mean, the class or function that have status public can be called easy from outside. You can use Private to avoid the class called outsite the area.
public class
or we called as class.. it mean this is the name of class.. the class name should be same as filename to avoid error and missleading script and you should type this is extend from what?  Sprite? Movie? or what
Public function
or we called as function. Function is a task that able to return value or not (that's depend your code), since your class have name fl005. You should type function fl005. this function will be called at first.. just like function _construct on PHP

For closing.. Let's try this..

package {
    
import flash.display.Sprite;
    public class 
fl002 extends Sprite {
        public function 
fl002(  ) {           

         var userName:String "Bill Smith";

                  trace("My name is " + userName + ".");

        }//  public function fl005(  )

    
// public class fl005 extends Sprite {
//package 


Next I will describe about variable type..

source for today

Tidak ada komentar: