R:N:M

Robots, ninjas and monkeys: three out of four of my favorite things.

Flash CS3 ‘stage.stageHeight’ Bug

| 4 Comments

If you’ve developed for Flash for any amount of time, you’ll have noticed Flash has some annoying bugs. Last night, I learned of a new one. It took a while to narrow down with the amount of code I was working through and, as usual, I assumed it was something I was doing wrong.

In ActionsScript 3.0, to get the height of the stage you’d use ‘stage.stageHeight.’ In my case, I was working with a 600 x 400 Flash file with movieclips that needed to be vertically centered. After publishing, the vertically centered elements were not centered properly. This led me to re-examine my code and math quite heavily. Nothing appeared to be in error. Tracing out ‘stage.stageHeight’ reported back a height of 300. This was obviously wrong since my project was 400 pixels tall. Resizing the stage to 300 made my trace report back a height of 200. I reset my stage to 400 tall and thought about the problem. So everything was off vertically by 100 pixels. Odd.

On a whim I did a test movie.  I then, ever-so-slightly, resized the preview window and hit the ‘test movie’ hot key again. A had adjusted the window only a few pixels. Instead of reporting back, say, 303 pixels it was now reporting 403 pixels. Ah-hah! Now I had an idea what was wrong: Flash was being a pain in the butt. Continuing my whim, I turned off the bandwidth profiler I often leave open and recompiled . . . 400! Stupid Flash! The bandwidth profiler seems to have an issue eating up vertical pixels.  Bad Flash.  Very, very bad.

Share and Enjoy:
  • Print
  • email
  • Facebook
  • LinkedIn

4 Comments

  1. Thanks so much, I’ve been banging my head for hours wondering what I was doing wrong!

  2. I suspect you just saved me many hours of pain. Thanks heaps!

  3. I just bumped into this as well, the fact that this bug is still around is hilarious, I don’t have CS4 here yet, can anyone confirm whether or not it exists in there too?

    I also suspect you saved me a whole bucketload of trouble … Many, many thanks for confirming that it is indeed a flash bug.

  4. AMAZING. I am having the exact same problem (on CS4; not sure if CS5 has somehow magically fixed this – but I’m guessing not since this seems to be an AS problem).

    Thanks for this.

    BAD FLASH indeed!

Leave a Reply

Required fields are marked *.

*