So I downloaded Neave's FlashEarth application that we love so much, but not only so I could see how he accessed the maps, but so I could see the easy code too. I was looking to spread some elements around a future project like he spreads the navigation and options in FlashEarth. First the code (edited for ease of use) then the explanation.
//initialize variables
var sw:Number = 0; // Stage width
var sh:Number = 0; // Stage height
// Position menu items at corners of the stage
this.onResize = function():Void {
sw = Stage.width || startWidth;
sh = Stage.height || startHeight;
//move left side to left of stage
topLeft_mc._x = bottomLeft_mc._x = Math.ceil((SIZE - sw) / 2);
//move right side to right of stage
topRight_mc._x = bottomRight_mc._x = Math.ceil((SIZE + sw) / 2);
//move top side to top of stage
topLeft_mc._y = topRight_mc._y = Math.ceil((SIZE - sh) / 2);
//move bottom side to bottom of stage
bottomLeft_mc._y = bottomRight_mc._y = Math.ceil((SIZE + sh) / 2);
};
//call resize elements once to initialize
this.onResize();
//tie resize elements to stage so when stage size
//is adjusted elements move around
Stage.addListener(this);
At first I saw the project and thought wow that must be hard, but then I saw the code and slapped my forehead (about the spreading at least). Simply put, when the Flash project is streched it automatically re-positions the four elements in the corners of the stage. This way your project is size dependent and not zoom dependent. Oh and one more very important thing:
Stage.scaleMode = "noScale";This needs to be placed at the start of your movie to keep the zoom effect in check.






