PDA

View Full Version : Centering a popup from within flash


intrinsia
11-25-2007, 02:16 PM
I have gallery which consists of a bunch of thumbnail buttons that when pressed, load an external swf into an emptyMC and it is displayed overtop of the already loaded flash page. You can see an example here:

http://www.intrinsia.net/testing/gallery.html

This works great except for the fact that I need the flash popup to be center in the browser. Currently the external swf is using the positioning of the emptyMC as reference for where it should position itself. So as you can see if you scroll down to the bottom row of buttons and press one of them, it still loads the swf at the top of the page so you have to scroll back up in order to see it.

Is there anyway to load this 'testing' swf and have it be centered based on the browser you are using?

Many thanks in advance.


joel

papu123
11-25-2007, 03:56 PM
You can use the MovieClipLoader class, and when the .swf file is loaded, on the load init not load complete event you can position the movie clip on the center x axis and y axis.
listener.onLoadInit = function(){
myMovieClip ._x = Stage.width/2
myMovieClip._y = Stage.height/2
}
Search the adobe documentation on the MovieClipLoader class.
Make sure that the movieclip registration point is on the center, if not you must calculate the position based on the registration piont.
This is not the only solution but is one of them:).
I hope this helps.