透明层正在阻止加载的 swf 文件的事件。您需要为此图层使用mouseEnabled
属性。false
我不知道这是否适合您,但我认为这可能有用。在主 swf 中添加以下代码。
import flash.display.Loader;
import flash.events.Event;
import flash.events.MouseEvent;
import fl.transitions.Tween;
import fl.motion.easing.Linear;
// Disables the mouse interations
transparentLayer.mouseEnabled = false;
// Initialize with alpha 0
transparentLayer.alpha = 0;
// Cretes the loader
var loader:Loader = new Loader();
// Listen the complete event
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
// Loads the external swf files
loader.load(new URLRequest("swf.swf"));
// Add in the background
addChildAt(loader, 0);
// Listen the complete event
function loadComplete (event:Event) {
// Add the mouse events to the loaded content
loader.contentLoaderInfo.content.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);
loader.contentLoaderInfo.content.addEventListener(MouseEvent.ROLL_OUT, mouseHandler);
}
// Handles de mouse events of the loaded swf
function mouseHandler (event:MouseEvent)
{
switch (event.type)
{
case MouseEvent.ROLL_OVER :
// Shows the transparentLayer from the current alpha value to 1 in 1 second
new Tween(transparentLayer, "alpha", Linear.easeNone, transparentLayer.alpha, 1, 1, true);
break;
case MouseEvent.ROLL_OUT :
// Shows the transparentLayer from the current alpha value to 0 in 1 second
new Tween(transparentLayer, "alpha", Linear.easeNone, transparentLayer.alpha, 0, 1, true);
break;
}
}
透明层失去了所有的互动,所以你需要在外部应用运动效果。在这里你可以下载运行http://cl.ly/LtfA的项目