新手求教:怎么通过点击flash的一个按钮 弹出另外一个swf文件
我新建了一个swf文件,并且做了一些补间动画,并里面加了按钮元件,怎么通过点击这个按钮,然后弹出我想加载的另外一个swf文件?我用的是AS3.0,我在网上找了些方法,但老是运行不了。
求哪位大神告诉下哈,最好把具体的代码都发过来,我不晓得引入哪个包,刚学没多久的,照顾下,呵呵
越具体越好哈,谢谢了
[解决办法]
import flash.display.Loader;import flash.net.URLRequest;import flash.events.Event;var loader:Loader = new Loader();addChild(loader);btn.addEventListener(MouseEvent.CLICK,myevt);function myevt(evt:MouseEvent){ loader.unloadAndStop(); loader.load(new URLRequest("xxx.swf")); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,compEvt);}function compEvt(evt:Event){ trace(stage.stageWidth,stage.stageHeight); trace(loader.contentLoaderInfo.width,loader.contentLoaderInfo.height); loader.x = stage.stageWidth / 2 - loader.contentLoaderInfo.width / 2; loader.y = stage.stageHeight / 2 - loader.contentLoaderInfo.height / 2;}