5 Replies Latest reply on Jan 23, 2014 1:08 AM by drippydru

    Import interactive external swf w ref to "stage" into an fla timeline and avoid error 1009

    drippydru

      Hi, I am a student. Next year we get to have an actual class with mainly Adobe applications. But my teacher now is the teacher for that and he is giving us a little early start for fun and extra credit for the rest of the year.

       

      I think my favorite one of all is Flash and have learned much in a month but not enough cause I keep getting an error when I try to bring in a audio spectrum swf that moves to music to the timeline and always get this error.

       

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

      at AuroraMembrane()

       

      I looked it up and it says that the most common reason is because the original fla is using a reference to something and the new fla doesnt have the reference and tried to follow a tutorial but it was different and I got confused.

       

      Maybe do I type import.AuroraMembrane but it didnt work and tried to make it a var but probably it doesn't know what it is cause it is coming from somewhere else?

       

      Then I tried to do with another swf that is different type and takes mouse clicks to create blobs on screen and  then got this error

       

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

          at Fluid/initialize()

          at Fluid()

       

       

      When i try with regular animation swf it is okay. I got the external files from Wonderfl where my teacher said was a good place to learn but they don't talk much about it just post files. Is there a video tutorial that would cover either or both of these things? I would rather not just be told answer but see how to get there for later and since I dont get to have the class until next year I might not know how to always make something and I will maybe have to practice sometimes with other swf files where I can't make them and the ones that need to reference something that references something is confusing and I dont just want extra credit but want to get very good at Flash. Thank you.

       

       

      Here is my code for the second one ...The first one with audio I tried with using UILoader component but same thing happens

       

       

      import flash.net.URLRequest;

      import flash.display.Loader;

       

         

      var swfRequest:URLRequest = new URLRequest("file/liquid.swf");

      var swfLoader:Loader = new Loader();

          swfLoader.load(swfRequest);

       

       

            addChild(swfLoader);

        • 1. Re: Import interactive external swf w ref to "stage" into an fla timeline and avoid error 1009
          Ned Murphy Adobe Community Professional & MVP

          The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....

           

          - is declared but not instantiated

          - doesn't have an instance name (or the instance name is mispelled)

          - does not exist in the frame where that code is trying to talk to it

          - is animated into place but is not assigned instance names in every keyframe for it

          - is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).

           

          If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

           

          Pay close attention to the 1009 error message because it can help you pinpoint the problem.  Normally an error message can be a little confusing because it will present an entire chain of processing that leads up to where the error occurs.  Luckily, in these cases the location of the actual error is found in the first line or so

          1 person found this helpful
          • 2. Re: Import interactive external swf w ref to "stage" into an fla timeline and avoid error 1009
            drippydru Level 1

            Hi. I did that too. It says frame 1 in the action layer. And I can't look at the instance because it is from a swf that I did not create

             

             

            Attempting to launch and connect to Player using URL C:\test2\ExSwfLoader.swf

            [SWF] C:\test2\ExSwfLoader.swf - 269179 bytes after decompression

            [SWF] C:\test2\file\liquid.swf - 14469 bytes after decompression

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

                at Fluid/initialize()

                at Fluid()

            Cannot display source code at this location.

             

             

            liquid.swf is what I got from Wonderfl and what I am trying to load into my timeline. And the error that I get when debugging is off is

             

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

                at Fluid/initialize()

                at Fluid()

             

            So that means that it is the external swf that is giving me the error but it runs fine on its own and I don't know what this means or how I am supposed to reference something that is tucked away in the code of the swf file. Am I supposed to create a var referencing "Fluid"? I don't know how that works because how do I associate it with something that I cannot ---ugh, I am confused more and more about this.. Sorry if it is obvious and I am missing something.

             

             

            Thank you

            • 3. Re: Import interactive external swf w ref to "stage" into an fla timeline and avoid error 1009
              drippydru Level 1

              Okay, so I think that this might be the answer?

               

                      public function Fluid() {

                          initialize();

                      }

               

              But when running it with this code I get the error that it must be run in a package. Do I have to make it a package now?..Okay, I tried this

               

              package {

                 

              import flash.net.URLRequest;

              import flash.display.Loader;

               

                      public function Fluid() {

                          initialize();

                      }

               

               

               

              var swfRequest:URLRequest = new URLRequest("file/liquid.swf");

              var swfLoader:Loader = new Loader();

                  swfLoader.load(swfRequest);

               

               

                    addChild(swfLoader);

                   

              }

               

              and got error that packages cannot be nested. Am I just making it worse by doing this?

              • 4. Re: Import interactive external swf w ref to "stage" into an fla timeline and avoid error 1009
                Ned Murphy Adobe Community Professional & MVP

                In the title of your posting you quote the word "stage".  If your loaded file happens to be targeting the stage when it first loads then it might have a hard tiome doing that since it can take a little longer for it to settle in than it can wait to execute that reference.  If it does not have a stage reference it will fail.  THis is something that has to be resolved in the loaded file, which you say you have no way of editing

                1 person found this helpful
                • 5. Re: Import interactive external swf w ref to "stage" into an fla timeline and avoid error 1009
                  drippydru Level 1

                  Hi, no, I was aftaid that I shouldn't have used "stage". I only put that because when I first looked up the error and how to solve it, the first tutorial that came up on google had that in the title and I thought it was a different meaning description than the actual stage.

                   

                  So, I think that I have made progress by adding the include parameter for the as file but now I have another issue.

                   

                  Here is the code and the result, now. (I am trying with a different file but it initially had the same errors as the file above)

                   

                  import flash.net.URLRequest;
                  import flash.display.Loader;
                  include "file/city.as";

                  var Xpos:Number = 110;
                  var Ypos:Number = 180;


                  var swfRequest:URLRequest = new URLRequest("file/city.swf");
                  var swfLoader:Loader = new Loader();
                      swfLoader.load(swfRequest);
                  loader.x = Xpos;
                  loader.y = Ypos;


                        addChild(swfLoader);

                   

                   

                  The boldened text enabled me to get past the initial error but now the error is

                   

                  C:\demo2\file\city.as, Line 8 1037: Packages cannot be nested.

                   

                  When I click on the error it just takes me to the line directly after "package" is listed in the original as3 file. Before I get deeper into it, am I on the right path or just causing other errors while not getting closer to my goal? Thank you.

                   

                   

                   

                  EDIT------------ so I think that Flash is creating a doc class and adding city.as to it and it is coming out as a nested package, is that right? And it is because the code is on the timeline,right? Okay, so then how do I create a document class with the code above and still have it ---

                   

                  -Edit 2

                   

                  Okay, so I used the city.as file as the document class for new new fla and when attempting to render out I get the new error

                   

                  C:\demo2\city.as, Line 1 5008: The name of definition 'therockcityMAX' does not reflect the location of this file. Please change the definition's name inside this file, or rename the file. C:\demo2\city.as

                   

                   

                  package
                  {
                      import flash.display.*;
                      import flash.filters.*;
                      import flash.events.*;
                      import flash.net.*;
                      import flash.utils.*;
                      import flash.geom.*;
                      import flash.text.*;
                      import flash.system.*;
                      import flash.ui.*;
                      import flash.media.*;
                      import net.hires.debug.Stats;
                      import frocessing.color.ColorHSV;
                      import com.bit101.components.PushButton;
                      import com.bit101.components.InputText;
                     
                      [SWF(width=465,height=465,backgroundColor=0x000000,frameRate=30)]
                      public class therockcityMAX extends Sprite
                      {
                          private var SECTOR:int = 10;
                          private var LEVEL:int = 3;
                          private var LEVEL_HEIGHT:int = 20;
                          private var RADIUSX:int = 30;
                          private var RADIUSZ:int = 15;

                          private var edgeA:Array = new Array();
                          private var edgeB:Array = new Array();
                     

                   

                  -------------okay, so I just changed the name in the code from therockcityMAx to city and it got rid of the last error but gave me A DOZEN new ones. What is going on, I am going backwards big time. I am going  to attach the as3 file and the swf. All I want to play the swf in my timeline, however that can happen. I can't attach a swf it looks like so I just zipped them and uploaded them to my google account. I left them with the original names, not the changed one to "city".


                  I dont think that we will learn how to compile the source code until next year when in actual class so I am just left with the swf files. I am able to load the .as files into Flash though and study the code so that is a good thing but I can't see how each line works step by step when viewing only the swf file. But it is better than nothing.

                   

                  https://sites.google.com/site/splintercentral/therockcityMAX.zip

                   

                  I have been trying to figure this out for so many hours but I think maybe I was approaching different parts from wrong angle or something and that is why I now have 8 errors instead of just one. :/. i changed back to original name for this too .

                   

                  The errors are

                  C:\demo2\therockcityMAX.as, Line 127 1046: Type was not found or was not a compile-time constant: ColorHSV.

                  C:\demo2\therockcityMAX.as, Line 127 1180: Call to a possibly undefined method ColorHSV.

                  C:\demo2\therockcityMAX.as, Line 127 1180: Call to a possibly undefined method ColorHSV.

                  C:\demo2\therockcityMAX.as, Line 134 1046: Type was not found or was not a compile-time constant: InputText.

                  C:\demo2\therockcityMAX.as, Line 135 1046: Type was not found or was not a compile-time constant: PushButton.

                  C:\demo2\therockcityMAX.as, Line 142 1180: Call to a possibly undefined method Stats.

                  C:\demo2\therockcityMAX.as, Line 185 1180: Call to a possibly undefined method InputText.

                  C:\demo2\therockcityMAX.as, Line 186 1180: Call to a possibly undefined method PushButton.

                  C:\demo2\therockcityMAX.as, Line 19 1172: Definition net.hires.debug:Stats could not be found.

                  C:\demo2\therockcityMAX.as, Line 20 1172: Definition frocessing.color:ColorHSV could not be found.

                  C:\demo2\therockcityMAX.as, Line 21 1172: Definition com.bit101.components:PushButton could not be found.

                  C:\demo2\therockcityMAX.as, Line 22 1172: Definition com.bit101.components:InputText could not be found.

                   

                  Thank you!!!