开发者

Create a map in flash and zoom into it

Create a map in flash and zoom into it

I'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.


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;


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