If your browser-embedded flash movie is not scrolled into view when it initializes, you can run into some weird, browser-dependent problems.
Here's what I've found:
Firefox
The Flash movie does not even start until at least some of it is scrolled into view. This is basically OK. The browser seems to use a just-in-time approach. This probably improves the initial page-display time.
To see what I'm talking about, popup a trace window. Scroll the page down slowly while looking at the trace window. You'll see that each flash movie starts only when the movie comes into view (assuming you're using Firefox). The trace statement "Movie Start" is the very first line of code in the first frame of the movie.
Resulting problem
If the user prints the page (using the browser's print button) without having scrolled the flash movies into view, they will not print. If there are more than one flash movie on the page, only those that have been scrolled into view will print. Click here with Firefox to see what I mean.
BTW, there's another print problem: the printed movies are not obeying the "noscale" setting.
Possible Solutions:
- Don't put separate flash movies below the fold.
- Use a tall flash movie that reaches the top of the browser. Some of it can be transparent so the desired layout can be achieved.
- Do some sort of JavaScript hack using window.scrollTo() in the window.onload event to force a scroll to the bottom of the page then back up. Probably very ugly.
- Don't worry about it. Printing via the browser print button doesn't work well anyway.
IE
This is trickier. The not-yet-visible flash movies do start, but the Stage size can be wrong. Scenario:
- Flash movie document size: 500x500.
- Html object/embed size: 200x200 (noscale).
- When the page is loaded, the flash movie starts running and the Stage size is reported as 500x500.
- An instant later, a Stage.onResize event fires, now the Stage size is reported as 0x0.
- Scroll the movie into view. As it appears, the Stage.onResize fires again, and now the stage size is 200x200.
Sometimes, instead the 0x0 onResize won't happen and the first onResize will be report 200x200 even if the swf is not yet visible. I can't figure out why it does not behave consistently. If you assume that delaying one frame is all you need to do, you might be wrong.
To see it in action, view this page in IE, popup a trace window and slowly scroll down this page. The lowest flash movies might be displayed incorrectly due to the sequence listed above.
Resulting problem
My code was using the stage size to layout some of graphical components at initialization time. I was not expecting to even listen to the onResize event. As a result, those movies that were below the fold have the wrong layout when scrolled into view.
Solution:
- First, wait at least one frame before initializing. This gives the onResize a chance to set the Stage size to 0x0 if running in IE.
- Then, if the stage size is 0x0, wait for a Stage.onResize to fire and, again, check if the size is greater than 0x0. If so, start your app for real.










