我的.SWF横幅有问题,当我打开直接对象http://www.tenisovysvet.sk/TS_banner.swf时,一切正常,但当我将此对象放入html网站时,在文章图片上打开文章后出现问题/标题。哪里可能有问题?
嵌入代码
<object width="160" height="600">
<param name="movie" value="http://www.tenisovysvet.sk/TS_banner.swf">
<embed src="http://www.tenisovysvet.sk/TS_banner.swf" width="160" height="600">
</embed>
</object>
BANNER CODE ACTIONSCRIPT 3
ar xmlData:XML = new XML();
var theURL_ur:URLRequest = new URLRequest("http://www.tenisovysvet.sk/banner.xml");
var loader_ul:URLLoader = new URLLoader(theURL_ur);
loader_ul.addEventListener("complete", fileLoaded);
function fileLoaded(e:Event):void
{
xmlData = XML(loader_ul.data);
t1.htmlText= "<a href='" + xmlData.clanok[0].link + "'>" + xmlData.clanok[0].title + "</a>";
t2.htmlText= "<a href='" + xmlData.clanok[1].link + "'>" + xmlData.clanok[1].title + "</a>";
t3.htmlText= "<a href='" + xmlData.clanok[2].link + "'>" + xmlData.clanok[2].title + "</a>";
import flash.net.URLRequest;
var imageLoader:Loader;
var imageRequest:URLRequest;
imageLoader = new Loader();
imageRequest = new URLRequest(xmlData.clanok[0].foto);
imageLoader.load(imageRequest);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showPic);
var imageLoader2:Loader;
var imageRequest2:URLRequest;
imageLoader2 = new Loader();
imageRequest2 = new URLRequest(xmlData.clanok[1].foto);
imageLoader2.load(imageRequest2);
imageLoader2.contentLoaderInfo.addEventListener(Event.COMPLETE,showPic);
var imageLoader3:Loader;
var imageRequest3:URLRequest;
imageLoader3 = new Loader();
imageRequest3 = new URLRequest(xmlData.clanok[2].foto);
imageLoader3.load(imageRequest3);
imageLoader3.contentLoaderInfo.addEventListener(Event.COMPLETE,showPic);
function showPic(e:Event):void
{
var imageHolder: Sprite = new Sprite();
imageHolder.addChild(imageLoader.content);
imageHolder.buttonMode = true;
imageHolder.width = 140;
imageHolder.height = 87;
imageHolder.x = 10;
imageHolder.y = 65;
imageHolder.addEventListener(MouseEvent.CLICK, buttonClicked1);
addChild(imageHolder);
var imageHolder2: Sprite = new Sprite();
imageHolder2.addChild(imageLoader2.content);
imageHolder2.buttonMode = true;
imageHolder2.width = 140;
imageHolder2.height = 87;
imageHolder2.x = 10;
imageHolder2.y = 245;
imageHolder2.addEventListener(MouseEvent.CLICK, buttonClicked2);
addChild(imageHolder2);
var imageHolder3: Sprite = new Sprite();
imageHolder3.addChild(imageLoader3.content);
imageHolder3.buttonMode = true;
imageHolder3.width = 140;
imageHolder3.height = 87;
imageHolder3.x = 10;
imageHolder3.y = 425;
imageHolder3.addEventListener(MouseEvent.CLICK, buttonClicked3);
addChild(imageHolder3);
}
function buttonClicked1(event: MouseEvent): void {
var buttonClicked1: URLRequest = new URLRequest(xmlData.clanok[0].link);
navigateToURL(buttonClicked1, "_self");
}
function buttonClicked2(event: MouseEvent): void {
var buttonClicked2: URLRequest = new URLRequest(xmlData.clanok[1].link);
navigateToURL(buttonClicked2, "_self");
}
function buttonClicked3(event: MouseEvent): void {
var buttonClicked3: URLRequest = new URLRequest(xmlData.clanok[2].link);
navigateToURL(buttonClicked3, "_self");
}
}
非常感谢!
答案 0 :(得分:0)
这是一个安全问题,您应该允许您的swf在同一窗口(_self
目标)中打开链接,这就是您应该allowScriptAccess
添加value="always"
的原因:
<object width="160" height="600">
<param name="movie" value="http://www.tenisovysvet.sk/TS_banner.swf">
<param name="allowScriptAccess" value="always">
<embed src="http://www.tenisovysvet.sk/TS_banner.swf" width="160" height="600" allowScriptAccess="always"></embed>
</object>