0 Replies Latest reply on Jul 6, 2011 2:19 AM by popovitch130

    [Flex 4.5.1] Loading Chart in a module fails

    popovitch130 Level 1

      Hello,

       

      I try to load a LineChart inside a module but it doesn't show anything ... I'm using Flex 4.5.1 with Flash builder.

       

      The module is loaded using this script :

      // ActionScript file moduleLoaderUtil
      import mx.modules.*;
      
      public function createModule(m:ModuleLoader, s:String):void {
           if (!m.url) {
                m.url = s;
                return;
           }
           m.loadModule();
      }
      
      public function removeModule(m:ModuleLoader):void {
           m.unloadModule();
      }
      

       

      The main application :

       

      <?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"
                        creationComplete="creationCompleteHandler()"
                        height="100%" width="100%"
                        skinClass="skins.CustomApplicationSkin">
           <s:layout>
                <s:BasicLayout />
           </s:layout>
           <fx:Declarations>
           </fx:Declarations>
           <fx:Script source="scripts/moduleLoaderUtil.as" />
           <fx:Script>
                <![CDATA[
                     import events.GotoEvent;
                     
                     private function creationCompleteHandler():void{
                          createModule(moduleLoader, 'modules/Statistics.swf');
                     }
                ]]>
           </fx:Script>
           <mx:VBox height="100%" width="100%"  horizontalAlign="center" verticalAlign="top"> 
                <mx:ModuleLoader id="moduleLoader" />
           </mx:VBox>
      </s:Application>
      
      

       

       

      and the module with an empty chart into a panel :

       

      <?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="100%" height="100%">
           <fx:Declarations>
           </fx:Declarations>
           <s:Panel title="Sélection des critères" chromeColor="#CCCCCC" width="960" height="600">
                <mx:LineChart x="164" y="59" id="linechart1">
                     <mx:series>
                          <mx:LineSeries displayName="Series 1" yField=""/>
                     </mx:series>
                </mx:LineChart>
                <mx:Legend dataProvider="{linechart1}"/>
           </s:Panel>
      </mx:Module>
      

       

      What can i do ?

       

      Best Regards