Question

enter image description hereI've created a world map in flash and I want to code an ActionScript so that if I click on a country the map, it should zoom into it and show some information beside the country.

I dont know how to start it. A sample could be better.

Please let me know if you know any good step by step turial site.

Find the pic here for reference : ASIA

I have added the ASIA part which i have created. When i click on India, it should zoom into it.

Was it helpful?

Solution

Create an outermost container that is centred on the stage:

var shell:MovieClip = new MovieClip();
shell.x = stage.stageWidth / 2;
shell.y = stage.stageHeight / 2;

addChild(shell);

Create an inner container and add this to the shell:

var inner:MovieClip = new MovieClip();
shell.addChild(inner);

Place your map within the inner:

inner.addChild(my_map);

To zoom, scale the shell:

shell.scaleX = shell.scaleY = 2.2;

And to define what point you want to have centred on the stage (what you want to focus on), set the x and y of inner to be negative of the point. Like, say if Australia was at 300,220:

inner.x = -300;
inner.y = -220;

OTHER TIPS

Clicking on a country to zoom into it is not so difficult, whether your country is a movie clip or you use some form of button overlay, you will eventually trigger a function

1/ that will tween into your map according to the event target/event target coordinates. 2/ open up a window showing the country's info Each country could be a class with a set of properties. Clicking on a country will basically pull out the info from the selected object to be displayed in the window

You seem to have handled the difficult part already , namely the design of the map itself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top