Can I loop through the current application domain?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Can I loop through the current application domain?

justin_mills
Ok I have a loader that loads swf's into the same applicationdomain, I
can then create any linkage movie by it's string name, now if I want to
also load in some image then I can add them to the array and they load
in fine.  Now I do store the contents of the loaded but I don't have
access to it elsewhere, I wanted to loop through the application domain
to grab any images they seem to be stored as Bitmap instances, not
classes eg

trace( Type.typeof( _loaders[i].content ) );
TClass([class Bitmap])

creating an error I can get a clue to how flash is storing it....

trace( Type.getInstanceFields( _loader[i].content ) );
error....    flash.display::Bitmap@4ef0fb1

but I am not sure how I would go about finding all of these?  And how I
might create them...

var bitmap: Bitmap = cast( Type.createInstance( Type.resolveClass(
"flash.display::Bitmap@4ef0fb1" ) ) , [] ) ) );

Obviously I could rewire so that I can get to _loadlibraries.contents[i]
but would be good to know how I can find what bitmaps are in the
applicationdomain and create instances of them.

Any ideas

Cheers

;j

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Can I loop through the current application domain?

justin_mills
I can get a lot of info on the loaded bitmap...
         var ty: XML = untyped __global__['flash.utils.describeType'](
_loaders[i].content );
         trace( ty );

<type name="flash.display::Bitmap" base="flash.display::DisplayObject"
isDynamic="false" isFinal="false" isStatic="false">
...

But the name is the same for each bitmap..., I tried renaming them as
they come in.
_loaders[i].content.name = _locations[i].split('/').pop().split('.')[0];

but I don't seem to be allowed to.



Le 14/01/2011 10:28, justin_mills a écrit :

> Ok I have a loader that loads swf's into the same applicationdomain, I
> can then create any linkage movie by it's string name, now if I want
> to also load in some image then I can add them to the array and they
> load in fine.  Now I do store the contents of the loaded but I don't
> have access to it elsewhere, I wanted to loop through the application
> domain to grab any images they seem to be stored as Bitmap instances,
> not classes eg
>
> trace( Type.typeof( _loaders[i].content ) );
> TClass([class Bitmap])
>
> creating an error I can get a clue to how flash is storing it....
>
> trace( Type.getInstanceFields( _loader[i].content ) );
> error....    flash.display::Bitmap@4ef0fb1
>
> but I am not sure how I would go about finding all of these?  And how
> I might create them...
>
> var bitmap: Bitmap = cast( Type.createInstance( Type.resolveClass(
> "flash.display::Bitmap@4ef0fb1" ) ) , [] ) ) );
>
> Obviously I could rewire so that I can get to
> _loadlibraries.contents[i] but would be good to know how I can find
> what bitmaps are in the applicationdomain and create instances of them.
>
> Any ideas
>
> Cheers
>
> ;j
>


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Can I loop through the current application domain?

justin_mills
I found this approach...

http://flassari.is/2008/07/swf-class-explorer-for-as3/

parsing the bytedata seems rather heavy, and I would probably need to
look into hxformat or something as I'm using haxe, maybe I will just put
the bitmaps onto a static array so I can get them later.

Le 14/01/2011 11:09, justin_mills a écrit :

> I can get a lot of info on the loaded bitmap...
>         var ty: XML = untyped __global__['flash.utils.describeType'](
> _loaders[i].content );
>         trace( ty );
>
> <type name="flash.display::Bitmap" base="flash.display::DisplayObject"
> isDynamic="false" isFinal="false" isStatic="false">
> ...
>
> But the name is the same for each bitmap..., I tried renaming them as
> they come in.
> _loaders[i].content.name = _locations[i].split('/').pop().split('.')[0];
>
> but I don't seem to be allowed to.
>
>
>
> Le 14/01/2011 10:28, justin_mills a écrit :
>> Ok I have a loader that loads swf's into the same applicationdomain,
>> I can then create any linkage movie by it's string name, now if I
>> want to also load in some image then I can add them to the array and
>> they load in fine.  Now I do store the contents of the loaded but I
>> don't have access to it elsewhere, I wanted to loop through the
>> application domain to grab any images they seem to be stored as
>> Bitmap instances, not classes eg
>>
>> trace( Type.typeof( _loaders[i].content ) );
>> TClass([class Bitmap])
>>
>> creating an error I can get a clue to how flash is storing it....
>>
>> trace( Type.getInstanceFields( _loader[i].content ) );
>> error....    flash.display::Bitmap@4ef0fb1
>>
>> but I am not sure how I would go about finding all of these?  And how
>> I might create them...
>>
>> var bitmap: Bitmap = cast( Type.createInstance( Type.resolveClass(
>> "flash.display::Bitmap@4ef0fb1" ) ) , [] ) ) );
>>
>> Obviously I could rewire so that I can get to
>> _loadlibraries.contents[i] but would be good to know how I can find
>> what bitmaps are in the applicationdomain and create instances of them.
>>
>> Any ideas
>>
>> Cheers
>>
>> ;j
>>
>
>


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Can I loop through the current application domain?

