i have add a loader in the rawChildren of  the canvas . then , i have
add a ContextMenuEvent of the loader , but  the contextMenuEvent  is not
work ?  why ? help ?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " layout="absolute"
 
xmlns:mods="com.snail.frameworks.zone.view.window.detailsWin.component.m\
ods.*"
   creationComplete="create()" width="100%" height="100%" >

  <mx:Script>
   <![CDATA[
    import flash.utils.getQualifiedClassName;
    import mx.controls.Button;
    import mx.events.FlexEvent;
    import mx.containers.Canvas;
    import mx.core.UIComponent;

    private function create():void
    {
     var swf:Loader = new Loader()
     swf.load(new
URLRequest('http://resdaedal.wowniu.com/daedal/0/0/0/32/32.swf'));

     can.rawChildren.addChildAt(swf,1);

     for(var i:int=0;i<can.rawChildren.numChildren;i++)
     {
      trace(can.rawChildren.getChildAt(i))
     }

     var desktop_RM = new ContextMenu();
     desktop_RM.hideBuiltInItems();

     var item:ContextMenuItem;

     item = new ContextMenuItem("change background");
     item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT ,
menuSelHandle );
              desktop_RM.customItems.push(item);

              swf.contextMenu = desktop_RM ;
             
//trace(getQualifiedClassName(can.rawChildren.getChildAt(0)))
    }
    private function menuSelHandle(e:ContextMenuEvent):void
    {
     trace('background++++++++++++++++++')
    }
   ]]>
  </mx:Script>

  <mx:Canvas id="can" width="100%" height="100%"
backgroundColor="#CC0000" backgroundAlpha="0"  />

</mx:Application>


Reply via email to