[prev in list] [next in list] [prev in thread] [next in thread] 

List:       osflash-swfmill
Subject:    [swfmill] sprite introspection
From:       g99k () hotmail ! com (Gerrit  ! )
Date:       2007-03-08 20:48:31
Message-ID: BAY118-F39838D8A2EDC18CCD665E1C3790 () phx ! gbl
[Download RAW message or body]

Hi everyone. I am looking for a minimal sprite "introspection", to determine 
the symbol name of statically placed movieclips.

I'd like to use this to load a symbol from the library onto the stage, 
quickly run through its child movieclips and load them onto other movieclips 
on the stage, effectively spreading the original structure to multiple 
levels. I would then immediately delete the original, before it's shown in 
the next frame.



The symbol name info is already available at design time, so I'd like to 
somehow make it automatically accessible to ActionScript with swfmill. 
However, most variable definitions don't work until the first frame of the 
clip is played.

Which is the best way to store the symbol name so it can be read 
immediately? It should work like this:

parentMc = originalLevel.attachMovie( "ParentSymbol", ... );
for( m : MovieClip in parentMc )
	otherLevels[i++].attachMovie( m.symbolName, ... );
parentMc.removeMovieClip();



So far, I've only come across the "__proto__" variable:

#initclip
__proto__.symbolName = "someName";
#endinitclip

In swfml it would look like this:

      <DoInitAction sprite="1">
        <actions>
          <PushData>
            <items>
              <StackString value="__proto__"/>
            </items>
          </PushData>
          <GetVariable/>
          <PushData>
            <items>
              <StackString value="symbolName"/>
              <StackString value="someName"/>
            </items>
          </PushData>
          <SetMember/>
          <EndAction/>
        </actions>
      </DoInitAction>



At least, this seems to work. Is there a better way? Did I miss some 
introspection feature?

I could probably also register the sprite with a class, but that would 
create a multitude of identical and otherwise pointless classes. And since 
ActionScript afaik doesn't provide class introspection either, I'd still 
have to add the sprite/class name as a variable.

Any input on this would be appreciated.
Cheers, Gerrit

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic