<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Module之間的通信交互解決辦法

    看看以下的代碼,有點意思
    1.子Swf的Code,SampleChildren.mxml

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        
    <mx:Script>
            
    <![CDATA[
                import mx.managers.SystemManager;
                public 
    function output(s:String):void{
                    trace(s);
                }

                
                public 
    function CallFriend():void{
                    SampleChildren(_SystemManager.application).output(
    "call");
                }

                
                private 
    var _SystemManager:SystemManager;
                
                public 
    function register(ASystemManager:SystemManager):void{
                    _SystemManager
    =ASystemManager;
                }

                    
            ]]
    >
        
    </mx:Script>
    </mx:Application>

    2.主swf的Code, SampleParent.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
        
    <mx:Script>
            
    <![CDATA[
                import mx.managers.SystemManager;
                
                
    var Children1,Children2:SystemManager;
                
                private 
    function onClick(e:Event):void{
                    SampleChildren(Children1.application).register(Children2);
                    SampleChildren(Children2.application).register(Children1);
                }

                
                private 
    function initNestedAppProps():void {
                    Children1 
    = SystemManager(myLoader.content);
                    trace(Children1.application);
                }

                private 
    function initNestedAppProps2():void {
                    Children2 
    = SystemManager(myLoader2.content);
                    trace(Children2.application);
                }

                
                private 
    function onC1(e:Event):void{
                    SampleChildren(Children1.application).CallFriend();
                }
      
                private 
    function onC2(e:Event):void{
                    SampleChildren(Children2.application).CallFriend();
                }
                  
                
            ]]
    >
        
    </mx:Script>
        
    <mx:Button label="ClickMe" click="onClick(event);"/>
        
        
    <mx:Button label="c1 call c2" click="onC1(event);"/>
        
    <mx:Button label="c2 call c1" click="onC2(event);"/>
        
        
    <mx:SWFLoader id="myLoader" width="300"
            source
    ="SampleChildren.swf"
            creationComplete
    ="initNestedAppProps();"/>
        
    <mx:SWFLoader id="myLoader2" width="300"
            source
    ="SampleChildren.swf"
            creationComplete
    ="initNestedAppProps2();"/>    
    </mx:Application>

    注意到SampleParent.mxml文件中SampleChildren類的使用了么,原來mxml文件也是對應(yīng)一個同名的actionscript class的,這個class是從Application派生的。但是要注意哦,SampleParent.mxml編譯時必須能夠看到SampleChildren類的Source。

    posted on 2008-01-04 12:27 雁過無痕 閱讀(506) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    <2008年1月>
    303112345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    導(dǎo)航

    統(tǒng)計

    常用鏈接

    留言簿(7)

    隨筆檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 国产日韩在线视频免费播放| 亚洲国产精久久久久久久| 亚洲一级高清在线中文字幕| 九九久久国产精品免费热6| 亚洲性猛交xx乱| 91大神在线免费观看| 亚洲线精品一区二区三区| 国产99久久久国产精免费| 欧洲人成在线免费| 成年私人影院免费视频网站| 日韩亚洲变态另类中文| 亚欧洲精品在线视频免费观看| 亚洲综合国产精品第一页| 亚洲国产成人精品无码区在线秒播| 99视频精品全部免费观看| 亚洲第一成年网站大全亚洲| 特级毛片在线大全免费播放| 120秒男女动态视频免费| 亚洲国产天堂久久综合| 99精品免费视品| 亚洲精品国精品久久99热 | 色婷五月综激情亚洲综合 | 久久爰www免费人成| 久久精品国产亚洲AV无码麻豆| 成人a毛片视频免费看| 亚洲无人区一区二区三区| 99re在线视频免费观看| 亚洲精品午夜国产va久久| 久久久久免费精品国产小说| 亚洲国产精品日韩在线观看 | 亚洲日韩在线中文字幕第一页| 中文字幕乱理片免费完整的| 亚洲国产一区在线| 91在线视频免费91| 一级中文字幕乱码免费| 久久精品亚洲一区二区三区浴池| 在线jlzzjlzz免费播放| 成人免费av一区二区三区| 亚洲一级毛片免观看| 亚洲美女在线国产| 很黄很黄的网站免费的|