我正在使用以下AS3代码将外部swf(一个具有我不喜欢的尺寸)加载到另一个swf中。当我在html页面中嵌入时查看加载器swf时,即使加载器swf在预览中显示嵌套的swf而没有任何问题,也不显示任何内容。
package
{
import flash.display.Loader;
import flash.display.MovieClip;
import flash.net.URLRequest;
import flash.events.Event;
public class Main extends MovieClip
{
private var swfLoader:Loader;
public function Main()
{
swfLoader = new Loader();
swfLoader.load(new URLRequest("nested.swf"));
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
}
private function loadComplete(e:Event)
{
addChild(swfLoader);
}
}
}
这是我正在使用的HTML:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<link href="../includes/samplestyle.css" rel="stylesheet" type="text/css"/>
<script src="../Scripts/swfobject_modified.js" type="text/javascript"></script>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="../includes/AC_RunActiveContent.js" language="javascript"></script>
</head>
<body style="background-color: transparent;">
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '320',
'height', '240',
'src', 'includes/loaderSwf',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'transparent',
'devicefont', 'false',
'id', 'includes/loaderSwf',
'bgcolor', '#ffffff',
'name', 'includes/loaderSwf',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', '../includes/loaderSwf',
'salign', ''
); //end AC code
}
</script>
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="320" height="240" id="includes/loaderSwf" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="../includes/loaderSwf.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> <embed src="../includes/loaderSwf.swf" quality="high" bgcolor="#ffffff" width="320" height="240" name="includes/loaderSwf" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</noscript>
</body>
</html>
如果我用嵌套的swf名称替换名称“loaderSwf”,它可以正常播放。似乎本地html页面不喜欢我通过另一个swf玩swf的事实。有人在里面有这个吗?
答案 0 :(得分:1)
看起来你的loaderSwf和nested.swf与你的html文件不在同一个地方。尝试执行swfLoader.load(new URLRequest("includes/nested.swf"));
或swfLoader.load(new URLRequest("../includes/nested.swf"));
,具体取决于文件结构的外观。
显示从swfLoader抛出的加载错误消息可能也很有用。