Hi,
I’m heaving trouble centering the preloader on the center of the stage.
The preloader is basically a rotating oval shape.
so, below is the code that for some reson puts the circle in the top left corner…
stop();
var circle:LoadCircle = new LoadCircle();
var circle_WIDTH:Number = circle.width;
var circle_HEIGHT:Number = circle.height;
addChild(circle);
circle.x = stage.width/2 - circle_WIDTH/2;
circle.y = stage.height/2 - circle_HEIGHT/2;
loaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
this.loaderInfo.addEventListener(Event.COMPLETE, onComplete);
function loadProgress(e:Event):void {
var total:Number=this.stage.loaderInfo.bytesTotal;
var loaded:Number=this.stage.loaderInfo.bytesLoaded;
var percent:Number=loaded/total;
var txt:int = int((Math.round(percent * 100)));
trace(txt + "%");
trace("Stage H: " + stage.height + ",Stage W: " + stage.width);
circle.rotation += 10;
}
function onComplete(e:Event):void
{
nextFrame();
}
as you can see i’ve outputed the stage.height and width variables and here’s what i’ve got…
28%
Stage H: 63.4,Stage W: 124.5
28%
Stage H: 70.5,Stage W: 123.5
29%
Stage H: 79.75,Stage W: 118.8
29%
Stage H: 86.5,Stage W: 110.4
29%
Stage H: 90.6,Stage W: 98.7
meaning… the stage is not static, but it dynamically shrinks and expands to the size of the oval preloader…
how to make the stage “static” so that when I set the size in the document properties, centering an object in AS3 will stick to it?
thanks in advance for the anwsers…