7 Replies Latest reply on Apr 20, 2010 8:51 AM by Darrell Loverin

    ModuleLoader combined with spark components possible?

    lbuenger

      Hi everybody!

       

      I tried to setup a new app, where a main mxml organizes data transfer between two modules. The modules consist of several input components and I thought it might be just the right time to get finally used to the new spark thing et all. A runtime error occured when I tried to typecast the moduleloader's child property. The problem seemed due to a certain button skin and some missing width and height properties. By searching the internet I've found several possible reasons for this like app domain issues or app holder issues and stuff. However, I just got over it by avoiding spark components.

       

      I set up a small example, which reproduces the error.

       

      ModuleTest.mxml:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                        xmlns:s="library://ns.adobe.com/flex/spark" 
                        xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
           <fx:Script>
                <![CDATA[
                     import mx.events.ModuleEvent;
                     
                     
                     private function ma_ready(a_event: ModuleEvent): void {
                          trace (ma.child);
                     }
                     
                     private function mb_ready(a_event: ModuleEvent): void {
                          trace (mb.child as ModuleB);
                     }
                ]]>
           </fx:Script>
           <s:HGroup>
                <mx:ModuleLoader id="ma" url="ModuleA.swf" ready="ma_ready(event)"/>
                <mx:ModuleLoader id="mb" url="ModuleB.swf" ready="mb_ready(event)"/>
           </s:HGroup>
      </s:Application>
      

       

       

      ModuleA.mxml:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" width="400" height="300">
           <s:Button label="A" />
      </mx:Module>
      

       

       

      ModuleB.mxml:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" width="400" height="300">
           <s:Button label="B" />
      </mx:Module>
      

       

       

      Stack:

       

      ArgumentError: Error #2004: One of the parameters is invalid.
           at flash.display::Graphics/drawRoundRect()
           at spark.primitives::Rect/draw()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\primitives\Rect.as:459]
           at spark.primitives.supportClasses::StrokedElement/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\primitives\supportClasses\StrokedElement.as:143]
           at spark.primitives.supportClasses::GraphicElement/http://www.adobe.com/2006/flex/mx/internal::doUpdateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\primitives\supportClasses\GraphicElement.as:3828]
           at spark.primitives.supportClasses::GraphicElement/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\primitives\supportClasses\GraphicElement.as:3812]
           at spark.components::Group/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:956]
           at spark.skins::SparkSkin/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\skins\SparkSkin.as:191]
           at mx.skins.spark::SparkSkinForHalo/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\sparkskins\src\mx\skins\spark\SparkSkinForHalo.as:118]
           at mx.skins.spark::ButtonSkin/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\sparkskins\src\mx\skins\spark\ButtonSkin.mxml:66]
           at mx.core::UIComponent/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8531]
           at mx.managers::LayoutManager/validateClient()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:932]
           at mx.core::UIComponent/validateNow()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7631]
           at mx.controls::Button/http://www.adobe.com/2006/flex/mx/internal::viewSkinForPhase()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\controls\Button.as:1963]
           at mx.controls::Button/http://www.adobe.com/2006/flex/mx/internal::viewSkin()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\controls\Button.as:1869]
           at mx.controls::Button/commitProperties()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\controls\Button.as:1615]
           at mx.core::UIComponent/validateProperties()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7772]
           at mx.managers::LayoutManager/validateProperties()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:572]
           at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:700]
           at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]
      

       

       

      I'm working with FB 4 Premium on win7 64x, compiling with standard sdk 4.0.0

       

      Does anybody know something about this?

       

      Many thanks!

      Lukas