justin_mills
It did not seem simple to use Type.typeof for the comparaison so at the
moment I have gone with..

     private function storeLoadedBitmap( i: Int )
     {

         if ( untyped __global__['flash.utils.getQualifiedClassName'](
_loaders[i].content ).split(":").pop() == "Bitmap" )
         {
             SymbolsData.Bitmaps.set(
_locations[i].split('/').pop().split('.')[0], _loaders[ i ].content );
         }

     }


Le 14/01/2011 11:47, justin_mills a écrit :

> I found this approach...
>
> http://flassari.is/2008/07/swf-class-explorer-for-as3/
>
> parsing the bytedata seems rather heavy, and I would probably need to
> look into hxformat or something as I'm using haxe, maybe I will just
> put the bitmaps onto a static array so I can get them later.
>
> Le 14/01/2011 11:09, justin_mills a écrit :
>> I can get a lot of info on the loaded bitmap...
>>         var ty: XML = untyped __global__['flash.utils.describeType'](
>> _loaders[i].content );
>>         trace( ty );
>>
>> <type name="flash.display::Bitmap"
>> base="flash.display::DisplayObject" isDynamic="false" isFinal="false"
>> isStatic="false">
>> ...
>>
>> But the name is the same for each bitmap..., I tried renaming them as
>> they come in.
>> _loaders[i].content.name = _locations[i].split('/').pop().split('.')[0];
>>
>> but I don't seem to be allowed to.
>>
>>
>>
>> Le 14/01/2011 10:28, justin_mills a écrit :
>>> Ok I have a loader that loads swf's into the same applicationdomain,
>>> I can then create any linkage movie by it's string name, now if I
>>> want to also load in some image then I can add them to the array and
>>> they load in fine.  Now I do store the contents of the loaded but I
>>> don't have access to it elsewhere, I wanted to loop through the
>>> application domain to grab any images they seem to be stored as
>>> Bitmap instances, not classes eg
>>>
>>> trace( Type.typeof( _loaders[i].content ) );
>>> TClass([class Bitmap])
>>>
>>> creating an error I can get a clue to how flash is storing it....
>>>
>>> trace( Type.getInstanceFields( _loader[i].content ) );
>>> error....    flash.display::Bitmap@4ef0fb1
>>>
>>> but I am not sure how I would go about finding all of these?  And
>>> how I might create them...
>>>
>>> var bitmap: Bitmap = cast( Type.createInstance( Type.resolveClass(
>>> "flash.display::Bitmap@4ef0fb1" ) ) , [] ) ) );
>>>
>>> Obviously I could rewire so that I can get to
>>> _loadlibraries.contents[i] but would be good to know how I can find
>>> what bitmaps are in the applicationdomain and create instances of them.
>>>
>>> Any ideas
>>>
>>> Cheers
>>>
>>> ;j
>>>
>>
>>
>
>


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Can I loop through the current application domain?

Cauê W.
why don't you use macros? I'm pretty sure there's a way to create an array with all definitions from within a macro

2011/1/14 justin_mills <[hidden email]>
It did not seem simple to use Type.typeof for the comparaison so at the moment I have gone with..

   private function storeLoadedBitmap( i: Int )
   {

       if ( untyped __global__['flash.utils.getQualifiedClassName']( _loaders[i].content ).split(":").pop() == "Bitmap" )
       {
           SymbolsData.Bitmaps.set( _locations[i].split('/').pop().split('.')[0], _loaders[ i ].content );
       }

   }


