4 Replies Latest reply on Jul 3, 2010 1:25 PM by Ramrec

    Loading purchased swf into Flash Builder 4 Flex app


      I have purchased a Flash "fundraising thermometer" from an online Flash components site. It takes input from an xml file and displays a thermometer with the goal at the top and the current amount raised indicated. It came with the following files:



      thermometer01.html (A sample that works.)

      xml/thermometer.xml (The source file: goal amount, current amount, mark interval, etc.)

      caurina/transitions (Mostly .as files.)


      Since the test html (thermometer01.html) works fine, I thought this would be a no-brainer.


      I first unzipped the files into a "thermometer" folder in my current project. I then went into Flash Builder and created a SWFLoader object as follows:




      id="myLoader" source="../thermometer/thermometer.swf" complete="initThermometer();" autoLoad="true" scaleContent="false"/>\



      private function initThermometer():void {


           Alert.show('Thermometer loaded');




      The Design view looks fine. I can see the thermometer default image (see below).




      When I run the app, I get no errors, just a broken image link in a box (see below). The alert box also never shows up.



      I'm new to Flex, so I may be doing something stupid that keeps this from working. I contacted the author of the thermometer widget but he doesn't know anything about Flex.


      Any help figuring out how to get this to work in a flex app would be appreciated.

        • 1. Re: Loading purchased swf into Flash Builder 4 Flex app
          ozDiGennaro Level 1

          You should probably add more event handlers to see what's going on.  Especially "ioError". The complete list is below.  For coverage, add a handler for each event. You can also use in MXML




          and add an argument to your Actionscript method, to find out details about the event.


          private function initThermometer(event:Event):void {


               Alert.show('Thermometer loaded ' + event.type);



              complete="No default"
              httpStatus="No default"
              init="No default"
              ioError="No default"
              open="No default"
              progress="No default"
              securityError="No default"
              unload="No default



          General info here:



          I did not test my code suggestions, but it's probably close.

          1 person found this helpful
          • 2. Re: Loading purchased swf into Flash Builder 4 Flex app
            Ramrec Level 1

            Thanks, your suggestion was spot on and helped me get a lot further.


            From your suggestion, I  was able to determine that it was throwing an ioError while looking for the control at http://localhost/thermometer/thermometer.swf. I copied the thermometer folder to my c:\wamp\www folder and it seems to find the control, but gets a different error now, specifically:


            [SWF] /thermometer/thermometer.swf - 25,762 bytes after decompression

            TypeError: Error #1009: Cannot access a property or method of a null object reference.

            at thermometer_fla::thermometer_1/frame1()


            I researched this and 1009 seems to be a catch-all kind of error. I turned on verbose-stacktraces in the config file, but didn't see any additional details.


            As I mentioned before, this control works fine from within an HTML page, so I'm pretty sure the control itself is not the problem.


            Any additional thoughts or approaches I should try?

            • 3. Null Object -reference error in imported SWF
              ozDiGennaro Level 1

              The null reference error is common.  It means that a piece of Actionscript code is using a null object to reference something.  That error is occuring in the code of the imported SWF.  So we don't have much information to go on.  I'd try putting the question that to your vendor.  I suspect a configuration issue here.


              Have you enabled monitoring of the Flash Player's trace file?  Look here:



              You have to use the debug version of the Flash Player (available on adobe.com) and you have to point to the trace file (and make sure that it exists).

              You may get lots more information that way.

              • 4. Re: Null Object -reference error in imported SWF
                Ramrec Level 1

                Thanks. Tried the trace, but only got the same error message. I've entered another question for the vendor, but haven't heard back yet.