4 Replies Latest reply on Dec 12, 2006 5:57 AM by peterent

    Loading multiple Application on dynamically with different SWF files in browser

    deepakgsd
      I developed an application consisting of a starting swf file with only one button. Upon submission of httprequest to an asp.net page i am getting the response by which i will create an xml file and transform this xml file with proper xsl style sheet to get an mxml file. After getting mxml file i compile it to generate an swf file. Till this it works fine. After creating the swf file which has an application tag in its mxml i try to load in using Loader and with the help of addChild() method. The generated swf file has a combo box and couple of text inputs and radio button. If i try to click on the combo box i get the error
      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.managers::PopUpManager$/addPopUp()
      at mx.controls::ComboBox/::getDropdown()
      at mx.controls::ComboBox/::displayDropdown()
      .................... some more error stack trace
      Entering some text inside the text input and selection of the radio buttons works fine.
      Issue is only with the combobox.
      Anything i am missing here?
      Waiting for the reply and thanks in advance
      Deepak

        • 1. Re: Loading multiple Application on dynamically with different SWF files in browser
          peterent Level 2
          It is possible that the PopUpManager was not compiled into the SWF (or some class that it uses). Only classes that are used are added to the SWF to keep the size of the SWF at a minimum.

          When you build your main application and secondary applications, compile them with the -link-report=report.xml switch to regenerate a linkage report. You can examine that to see if PopUpManager has been included.

          As a side note, you can use that linkage report from the main application to build a smaller swf for your on-the-fly MXML applications by compiling them with the linkage report:

          -load-externs=report.xml

          This will make the SWF smaller by NOT including any components that are already in the main application. However, you won't be able to run these other apps independently any more.

          When Flex 2.0.1 comes out (no date yet that I know of) take a look at <mx:Module> which would be a much better fit for your situtation. You would have very little retro-fitting to do, but it would provide better support for applications like yours.
          • 2. Re: Loading multiple Application on dynamically with different SWF files in browser
            deepakgsd Level 1
            Thanks for the reply. I compiled with the -load-externs option and i am able to get the list of stuff loaded and here is the snippet of my report where PopupManager been included...
            <dep id="mx.events:CollectionEvent" />
            <dep id="mx.events:ListEvent" />
            <dep id="mx.managers:PopUpManager" />
            <dep id="flash.events:KeyboardEvent" />
            <dep id="Number" />
            <dep id="Error" />
            <dep id="mx.events:ScrollEvent" />
            <dep id="mx.controls.dataGridClasses:DataGridListData" />
            <dep id="flash.text:TextLineMetrics" />
            </script>
            <script name="D:\flex_sdk_2\frameworks\libs\rpc.swc(mx/messaging/MessageResponder)" mod="1150096864181" size="2788">
            <def id="mx.messaging:MessageResponder" />
            <pre id="flash.net:Responder" />
            ... some more lines...

            And by this i can view that PopupManager been included. But still the problem exists.
            And one more thing i want to know is how can i speed up the compilation process as i am creating swf files in client-server mode where after getting response xml i am creating mxml then swf and putting it in the server domain folder and sending the link of the generated file path as response to client.
            Anysupport to speed-up this process as generation of mxml and compilation takes a long time...
            • 3. Re: Loading multiple Application on dynamically with different SWF files in browser
              deepakgsd Level 1
              And one more thing i want to know is if i use -load-extern=report.xml option and if i see that popupmanager is not been included in compilation then how can i include that.
              • 4. Re: Loading multiple Application on dynamically with different SWF files in browser
                peterent Level 2
                Are you using SWFLoader?

                var swf:SWFLoader = new SWFLoader();
                swf.load( urlhere );
                swf.width = #;
                swf.height = #;
                addChild(swf)?

                As far as compliation speed it works as fast as it can. There aren't any switches to improve its performance. Do the Flex apps you are generating follow a pattern - are the similar in some respect or are they very different? If they are similar you could have an application with much of the UI in place and then use the XML to dynamically create the elements in the Flex app itself. I'm not sure which would be faster given your circumstances.