[F8] Keeping FLVPlayback Component Centered within movieClip on resize?
Hey all,
I've got a project in which I'm loading a movieClip that contains an FLVPlayback component. Without the component the movieClip itself will stay centered upon a screen resize. Add the component, however, and the entire clip moves to the left of the screen at resize. Here's my code on the 1st page:
Code:
//start Stage re-size code
Stage.align = "LT";
Stage.scaleMode = "noScale";
// ---> Create a new listener object
var stageListener:Object = new Object();
// ---> Define the resize function...
stageListener.onResize = function() {
// ---> first, get the new dimensions of the stage....
var stageWidth:Number = Math.round(Stage.width);
var stageHeight:Number = Math.round(Stage.height);
trace("Stage size is now " + Stage.width + " by " + Stage.height);
mcButtons._x = stageWidth1;
btn1._x = stageWidth1;
btn1._y = stageHeight-50;
mcTitleMCmain._x = stageWidth1;
mcTitleMCmain._y = stageHeight-50;
btn3._x = (stageWidth/2.25) - (btn3._width/1) ;
btn3._y = stageHeight-100;
btnMCDesigner._x = stageWidth-40;
//btnMCDesigner._y = stageHeight200;
btnMCSustain._x = stageWidth-100;
//btnMCSustain._y = stageHeight200;
Stage.align = "LT";
Stage.scaleMode = "noScale";
//
myListener = new Object();
myListener.onResize = centercontent;
Stage.addListener(myListener);
//
function centercontent() {
wallPaper_mc._x = Math.ceil(Stage.width/2-wallPaper_mc._width/2);
wallPaper_mc._y = Math.ceil(Stage.height/2-wallPaper_mc._height/2);
mcAetnaMain._x = Math.ceil(Stage.width/2-mcAetnaMain._width/2);
mcAetnaMain._y = Math.ceil(Stage.height/2-mcAetnaMain._height/2);
movie._x = Math.ceil(Stage.width/2-movie._width/2);
movie._y = Math.ceil(Stage.height/2-movie._height/2);
mcSpecialists2._x = Math.ceil(Stage.width/2-mcSpecialists2._width/2);
mcSpecialists2._y = Math.ceil(Stage.height/2-mcSpecialists2._height/2);
mcSpecialists3._x = Math.ceil(Stage.width/2-mcSpecialists3._width/2);
mcSpecialists3._y = Math.ceil(Stage.height/2-mcSpecialists3._height/2);
test._x = Math.ceil(Stage.width/2-test._width/2);
test._y = Math.ceil(Stage.height/2-test._height/2);
}
//
centercontent();
};
// ---> Apply the listener...
Stage.addListener(stageListener);
// ---> Run the function...
stageListener.onResize();
//--------------------//
mcAetnaMain is the clip that loads.
on the button that loads the clip, I've got this:
Code:
on (press) {
var newClip = this.attachMovie("mcAetnaMain", "mcAetnaMain", 30);
mcAetnaMain._x = (Stage.width/2) - (mcAetnaMain._width/2);
mcAetnaMain._y = (Stage.height/2) - (mcAetnaMain._height/2);
centercontent();
}
on (rollOver) {
this.attachMovie("mcAetnaThumb","mcAetnaThumb",20);
}
on (rollOut) {
this.createEmptyMovieClip("blank",20);
}
Any ideas as to why the FLV component won't stay centered? I'm stumped.
Thanks