David, Thanks.

Yeah I'm reading Essential Actionscript (Moock) right now, and he does
somewhat reduce confusion. Part of the problem is that older methods
that have sort of been practically deprecated by AS 2 are still given
out by others (#initclip and registerObject() ) are confusing as they
appear completely reduntant to extending MovieClip).

The load order still confuses me. More precisely than my first post, I
am wanting in general to be able to develop applications where ALL
actionscript is in external .as files (which I generally edit in
better editors than the Flash IDE, and then the FLA file simply
#include's some main code, or creates a single instance of class Main,
and calls Main.main(). The FLA file is then used solely for media
assets.

If I do this, how can I be sure, for instance, that class Main is
actually initialized before any other classes and can then control the
initialization order from Main? I suppose I could simply avoid static
initializers, but I don't like running away from a supported language
feature simply because I'm unclear about its runtime behavior.


I believe classes load on whatever frame they are set to export to
(under Actionscript 2 in Publish Settings). The default is frame 1
but you can set a different frame.

Hmm so I could change the export frames for classes to explicitly
order their loading, but this forces a multple frame main movie ( a
minor annoyance). Still, does a static property get initialized when
the class loads? E.g:

class MySingleton {
  static private var instance = new MySingleton();
  private function MySingleton() { // whatever init code
  }

  public function getSingleton() { return instance; }
}

I am wondering exactly when does the instance come into existence. For
that matter, with the default loading of classes at frame 1, are
classes then loaded only after all exported library assets are loaded?
Like if the singleton class above attached a movie in its constructor,
which is called when the class is loaded...?

In general, 'this' refers to the object of current scope. When used
in a class, it refers to the class; when used on a frame in the Flash
editor, it refers to the current timeline; when used in a callback,
it refers to the object that owns the callback.

This has been my understanding, but it seems I've run into a few
situations where the behavior is different, and one case where "this"
turned out to be undefined! Unfortunately I cannot remember the case,
but it still bothers me. When would this == undefined? I believe it
was within a class method that was given as a callback from code
running on the main timeline, and I had assumed this would refer to my
class, or at least to the main timeline.

One way to tackle the depth management problem is to have each class
have its own base movieclip, and attach its sub-clips to that base
clip.

This does seem the way to go, when the attached stuff is generating
multiple attached clips. Would be nice if AS had some way to
*actually* attach to to the next depth. Could easily write a function
to do this I suppose, by checking subsequent depths for the presence
of a clip... Just seems like not having to specify any depth would be
good, where you could assume that all subsequently added clips stack
above previous ones.

While thinking about it, what is the rationale for attachMovie() both
returning a movie clip instance and taking a name for a variable as a
string? I always end up storing the return variable (if I need it
later), and sending something like "foo" as the variable string. It
seems clunky to be giving a variable name as a string. Are there any
differences in the object assigned to the passed variable name and the
returned object? It's confusing.

Thanks for the other book recommendations. I'm always mystified how
authors like Moock get the information they include in their books,
that does not seem to exist in Flash's documentation...
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to