Robotlegs Modular , loading from SWF

thexeb's Avatar

thexeb

25 Sep, 2012 02:23 PM

hi,
i am trying different things with robotlegs modules. I am using pure AS3.0 and FlashDevelop, no Flex at all;

I successfully loaded robotlegs Module from an SWF , when the Module View was the document class of its SWF .
for example , SimpleModuleView.as , i set it as Document Class to compile an SWF from it.
then my ShellView.as can load it successfully,
I used following in the parentInjector of Module
context = new SimpleModuleContext(this, value,this.loaderInfo.applicationDomain);

now i have following issue,
I want multiple modules in a single SWF file , so i compile with a empty sprite which has only reference to my Modules. ( repo.swf)
In Main Shell Application , i am using greensock SWFLoader , to load my repository rep.swf file.
then i am using following to add the module to the main shell view

modSimple = swfRepo.getClass("SimpleModule.SimpleModuleView");

addChild(new modSimple());

then Error occurs ,
ReferenceError: Error # 1065: Variable SimpleModuleView is not defined.

at flash.system::ApplicationDomain/getDefinition()

the parentInject is being set successfully and SwiftSuspendersInjector is passed to the loaded module , but i believe due to application domain , its not working , any idea whats wrong here?

  1. Support Staff 1 Posted by Ondina D.F. on 25 Sep, 2012 02:57 PM

    Ondina D.F.'s Avatar

    Hi thexeb,

    Have you tried ApplicationDomain.currentDomain ?

    = Creates a new application domain:

    var appDomainA:ApplicationDomain=new ApplicationDomain(); //separate domains, no conflict

    = Gets the current application domain in which your code is executing:

    var appDomainB:ApplicationDomain=ApplicationDomain.currentDomain; //good

    = var appDomainC:ApplicationDomain=new ApplicationDomain(ApplicationDomain.currentDomain); //bad

    = This security sandbox of the caller is not allowed to access this ApplicationDomain:

    swfLoader.loaderContext=new LoaderContext(false, swfLoader.loaderInfo.applicationDomain);//bad

    => swfLoader.loaderContext=new LoaderContext(false, appDomainB);//good

    hth
    Ondina

  2. 2 Posted by thexeb on 25 Sep, 2012 04:10 PM

    thexeb's Avatar

    thanks Ondina , this worked perfectly ,
    i was using this.loaderInfo.applicationDomain for Single SWF Module,
    then for a repository swf , i used NULL ( for local ) ,
    but passing ApplicationDomain.currentDomain to context creation solves the problem ,
    thanks again

  3. 3 Posted by thexeb on 25 Sep, 2012 04:13 PM

    thexeb's Avatar

    i m testing locally , i am afraid i will be facing this kind of issues when i will upload it to my website , any hint for that ? how will this applicationDOmain affect the loading of module then?

  4. Support Staff 4 Posted by Ondina D.F. on 26 Sep, 2012 08:18 AM

    Ondina D.F.'s Avatar

    You’re welcome:)

    i m testing locally , i am afraid i will be facing this kind of issues when i will upload it to my website , any hint for that ? how will this applicationDOmain affect the loading of module then?

    Not sure what kind of issues are you expecting to have.

    More info about

    ApplicationDomain:
    http://livedocs.adobe.com/flex/3/html/18_Client_System_Environment_...

    Loading remote assets

    http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c...

    Ondina

  5. 5 Posted by thexeb on 26 Sep, 2012 12:34 PM

    thexeb's Avatar

    thanks ondina , i waz talking about an online app and loading remote assets , i will have to post another problem when i face :P
    i m grateful to you for helping me out thanks

  6. Support Staff 6 Posted by Ondina D.F. on 26 Sep, 2012 12:42 PM

    Ondina D.F.'s Avatar

    My pleasure :)
    I’ll mark this discussion as „resovled“.

  7. Ondina D.F. closed this discussion on 26 Sep, 2012 12:42 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac