Skip to main content
Inspiring
December 18, 2008
Question

Externally-loaded animation bounds or width and height

  • December 18, 2008
  • 5 replies
  • 555 views
Hi All,

I have swf of a dinosaur walking from left to right across a stage that is at least 500 pixels wide. If I load it into another movie and try to access the width using the attached code:


The _width property appears to only display the width of the movie at that moment - that is from the left part of the stage to the right-most part of the dinosaur - at the moment the trace runs. getBounds does the same thing.

If I keep checking these parameters, as the animation runs, they change to reflect the right most position of the dinosaur.

My question is, how can I, immediately upon loading the external .swf, find the original stage size that that .swf (the eventual bounds of the animation if I let run to completion)?

TIA

Steve

This topic has been closed for replies.

5 replies

kglad
Community Expert
Community Expert
December 18, 2008
i'm not sure it can be done in as3. there's a better chance it can be done but it would require some testing to see if you could access the stage from loader's content property. but it might be that you can only access the stage of the loading swf (if the loader is added to the display list).
kglad
Community Expert
Community Expert
December 18, 2008
can't be done in as2.
norrisoftAuthor
Inspiring
December 18, 2008
How can it be done in AS3?
norrisoftAuthor
Inspiring
December 18, 2008
I need to be able to tell swfObject what the height and width of existing swf files are so that it can load them. For those swfs that I create, I have that information. For those others may create, I do not.
norrisoftAuthor
Inspiring
December 18, 2008
Clarification: If you check the _width property, it doesn't update as the animation plays but the getBounds().xMax does. You can test this yourself by placing a button with the following in the onRelease:

trace(_root.container.getBounds().xMax);
Ned Murphy
Legend
December 18, 2008
You can try to fool it if you want by putting something alph-ed to zero across the entire stage width of the swf. That should result in a constant full width value.
norrisoftAuthor
Inspiring
December 18, 2008
Thanks for your reply. Unfortunately, I am trying to load .swfs created by others. I don't have the original .fla files.