Flex下as代码和MXML分离

      flex专区 2009-3-2 17:31

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>

标签集:TAGS:Flex as3 mxml
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}