在 Flash 中创建地图并放大
我已经在 Flash 中创建了一个世界地图,并且我想编写一个 ActionScript 代码,以便如果我单击一个国家的地图,它应该放大并在该国家旁边显示一些信息。
我不知道如何开始。样品可能会更好。
如果您知道任何好的分步教程网站,请告诉我。
在这里找到图片以供参考:ASIA
我已经添加了我创建的 ASIA 部分。当我点击印度时,它应该放大它。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
创建一个以舞台为中心的最外层容器:
创建一个内部容器并将其添加到外壳中:
将地图放在内部:
要缩放,请缩放外壳:
并定义所需的点要以舞台为中心(您想要关注的焦点),请将 inner 的
x
和y
设置为该点的负值。例如,假设澳大利亚的人口数量为 300,220:Create an outermost container that is centred on the stage:
Create an inner container and add this to the shell:
Place your map within the inner:
To zoom, scale the shell:
And to define what point you want to have centred on the stage (what you want to focus on), set the
x
andy
of inner to be negative of the point. Like, say if Australia was at 300,220:点击一个国家来放大它并不是那么困难,无论你的国家是一个影片剪辑还是你使用某种形式的按钮覆盖,你最终都会触发一个函数
1/ ,它会根据事件目标/事件补间到你的地图中目标坐标。
2/ 打开一个显示该国家/地区信息的窗口
每个国家都可以是一个具有一组属性的类。单击一个国家/地区基本上将从所选对象中提取信息以显示在窗口中
您似乎已经处理了困难的部分,即地图本身的设计。
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.