tags:

views:

48

answers:

1

Hi. I have a worldmap.swf, were I have incorporated a small logo in any continent, that clicking in each one it gives me only 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

+1  A: 

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);
}
Amarghosh
Hi there.Thank you very much for your help.Never the less I'm a newbie in flash.There is a possibility of send you the file and you do one link and give instructions step by step how to he others?I would be very much gratefullyyou can find me at [email protected] if you whish.
agimoura
Didn't this code work? What was the error? Set `gotoWebsite` as the `click` event listener of all the logos (or the links therein). Now within the function find the clicked one using the `event.target` property and use the corresponding url.
Amarghosh
I've update the code using arrays (which I think is simpler). Ask your doubts here - that's what SO is for - mailing them to me is not okay.
Amarghosh
I cannot find where must i addthe code. I open the fla with the flash. I have several layers and I do not know yet how to work much abou it. I cannot find the code that you wre talking about. In wich laer must i set the code? That's the reason that i'm asking if you can do one and tell me how must i do it. thanks
agimoura
I work on Flex Builder (and not CS3), so I cannot even open an fla to begin with. Search for some CS3 tutorials to learn how to add event listeners to objects in an fla and where to add code.
Amarghosh