That's a real shame. I had hoped it was possible, but had actually worked
around it in my own situation because I hadn't found anything (though I
thought I was just being lazy).

I guess there's not iterator-version of getDefinitionByName, huh? Any
thoughts I why you can't iterate through a loaded SWF? Would make dynamic
library stuff alot simpler.

I ran into the need to be able and generate asset libraries (SWFs, PNGs,
MP3s, various classes) on the command-line as part of a toolchain. I
accomplish this by using PHP to scan directories and automatically generates
AS3 classes (in source code form) that embed all of these things. I write
about it on my blog (http://troygilbert.com/), but in brief:

I use embeds to get all of the assets into the root class. I then create
dummy references to all of the additional classes I want included. I then
have my root class, which has to extend Sprite, implement an IAssetLibrary
interface that I created. This interface fills the missing introspection
API: it provides methods for getting a list of all of the assets in the
class (which the PHP code just hardcodes into arrays) and provides some
friendly accessors (getAsset("myasset.png"), etc.).

Works like a charm. It does feel slightly redundant though because I know
that internally, at least, the Flash Player does all of this routinely.

Troy.



On 9/14/07, Alex Harui <[EMAIL PROTECTED]> wrote:
>
>  There is no Actionscript API for introspecting the contents of a loaded
> SWF.  The swf bytes are "interpreted" on load and stuck in other structures
> like ApplicationDomain which are not inspectable.
>
>
>
> A desperate person would load the swf as a bytearray, decompile it, then
> loadbytes it.
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
> Behalf Of *helihobby
> *Sent:* Thursday, September 13, 2007 9:34 PM
> *To:* [email protected]
> *Subject:* [flexcoders] Re: Is it possible to query a Flash SWF for its
> images / symbol list ?
>
>
>
> Thanks for that ...
>
> That I can do ...
>
> But I was hoping someone can shed light on how to get a list of all
> available Symbols from a loaded SWF.
>
> I know it is possible since that's what all these SWF Decompilers do.
> But how do you do it in actionscript ?
>
> Will see, maybe someone knows.
>
> Regards,
>
> Sean.
>
> --- In [email protected] <flexcoders%40yahoogroups.com>, shaun
> <[EMAIL PROTECTED]> wrote:
> >
> > I just saw this on the MXNA flex feed, not sure if it helps in your
> > situation or not.
> >
> > http://wildwinter.blogspot.com/2007/09/how-to-load-external-assets-
> from-as3.html
> >
> > helihobby wrote:
> > > Anyone ???
> > >
> > > :(
> > >
> > >
> > > --- In [email protected] <flexcoders%40yahoogroups.com>,
> "helihobby" <helihobby@> wrote:
> > >
> > >>Hello all,
> > >>
> > >>I have a SWF that has some Symbols / images !!! ( Created using
> Flash
> > >>Editor CS3 )
> > >>
> > >>How can I retrieve the Symbols list it holds using ActionScript
> from
> > >>the loaded Flash swf ? ( I Used SWFLoader to load it ... )
> > >>
> > >>Regards,
> > >>
> > >>Sean.
> > >>
> > >>Click below to view my ALON Design Pattern:
> > >>
> > >>http://www.helihobby.com/html/alon_desingpattern.html
> > >>
> > >
> > >
> > >
> > >
> >
>
> 
>

Reply via email to