Skip to main content
Participating Frequently
October 13, 2008
Question

AS3: Getting loaderURL from Singleton

  • October 13, 2008
  • 1 reply
  • 535 views
Hi,

Running into a bit of problem with ActionScript 3 at the mo. Maybe someone here can help me out.

Does anyone know in actionscript 3 how to get the current flash movie url (the old _root._url, now loaderInfo.loaderURL) from the context of a singleton class?

I know this can normally be accessed from the stage property of any DisplayObject in the display list but the problem is:

* My singleton is not a DisplayObject
* I cannot use a temporary DisplayObject (like a Sprite) within the singleton because a DisplayObject's "stage" or "loaderInfo" property is only instantiated when the DisplayObject is added to the display list. Before that it's always null. And since my singleton is not in the display list I can never make that temporary object part of it.

So... does anyone know how I can retrieve in such a case the url of the current movie (the old _root._url) ?

Cheers
Ben
This topic has been closed for replies.

1 reply

Craig Grummitt
Inspiring
October 13, 2008
in the init function for your application you could pass the url to your singleton.
Participating Frequently
October 13, 2008
quote:

Originally posted by: Craig Grummitt
in the init function for your application you could pass the url to your singleton.


Hi Craig,

Thanks for trying to help me out, much appreciated.

Because this is to become part of a library and it doesn't require access to the main display list, I was hoping to be completely detached from the application's main class or any other such dependency..

Is there any other way around it ?

Maybe it's just not possible, i'm not sure...

Thanks
Ben
Participating Frequently
October 14, 2008
Anyone?