Flash9 resources and preloader

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

Flash9 resources and preloader

Michael Pliskin

Hello all,

 

  Sorry if this has been asked already, tried googling the archives but failed so far. I am now trying the following scenario:

-          Flash9 preloader swf

-          Flash9 main swf

-          Main swf has resources

 

Everything is ok when I am using Flash8 preloader and flash9 main swf, but when trying to switch to f9 preloader resources from main swf are no longer accessible. After a bit of digging I found the problem: Std.resource() function was taken from the loader instead of the main app and was therefore referring to the wrong Boot. Making Std.resource() inline solved the problem, but any nice way to fix that? I am still on 1.19, not sure if 2.0 fixes it.

 

Mike


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

Re: Flash9 resources and preloader

Nicolas Cannasse
Michael Pliskin a écrit :

> Hello all,
>
>  
>
>   Sorry if this has been asked already, tried googling the archives but
> failed so far. I am now trying the following scenario:
>
> -          Flash9 preloader swf
>
> -          Flash9 main swf
>
> -          Main swf has resources
>
>  
>
> Everything is ok when I am using Flash8 preloader and flash9 main swf,
> but when trying to switch to f9 preloader resources from main swf are no
> longer accessible. After a bit of digging I found the problem:
> Std.resource() function was taken from the loader instead of the main
> app and was therefore referring to the wrong Boot. Making Std.resource()
> inline solved the problem, but any nice way to fix that? I am still on
> 1.19, not sure if 2.0 fixes it.

There are currently some issues with some of the common classes, since
loading a SWF overwrites them. The best is to load your SWF in a
different ApplicationDomain so your classes does not get overwritten.

Nicolas



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

FW: Flash9 resources and preloader

Michael Pliskin
In reply to this post by Michael Pliskin
The problem is the loaded swf does NOT overwrite them, making the loaded code use the classes from the loader (therefore causing Std.resource reference to the incorrect Boot). Loading the application into separate domain helped but it required me to stop using flash.Lib.eval and go to Type.resolveClass instead - don't really know why. Looks suspicious, so any ideas?

Mike

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Nicolas Cannasse
Sent: Monday, November 10, 2008 10:57 PM
To: The haXe compiler list
Subject: Re: [haXe] Flash9 resources and preloader

Michael Pliskin a écrit :

> Hello all,
>
>  
>
>   Sorry if this has been asked already, tried googling the archives but
> failed so far. I am now trying the following scenario:
>
> -          Flash9 preloader swf
>
> -          Flash9 main swf
>
> -          Main swf has resources
>
>  
>
> Everything is ok when I am using Flash8 preloader and flash9 main swf,
> but when trying to switch to f9 preloader resources from main swf are no
> longer accessible. After a bit of digging I found the problem:
> Std.resource() function was taken from the loader instead of the main
> app and was therefore referring to the wrong Boot. Making Std.resource()
> inline solved the problem, but any nice way to fix that? I am still on
> 1.19, not sure if 2.0 fixes it.
There are currently some issues with some of the common classes, since
loading a SWF overwrites them. The best is to load your SWF in a
different ApplicationDomain so your classes does not get overwritten.

Nicolas



--
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: Flash9 resources and preloader

Michael Pliskin
Actually the preloader problem seems to be solved: I needed to really create a new ApplicationDomain(null), not just leave the LoaderContext field as null. Which makes sense as null means a child appdomain, not a fresh new one as I need here.

Mike

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Pliskin
Sent: Tuesday, November 11, 2008 12:42 PM
To: The haXe compiler list
Subject: FW: [haXe] Flash9 resources and preloader

The problem is the loaded swf does NOT overwrite them, making the loaded code use the classes from the loader (therefore causing Std.resource reference to the incorrect Boot). Loading the application into separate domain helped but it required me to stop using flash.Lib.eval and go to Type.resolveClass instead - don't really know why. Looks suspicious, so any ideas?

Mike

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Nicolas Cannasse
Sent: Monday, November 10, 2008 10:57 PM
To: The haXe compiler list
Subject: Re: [haXe] Flash9 resources and preloader

Michael Pliskin a écrit :

> Hello all,
>
>  
>
>   Sorry if this has been asked already, tried googling the archives
> but failed so far. I am now trying the following scenario:
>
> -          Flash9 preloader swf
>
> -          Flash9 main swf
>
> -          Main swf has resources
>
>  
>
> Everything is ok when I am using Flash8 preloader and flash9 main swf,
> but when trying to switch to f9 preloader resources from main swf are
> no longer accessible. After a bit of digging I found the problem:
> Std.resource() function was taken from the loader instead of the main
> app and was therefore referring to the wrong Boot. Making
> Std.resource() inline solved the problem, but any nice way to fix
> that? I am still on 1.19, not sure if 2.0 fixes it.
There are currently some issues with some of the common classes, since loading a SWF overwrites them. The best is to load your SWF in a different ApplicationDomain so your classes does not get overwritten.

Nicolas



--
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: Flash9 resources and preloader

Nicolas Cannasse
Michael Pliskin a écrit :
> Actually the preloader problem seems to be solved: I needed to really create a new ApplicationDomain(null), not just leave the LoaderContext field as null. Which makes sense as null means a child appdomain, not a fresh new one as I need here.
>
> Mike

Yes, that's what I meant.

Sadly when you do this way, you can't "share" some specific classes from
your current domain. It's an all-or-nothing choice, not very flexible
compared to what we're used in Flash8 or Neko.

Best,
Nicolas

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