A.as


package

{

import com.greensock.TweenLite;

import flash.display.Sprite;

import flash.events.MouseEvent;

public class A extends Sprite

{

public function A()

{

super();

setting();

}

private function setting():void

{

graphics.beginFill(0x000000, 1);

graphics.drawRect(0, 0, 100, 100);

graphics.endFill();

buttonMode = true;

}

public function onStart( $callback:Function = null):void

{

TweenLite.to( this, 1, { x:100, onComplete:function():void

{

if($callback != null)

$callback( "A motion End" );

} });

}

}

}





Main.as


package

{

import flash.display.Sprite;

import flash.events.MouseEvent;

public class Main extends Sprite

{

private var a:A;

public function Main()

{

setting();

}

private function setting():void

{

a = new A();

a.addEventListener( MouseEvent.CLICK, aClick );

addChild(a);

}

protected function aClick(event:MouseEvent):void

{

a.onStart( callBack ); 

}

private function callBack( $state:String ):void

{

trace( $state ); // A motion End

}

}

}

'ActionScript3.0 > As3.0' 카테고리의 다른 글

상속  (0) 2013.03.14
localToGlobal  (0) 2013.03.14
Function 전달.  (0) 2013.03.06
Function 참조.  (0) 2013.03.04
FLV 재생의 원리.  (3) 2010.09.02

+ Recent posts