background scaling problem here. advice, plz?
hi.
i'd really appreciate if someone would care to give this a thought and help me out! i found advice in a thread here of how to make a scalable background, that is a background mc (bg) that always scales to fill all screens and content mc (content) that doesn't scale and stays always centered when resizing screen, holding the main movies.
my trouble is that the movie that should stay centered does not always do so when i resize the screen. to begin with it's ok, but when i alter screen size the content mc often gets stuck on top of the screen, and the only way i can get it back is to refresh the whole page.
i can't solve the problem myself. i add the code i'm using here. how should i alter it? or is there any smarter way to achieve the desired effect? a simple uniform bg will not be enough for my chosen page design... i'm using flash 8, mozilla and ie for testing.
thanks for shredding light into my darkness :)
Code:
// noScale prevents content in the movie resizing (unless we tell it to!)
Stage.scaleMode = "noScale";
// TL means all positions measured from the top left hand corner
Stage.align = "TL";
// a function to be called when the movie resizes
// this will resize the background clip to fill the stage
bg.onResize = function() {
this._width = Stage.width;
this._height = Stage.height;
};
// get the bg clip to listen for events (onResize)
// broadcast by the stage object
Stage.addListener(bg);
bg._x = bg._y = 0;
bg.onResize();
// this function will position the content clip in the centre
// when the movie resizes
content.onResize = function() {
this._x = (Stage.width - this._width) / 2;
this._y = (Stage.height - this._height) / 2;
};
Stage.addListener(content);
content.onResize();