Le 14/01/2011 11:47, justin_mills a écrit :

I found this approach...

http://flassari.is/2008/07/swf-class-explorer-for-as3/

parsing the bytedata seems rather heavy, and I would probably need to look into hxformat or something as I'm using haxe, maybe I will just put the bitmaps onto a static array so I can get them later.

Le 14/01/2011 11:09, justin_mills a écrit :
I can get a lot of info on the loaded bitmap...
       var ty: XML = untyped __global__['flash.utils.describeType']( _loaders[i].content );
       trace( ty );

<type name="flash.display::Bitmap" base="flash.display::DisplayObject" isDynamic="false" isFinal="false" isStatic="false">
...

But the name is the same for each bitmap..., I tried renaming them as they come in.
_loaders[i].content.name = _locations[i].split('/').pop().split('.')[0];

but I don't seem to be allowed to.



Le 14/01/2011 10:28, justin_mills a écrit :
Ok I have a loader that loads swf's into the same applicationdomain, I can then create any linkage movie by it's string name, now if I want to also load in some image then I can add them to the array and they load in fine.  Now I do store the contents of the loaded but I don't have access to it elsewhere, I wanted to loop through the application domain to grab any images they seem to be stored as Bitmap instances, not classes eg

trace( Type.typeof( _loaders[i].content ) );
TClass([class Bitmap])

creating an error I can get a clue to how flash is storing it....

trace( Type.getInstanceFields( _loader[i].content ) );
error....    flash.display::Bitmap@4ef0fb1

but I am not sure how I would go about finding all of these?  And how I might create them...

var bitmap: Bitmap = cast( Type.createInstance( Type.resolveClass( "flash.display::Bitmap@4ef0fb1" ) ) , [] ) ) );

Obviously I could rewire so that I can get to _loadlibraries.contents[i] but would be good to know how I can find what bitmaps are in the applicationdomain and create instances of them.

Any ideas

Cheers

;j







--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Can I loop through the current application domain?

Simon Krajewski
In reply to this post by justin_mills
  It seems to be easy using the format lib though:

         var loader = new URLLoader(new URLRequest("path/to.swf"));
         loader.dataFormat = flash.net.URLLoaderDataFormat.BINARY;

         loader.addEventListener(Event.COMPLETE, function(e) {
             var reader = new format.swf.Reader(new
BytesInput(Bytes.ofData(loader.data)));
             var swf = reader.read();
             for (tag in swf.tags) {
                 switch(tag)  {
                     case TSymbolClass(symbols):
                         for (symbol in symbols)
                             trace("Found " +symbol.className);
                     default:
                 }
             }
         });


Thanks for asking about it, I actually have a use for this.
Simon

Am 14.01.2011 11:47, schrieb justin_mills:

> I found this approach...
>
> http://flassari.is/2008/07/swf-class-explorer-for-as3/
>
> parsing the bytedata seems rather heavy, and I would probably need to
> look into hxformat or something as I'm using haxe, maybe I will just
> put the bitmaps onto a static array so I can get them later.
>
> Le 14/01/2011 11:09, justin_mills a écrit :
>> I can get a lot of info on the loaded bitmap...
>>         var ty: XML = untyped __global__['flash.utils.describeType'](
>> _loaders[i].content );
>>         trace( ty );
>>
>> <type name="flash.display::Bitmap"
>> base="flash.display::DisplayObject" isDynamic="false" isFinal="false"
>> isStatic="false">
>> ...
>>
>> But the name is the same for each bitmap..., I tried renaming them as
>> they come in.
>> _loaders[i].content.name = _locations[i].split('/').pop().split('.')[0];
>>
>> but I don't seem to be allowed to.
>>
>>
>>
>> Le 14/01/2011 10:28, justin_mills a écrit :
>>> Ok I have a loader that loads swf's into the same applicationdomain,
>>> I can then create any linkage movie by it's string name, now if I
>>> want to also load in some image then I can add them to the array and
>>> they load in fine.  Now I do store the contents of the loaded but I
>>> don't have access to it elsewhere, I wanted to loop through the
>>> application domain to grab any images they seem to be stored as
>>> Bitmap instances, not classes eg
>>>
>>> trace( Type.typeof( _loaders[i].content ) );
>>> TClass([class Bitmap])
>>>
>>> creating an error I can get a clue to how flash is storing it....
>>>
>>> trace( Type.getInstanceFields( _loader[i].content ) );
>>> error....    flash.display::Bitmap@4ef0fb1
>>>
>>> but I am not sure how I would go about finding all of these?  And
>>> how I might create them...
>>>
>>> var bitmap: Bitmap = cast( Type.createInstance( Type.resolveClass(
>>> "flash.display::Bitmap@4ef0fb1" ) ) , [] ) ) );
>>>
>>> Obviously I could rewire so that I can get to
>>> _loadlibraries.contents[i] but would be good to know how I can find
>>> what bitmaps are in the applicationdomain and create instances of them.
>>>
>>> Any ideas
>>>
>>> Cheers
>>>
>>> ;j
>>>
>>
>>
>
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Can I loop through the current application domain?

