?
Solved

Flash 8 AS2 - Stage.width returns 0 in ie8

Posted on 2010-01-12
4
Medium Priority
?
757 Views
Last Modified: 2013-11-11
For a while i was completly stumped trying to figure out why I couldn't use Stage.width to horizontally center my dynamically loaded .swf on the stage.  I had a function that would center the .swf if the browser was resized, and that worked, but when the file was opened for the first time in the browser, the centering was way off.  And it's because Stage.width is returning a 0.

Is there a work around for that?   How can i determine a full screen width of a div?

Thanks for your help!!!  Hope this makes sense.

This is the line i'm running to center the movieclip, it's at the beginning of my actionscript:
mc_movie._x = (Stage.width/2) - (mc_movie._width/2);
0
Comment
Question by:slightlyoff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 19

Expert Comment

by:moagrius
ID: 26298201
Stage.width should not be undefined.

if you put this one line of code in a new FLA:

this.createTextField(0,0,0,0,200,20).text = Stage.width;

and run File > Publish Preview > HTML, it should show appropriately.
0
 
LVL 1

Author Comment

by:slightlyoff
ID: 26303907
Thanks for your response.  I will try it when i get back to the house tonight.  The problem with Stage.width returning 0 only happens when i view the page in a browser.  If i test it in Flash, it works like a champ.

Thanks again!
0
 
LVL 19

Accepted Solution

by:
moagrius earned 2000 total points
ID: 26305885
File > Publish Preview > HTML will open the page in a browser
0
 
LVL 1

Author Closing Comment

by:slightlyoff
ID: 31676107
Perfect, thanks :)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question