Graphics Programs Reference
In-Depth Information
import flash.events.Event;
import flash.events.MouseEvent;
import flash.filters.ColorMatrixFilter;
import flash.geom.ColorTransform;
import flash.text.TextField;
import flash.net.*;
The first section imports classes from the Modest Maps package, whereas
the second section imports display objects and event classes provided by
Flash. The name of each class isn't important right now. That becomes
clear as you use them. However, the naming pattern for the first section
matches the directory structure, starting with com , then modestmaps , and
ending with Map . This is how you import classes most of the time when you
write your own ActionScript.
Above public class Openings extends Sprite , several variables—width,
height, background color, and frame rate—of the compiled Flash file are
initialized.
[SWF(width=”900”, height=”450”, backgroundColor=”#ffffff”,
frameRate=”32”)]
Then after the class declaration, you need to specify some variables and
initialize a Map object.
private var stageWidth:Number = 900;
private var stageHeight:Number = 450;
private var map:Map;
private var mapWidth:Number = stageWidth;
private var mapHeight:Number = stageHeight;
In between the brackets of the Openings() function, you can now create
your first interactive map with Modest Maps.
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
// Initialize map
map = new TweenMap(mapWidth, mapHeight, true, new
OpenStreetMapProvider());
map.setExtent(new MapExtent(50.259381, 24.324408, -128.320313,
-59.941406));
addChild(map);
Search WWH ::




Custom Search