How to Position Movie Clips Based on Browser Resizing, WITH initial loading

Hello

I'm using a code to have a movieclip (capitulo) center on the right side of the browser window, no matter what size window. My problem is that the script requires the window to be resized, ca it be done on initial load?
thank you,
Cris
Stage.scaleMode = "noScale";
Stage.align = "TL";
var stageListener:Object = new Object();
stageListener.onResize = positionContent;
Stage.addListener(stageListener);
 
function positionContent():Void {
	imageholder._width = Stage.width;
	imageholder._yscale = imageholder._xscale;
	if (imageholder._height>Stage.height) {
		imageholder._height = Stage.height;
		imageholder._xscale = imageholder._yscale;
	}
	imageholder._x = Stage.width/2-imageholder._width/2;
	imageholder._y = Stage.height/2-imageholder._height/2;
	
	  capitulo._x = Stage.width - capitulo._width;
  capitulo._x = Stage.width - capitulo._width;
capitulo._y = Stage.height / 2 - capitulo._height / 2;
}

Open in new window

cristobal_nyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wal_toorCommented:
Hello chris,

When the browser resizes a function is called by the resize listener. To solve your problem just call the function when all items that need to resize or reposition are on the stage.

Hope this works for you.

greetz,
walter
// when all items that need rescaling/repositioning are on the stage call
positionContent();

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cristobal_nyAuthor Commented:
Thank you for your answer. It works perfect!
I placed it into the first frame. For the next time can you please specify how to integrate it into the code or project. Thank you again.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.