Michael,
 No, you have that backwards, but it's a similar problem -- the
_global.Application class _isn't_ overwritten. The flash player
operates a class cache -- it always stores (and uses) the first class
of a particular classpath/name that it encounters.

 So in your case, when swfA loads, Flash caches a class called
com.UserInterface.Application, and uses _that same class_ when swfB
loads, ignoring swfB's implementation. Every attempt on your part
beyond that point to refer to Application() will refer to swfA's
version.

 You can get around this (as a hack) by calling delete
_global.__Packages.com.UserInterface.Application; before loading swfB.
Then swfB will use its own version of Application. But then swfA will
have problems - it's not a brilliant solution in your case.

What you really need is to separate the classpaths out in the way that
you suggest. That'll certainly fix it.

Cheers,
 Ian

On 6/22/07, Michael Trim <[EMAIL PROTECTED]> wrote:
Hi Flashcoders,

Can somebody confirm my worst suspicions (think I am answering my own
question here)

swfA loads swfB

Both swfs are compiled from separate classpaths but share a similar
class structure, so

swfA compiles classes like

swfAProject/com/UserInterface/Application.as
swfAProject/com/UserInterface/UIButton.as

and swfB compiles

swfBProject/com/UserInterface/Application.as
swfBProject/com/UserInterface/UIButton.as

I'm presuming that when swfB is loaded the _global.Application class is
overwritten? As when I do this the whole thing spins off into 100% CPU
hell.

To separate these out will I need to restructure them to be...?

CommonProject/com/A/UserInterface/Application.as
CommonProject/com/B/UserInterface/Application.as

(intergrating the code is not an option at this point).

What would people suggest as best practice here? Apologies if this is a
bit of a newb question on OO.

Many thanks,

Michael
_______________________________________________
[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

_______________________________________________
[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