假设有一个由我方网站上部署的3d派对构建的SWF(最典型的例子,一个flash广告),技术上是否可以创建另一个嵌入原始SWF且能够计数的SWF(容器)点击并捕获悬停事件?有没有这种实施的例子?
答案 0 :(得分:0)
您可以尝试以下示例:
var external:DisplayObject;
var loaderContext:LoaderContext = new LoaderContext();
loaderContext.applicationDomain = ApplicationDomain.currentDomain;
var loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
loader.load(new URLRequest(SWF_PATH), loaderContext);
private function onLoadComplete(event:Event):void {
this.external = this.loader.content;
this.external.addEventListener(MouseEvent.CLICK, onMouseClick);
this.addChild(this.external);
}
private function onIOError(event:IOErrorEvent):void {
}
private function onMouseClick(event:MouseEvent): void {
}