justin_mills
Thanks Simon that's really useful :)

Le 14/01/2011 14:08, Simon Krajewski a écrit :

>  It seems to be easy using the format lib though:
>
>         var loader = new URLLoader(new URLRequest("path/to.swf"));
>         loader.dataFormat = flash.net.URLLoaderDataFormat.BINARY;
>
>         loader.addEventListener(Event.COMPLETE, function(e) {
>             var reader = new format.swf.Reader(new
> BytesInput(Bytes.ofData(loader.data)));
>             var swf = reader.read();
>             for (tag in swf.tags) {
>                 switch(tag)  {
>                     case TSymbolClass(symbols):
>                         for (symbol in symbols)
>                             trace("Found " +symbol.className);
>                     default:
>                 }
>             }
>         });
>
>
> Thanks for asking about it, I actually have a use for this.
> Simon
>
> Am 14.01.2011 11:47, schrieb justin_mills:
>> I found this approach...
>>
>> http://flassari.is/2008/07/swf-class-explorer-for-as3/
>>
>> parsing the bytedata seems rather heavy, and I would probably need to
>> look into hxformat or something as I'm using haxe, maybe I will just
>> put the bitmaps onto a static array so I can get them later.
>>
>> Le 14/01/2011 11:09, justin_mills a écrit :
>>> I can get a lot of info on the loaded bitmap...
>>>         var ty: XML = untyped
>>> __global__['flash.utils.describeType']( _loaders[i].content );
>>>         trace( ty );
>>>
>>> <type name="flash.display::Bitmap"
>>> base="flash.display::DisplayObject" isDynamic="false"
>>> isFinal="false" isStatic="false">
>>> ...
>>>
>>> But the name is the same for each bitmap..., I tried renaming them
>>> as they come in.
>>> _loaders[i].content.name =
>>> _locations[i].split('/').pop().split('.')[0];
>>>
>>> but I don't seem to be allowed to.
>>>
>>>
>>>
>>> Le 14/01/2011 10:28, justin_mills a écrit :
>>>> Ok I have a loader that loads swf's into the same
>>>> applicationdomain, I can then create any linkage movie by it's
>>>> string name, now if I want to also load in some image then I can
>>>> add them to the array and they load in fine.  Now I do store the
>>>> contents of the loaded but I don't have access to it elsewhere, I
>>>> wanted to loop through the application domain to grab any images
>>>> they seem to be stored as Bitmap instances, not classes eg
>>>>
>>>> trace( Type.typeof( _loaders[i].content ) );
>>>> TClass([class Bitmap])
>>>>
>>>> creating an error I can get a clue to how flash is storing it....
>>>>
>>>> trace( Type.getInstanceFields( _loader[i].content ) );
>>>> error....    flash.display::Bitmap@4ef0fb1
>>>>
>>>> but I am not sure how I would go about finding all of these?  And
>>>> how I might create them...
>>>>
>>>> var bitmap: Bitmap = cast( Type.createInstance( Type.resolveClass(
>>>> "flash.display::Bitmap@4ef0fb1" ) ) , [] ) ) );
>>>>
>>>> Obviously I could rewire so that I can get to
>>>> _loadlibraries.contents[i] but would be good to know how I can find
>>>> what bitmaps are in the applicationdomain and create instances of
>>>> them.
>>>>
>>>> Any ideas
>>>>
>>>> Cheers
>>>>
>>>> ;j
>>>>
>>>
>>>
>>
>>
>


--
haXe - an open source web programming language
http://haxe.org