开发者

Links in a swf file

I have a worldmap.swf, were I have incorporated a small logo in any continent, that clicking in each one it gives me on开发者_Python百科ly the countries of that specific continent, where also incorporated another logo in each country. I need to create a link in every country’s logo, which must open a different web site. Example: one logo in North America continent, which opens UDSA and Canada. By clicking the logo of USA must open a web site relating to USA, the logo of Canada, must open a website relating to Canada, and so on Can somebody help me here? Thanks


Use flash.net.navigateToURL().

Store logos in an array and their corresponding urls in another one. Assign same click handler to all the logos. Within the handler, find the index of clicked logo (event.target) in the logos array and get the corresponding url using that index and navigate to that url.

var logos:Array = [usLogo, ukLogo, asiaLogo, /*etc*/];
var urls:Array = ["usa.html", "uk.html", "asia.html", /*etc*/];

for each(var logo:MovieClip in logos)
  logo.addEventListener(MouseEvent.CLICK, gotoWebsite);

function gotoWebsite(event:Event):void
{
  var index:Number = logos.indexOf(event.target);
  var url:String = urls[index];
  navigateToURL(url);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