I am creating three projects as following:-
        1. MainApp: Main project that give output executable swf, i.e main 
application.
        2. MyFramework: A flex library project, which will contain all the 
interface declarations.
        3. CustomModule: A flex project, which will generate one/more module/s, 
which will be loaded in the mainApp.

The Settings for the projects is as following:-
MainApp:
        Flex Build Path: Library Path: Framework linkage is RSL,
                Flex SDK is added with following settings:-
                Playerglobal: LinkType=external
                flex: LinkType=rsl, Verification = None, 
DeploymentPath=flex/flex.swf, Automatically extract swf is enabled.
                framework: LinkType=rsl, Verification = None, 
DeploymentPath=flex/framework.swf, Automatically extract swf is enabled.
                rpc: LinkType=rsl, Verification = None, 
DeploymentPath=flex/rpc.swf, Automatically extract swf is enabled.
                utilities: LinkType=rsl, Verification = None, 
DeploymentPath=flex/utilities.swf, Automatically extract swf is enabled.
                MyFramework: LinkType=rsl, Verification = none, 
DeploymentPath=rsls/MyFramework.swf, Automatically extract swf is enabled.
        Compiler arguments:
                -load-config+=Appconfig.xml
                -link-report=MainAppLnkReport.xml
MyFramework:
        Flex Build path settings are similar to MainApp.
        Compiler arguments:
                -load-config+=MyFrameworkconfig.xml
CustomModule:
        Flex Build path settings are similar to MainApp.
        Compiler arguments:
                -load-config+=MyFrameworkconfig.xml
                -load-externs=path to MainAppLnkReport.xml generated above.


Code:
>From MainApp,
        CustomModule is load code is as following:-
                moduleInfo = ModuleManager.getModule("path to 
CustomModule.swf");
                
moduleInfo.addEventListener(ModuleEvent.READY,onModuleLoad,false,0,true);
                
moduleInfo.addEventListener(ModuleEvent.ERROR,onModuleError,false,0,true);
                moduleInfo.load(ApplicationDomain.currentDomain);

        onModuleLoad(event :ModuleEvent) :void
                var moduleInfo :IModuleInfo = event.module; 
                var module:* = moduleInfo.factory.create();
        

Using an interface defined in MyFramewok, and implemented by CustomModule, I 
call a function that create an instance of MenuBar.
The instance is created, but on calling
        addChild( menuBarObj as DisplayObject);

I get crash at mx.controls::MenuBar/updateBackground at
         var backgroundSkinClass:Class = getStyle("backgroundSkin");
         background = new backgroundSkinClass();
backgroundSkinClass is null.


Callstack after my addChild statement is 
        mx.controls::MenuBar/updateBackground   
        mx.controls::MenuBar/styleChanged       
        
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::addingChild    
        
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild      
        mx.core::Container/addChildAt   
        mx.core::Container/addChild     

 
I have already tried:
        1. Creating a variable of MenuBar in MainApp, this resolves the crash, 
but not an accepted solutions, as MainApp cannot be complied again on creating 
another module.
        2. Extend CustomModule from Module class.
        3. Similar issue is with checkbox, where application does not crash, 
but draws like a button.
                Checkbox issue gets resolved if CustomModule extends Module.
                or theme is added to Appconfig.xml
                <theme append="true">
                        <filename>${flexlib}/libs/framework.swc</filename>
                </theme>
        4. Different settings for Flex sdk in Library Path. i.e MergeIntoCode, 
External.
Already tried 
http://www.mail-archive.com/flexcoders@yahoogroups.com/msg84466.html


Thanks in advance,
Rajkumar Sehrawat

Reply via email to