My movie is working, I just don't understand why exactly.
At gotoandlearn.com, Lee Brimelow makes the case of using a container .swf
to load content due to document classes and the classes it references to be
compiled into frame 1.
http://gotoandlearn.com/play?id=85

Cool, fair enough. But this basically means that your container has to work
as a content manager as well. That's not such a big deal since I was used to
making my as2 main movies handle both tasks.

The first issue that arose however is the #1056 errors I started getting
when content movies contained stage instances.
Depending on your "Automatically declare stage instances" setting, an .fla
will make stage children with instance names available to the document
class. But when this same .swf is loaded into a parent, you'll get the error
message "Cannot create property <instance name> on <document class>". I'll
get to the work around in a sec.

In Flash CS3, under File -> Publish Settings -> Flash -> ActionScript
Version -> Settings -> Stage, "Automatically declare stage instances" is
checked by default. This basically means you'll be able to reference those
instances through variables of the same name automatically. Unchecked,
you'll have to declare a *public* var of your instance name in the document
class.
For example:
//if you have a movie clip on the stage named "myClip" your document class
will look like
package{
  import flash.display.MovieClip;
  public class MyDocumentClass extends MovieClip{
    public var myClip:MovieClip; // must use the public keyword
    public function MyDocumentClass(){
    }
  }
}

The issue is, if you plan on loading your .swf's into a parent movie, you
must declare that variable regardless of your "Automatically declare stage
instances" setting. Colin Moock recommends the unchecked method. Just
remember, if checked and manually declared, you'll only be able to run the
movie when loaded into a parent. So my advice there is to always uncheck.

My question then, why exactly do you have to declare a stage instance in a
content movie as public manually? I know it has something to do with who's
display list it is on but I don't quite understand how that heirarchy forces
this issue.

Sorry so long winded.

-- 
--Joel
stranskydesign.com
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to