ActiveScript代码部分
package cookbook
{
import mx.containers.Canvas;
import flash.events.Event;
public class CodeBehind extends Canvas
{
public function CodeBehind()
{
super();
addEventListener(Event.ADDED_TO_STAGE, addedToStageListener);
}
protected function addedToStageListener(event:Event):void
{
trace(" Added to Stage from Code Behind ");
}
protected function clickHandler(event:Event):void
{
trace(" Click handled from component "+event.target);
}
}
}
MxXML部分<cookbook:CodeBehind xmlns:mx="http://www.adobe.com/2006/mxml" width="200" height="400" xmlns:cookbook="cookbook.*">
<cookbook:CodeBehind>
<mx:Button click="clickHandler(event)"/>
</cookbook:CodeBehind>
回复Comments
作者:
{commentrecontent}