本文主要是介绍AS3嵌入(Embed)资源,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、嵌入swf/**
* 嵌入测试
* @date 2012-7-6 下午5:10:10
* @author 忧里修斯
*
*/
package com.dream.test
{
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.utils.ByteArray;
public class EmbedTest extends Sprite
{
[Embed(source="./role.swf", mimeType="application/octet-stream")]
private var RoleSwf:Class;
private var _loader:Loader;
public function EmbedTest()
{
var obj:Object = new RoleSwf();
_loader = new Loader();
_loader.loadBytes(new RoleSwf() as ByteArray);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onLoadCompleteHandler);
}
private function onLoadCompleteHandler(e:Event):void
{
var mc:MovieClip = _loader.content as MovieClip;
this.addChild(mc);
}
}
}
这篇关于AS3嵌入(Embed)资源的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!