By the way, you shouldn’t define the event handlers within the onClipEvent (enterFrame) handler. Use an onClipEvent (load) handler, or define them on the Frame actions. =)
[AS]
bottom = Stage.height-(this._height/2); // should be equal to (400-30) but is doesn’t (bottom = 400-30; works)
top = this._height/2; // this works
right = Stage.width-(this._width/2); // should be equal to (550-30) but is doesn’t (right = 550-30; works)
left = this._width/2; // this works
[/AS]
I dont see why this is not working, I see no reason why it shouldn’t…
[AS]
bottom = Stage.height-(this._height/2); // should be equal to (400-30) but is doesn’t (bottom = 400-30; works)
Aha, finally someone in the need for my fix!
Too bad you went to all this trouble, because I knew how to fix this when I read your first post
Anyway, if you call Stage.width and Stage.height during Flash runtime, it will not give the correct properties. It will only do this once, after you start the movie!(*)
So what we need to do is catch the variables at that point, and save those. Instead of doing this in another variable, you can just overwrite the Stage properties.
(*) - Well, Flash doesn’t even return the correct values, but the movie dimensions minus 4
It confirmed that this is fixed in Flash MX 2004, but the original program where invalid dimensions are being returned the second time still remain
In addition, with the new Actionscript 2.0 parsing engine, you will not be allowed to overwrite a static object such as Stage anymore. Object classes need to be defined as “dynamic” in order to do so.
Think. What happens when you test a movie in Flash? The swf window pops up and maximizes. What are the stage dimensions on a maximized window? **** big. So, in testing your swf in Flash, restore your swf window so it will be played with a normal stage size. Then the Stage object will report the ‘correct’ stage dimensions
(Im hoping I didnt do a skim thing where I missed the point as I often do)