文章出處

例子很簡單,主要就是演示了下面二種調用方式。

1、在Flex中調用Flash中的方法。

2、在Flash中派發自定義事件到Flex中,并在Flex中監聽此事件和取到事件中傳送過來的數據。


感興趣的直接下載代碼看吧!代碼太簡單我就不貼代碼上來了。

示例下載

 

 

// ***************************************************************************************

補充一下Flash生成的swf文件如果是用Embed標簽嵌入在Flex工程中的時候,swf的方法如何調用:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    
<mx:Script>
        
<![CDATA[    
            [Embed(source="test_cs3.swf")]
            private var testCS:Class;
            
            [Bindable]
            private var test_cs:MovieClip = new testCS();

            private function testClicked():void
            {
                // test為test_cs3.swf中定義的一個方法
                Loader(test_cs.getChildAt(0)).content.test();        
            }
        
]]>
    
</mx:Script>

    
<mx:Image x="111" y="88" source="{test_cs}" id="flashContent"/>
    
<mx:Button x="294.5" y="43" label="Test" click="testClicked()" width="157" height="63"/>
</mx:Application>


 


不含病毒。www.avast.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 AutoPoster 的頭像
    AutoPoster

    互聯網 - 大數據

    AutoPoster 發表在 痞客邦 留言(0) 人氣()