Skip to main content
Known Participant
March 2, 2012
Question

Movie Clip in center stage even fullscreen

  • March 2, 2012
  • 1 reply
  • 751 views

how do I get a movie clip in the center of the stage, even if it moves to fullscreen

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
March 2, 2012

the needed code depends on your movieclip's registration point.  is it at your movieclip's top-left?  center?  elsewhere?

armandixAuthor
Known Participant
March 2, 2012

kglad I have the movie in the library and did the following code:

state_situation = function (){

leave = _root.attachMovie("leave", "leave", this.getNextHighestDepth() + 700);

this.leave._x = Stage.width /2;

this.leave._y = Stage.height /2;

};

state_situation();


the problem is :

if I am running the file in normal mode the movieclip "leave" is in center stage.

But if I run the file in fullscreen mode the movieclip "leave" , leaves for the center stage



kglad
Community Expert
Community Expert
March 2, 2012

use a stage resize listener:

Stage.scaleMode = "noScale"

var lo:Object = {};

lo.onResize = function () {

this.leave._x = Stage.width /2;

this.leave._y = Stage.height /2;

}

Stage.addListener(lor);