日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

SWFLibrary类加载外部资源库

發(fā)布時(shí)間:2025/7/14 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SWFLibrary类加载外部资源库 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

在as3中使用到外部SWF文件做為資源庫(kù),通常是用ApplicationDomain類(lèi)的getDefinition()來(lái)得到類(lèi)定義,

再進(jìn)行實(shí)例化。SWFLibrary類(lèi)對(duì)這一方法封裝,讓調(diào)用外部資源庫(kù)更通簡(jiǎn)單易用。
// 建立SWFLibrary類(lèi)的實(shí)例, 添加偵聽(tīng)器和加載swf文件----creates an instance of SWFLibrary, adds a listener, and loads a SWF
var gameAssets:SWFLibrary = new SWFLibrary
gameAssets.addEventListener( Event.COMPLETE, handleAssetsLoaded );
gameAssets.load( "myCustomGameAssets.swf" );
?function handleAssetsLoaded(){
// 訪(fǎng)問(wèn)資源----accesses the asset (assumes there is a symbol exported as 'Character' in the loaded SWF, as seen in step 1 above)
//? 以下代碼在上面的事件[Event.COMPLETE]觸發(fā)時(shí)運(yùn)行----this code should run after the Event above has fired
var mySprite:Sprite = gameAssets.getSprite( "Character" );
addChild( mySprite );
?
// 獲取MovieClip資源----gets the asset as a MovieClip (assuming, of course, that it actually is a movieclip)
var myMC:MovieClip = gameAssets.getSprite( "Character" );
addChild( myMC );
?
// 獲取聲音元件----getting a sound
var mySound:Sound = gameAssets.getSound( "SoundLinkageNameHere" );
mySound.play();
}

SWFLibrary 下載
Usage
1 – In Flash, select “Export for ActionScript” in the symbol’s Linkage settings in the Library (ex. ‘Character’).
在Flash中,選擇“作為ActionScript導(dǎo)出”,名稱(chēng)就是到時(shí)候要引用的那個(gè),例如“Character”
2 – Publish the Flash file as a SWF.
發(fā)布成為swf
3 – Load the SWF into an instance of SWFLibrary
在SWFLibrary中加載
4 – Access the symbol through SWFLibrary, using the class name chosen in Step 1.
通過(guò)SWFLibrary,使用第一步里面的名稱(chēng),就可以調(diào)用了

轉(zhuǎn)載于:https://www.cnblogs.com/bulolo/archive/2012/10/29/2744152.html

總結(jié)

以上是生活随笔為你收集整理的SWFLibrary类加载外部资源库的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。