modest map 01
♥0 |
Line 48 |
Modified 2010-01-07 20:20:03 |
MIT License
archived:2017-03-20 05:39:43
ActionScript3 source code
/**
* Copyright Wasp ( http://wonderfl.net/user/Wasp )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8RMy
*/
1. // BSD License http://modestmaps.com/license.txt
2. // see http://modestmaps.com/
3. // copied from ModestMaps-AS3-1.0-latest/as3/samples/as3/ModestMapsExamples/HelloMap.as
4. package {
5. import com.modestmaps.Map;
6. import com.modestmaps.TweenMap;
7. import com.modestmaps.events.MapEvent;
8. import com.modestmaps.extras.MapControls;
9. import com.modestmaps.extras.MapCopyright;
10. import com.modestmaps.extras.ZoomSlider;
11. import com.modestmaps.mapproviders.microsoft.MicrosoftHybridMapProvider;
12.
13. import flash.display.Sprite;
14. import flash.display.StageAlign;
15. import flash.display.StageScaleMode;
16. import flash.events.Event;
17. import flash.events.MouseEvent;
18. import flash.text.TextField;
19. import flash.text.TextFormat;
20.
21. [SWF(backgroundColor="#ffffff")]
22. public class HelloMap extends Sprite
23. {
24. public var map:Map;
25.
26. public function HelloMap()
27. {
28. stage.align = StageAlign.TOP_LEFT;
29. stage.scaleMode = StageScaleMode.NO_SCALE;
30.
31. map = new TweenMap(stage.stageWidth, stage.stageHeight, true, new MicrosoftHybridMapProvider());
32. map.addEventListener(MouseEvent.DOUBLE_CLICK, map.onDoubleClick);
33. addChild(map);
34.
35. map.addChild(new MapControls(map));
36. map.addChild(new ZoomSlider(map));
37. map.addChild(new MapCopyright(map));
38.
39. // make sure the map fills the screen:
40. stage.addEventListener(Event.RESIZE, onStageResize);
41. }
42.
43. public function onStageResize(event:Event):void
44. {
45. map.setSize(stage.stageWidth, stage.stageHeight);
46. }
47. }
48. }