Application registration point get’s *@$#* when using a div over the application

February 20th, 2008 by Jaap Kooiker

This is like…. what?
I recently discovered that there’s a problem with the registration point when a html layer (eg div) is placed above the flash runtime. For some weird reason the Application registration point is set to zero according to the x and y of the overlay div (see sample). I for sure cannot change that registration point so why is it changing. The other thing is that all content stays in place at the right coordinates, but the mouse position shows us (see example below) that the registration point changes - it looks like that anyway.
From my opinion this is a bug of the player. The weird thing is that this only occurs in FireFox and not in IE.
It could be a serious problem when you wan’t to know last registered mouseX and mouseY before “leaving” the stage.

note:
I got a rather “innovative” (read: not nice) sollution to know the last real mouseX and mouseY postion.
Keep the last 2 known positions in an array and stop registering on Event.MouseLeave. Use the fore-last position in you’re application to determine the last valid position.

Check this Sample

Is there someone who can tell me why this “Phenomenon” occurs? I would like to know….why…

Edit Firefox 2.0.0.12 / Fp 9.0.115.0:

Jaap Kooiker

Posted in Actionscript 3.0, Bugs, Components, Did you know?, Flex | 4 Comments »

Flex - Custom preloader IE stageWidth - stageHeight problem fixed

February 15th, 2008 by Jaap Kooiker

My…my…my…
Internet Explorer is like….bad for your health (but you already know that)

In one of the projects I was working on, we used the custom preloader class by Jesse Warden. This way we were able to define our own preloader and it works great, but ofcours not in IE. The alignment in IE doesn’t seem to work after a refresh - or not even at all. This doesn’t happen in any other respectable browser and when using the default flex html template. But we use SWFObject in our projects and then the problem occurs (again only in IE). For the record…it isn’t a SWFObject problem.

After placing a resize event listener on the stage the following occurs.
For some weird reason IE triggers a Resize event at a point when stage width and height is still zero. And at init both width and height are also zero. These 2 resize events aren’t dispatched in for instance FireFox. So no problem there : )

To solve this IE problem (yes…just so you know that’s an IE problem) a resize eventListener has to be declared in the set preloader method (see sample below). Then a modification in the centerPreloader has to be made.
Jesse placed :
x = (stageWidth / 2) - (clip.width / 2);
y = (stageHeight / 2) - (clip.height / 2);

instead use the following:
x = (stage.stageWidth / 2) - (clip.width / 2);
y = (stage.stageHeight / 2) - (clip.height / 2);

And there you go…now it works fine, even in IE : )

Sample - Source

Posted in Actionscript 3.0, Components, Did you know?, Flex | 5 Comments »