9 Replies Latest reply on Aug 10, 2016 7:15 AM by kglad

    Getting error 1010 on a movieclip even though it is defined in class

    sawmangs4

      I have a class (PatientView) that is associated with a MovieClip (PatientView). In the PatientView MovieClip there are other MovieClips which are given names inside the PatientView MovieClip. These MovieClips are also instantiated at the top of the PatientView class.

       

      Example:

      public var pvtopmc;

       

      When it is time to add the PatientView MovieClip to the stage, the error 1010 fires on the first line that attempts to set properties for one of the MovieClips inside the PatientView MovieClip. Since the first movieclip is pvtopmc, the error is thrown on that MovieClip. I run a trace: trace("pvtopmc is: "+pvtopmc); just before the first line to set a property on pvtopmc and it traces as undefined. This is perplexing because I have many classes identical to this one in this program and they all work fine. So I guess my eyes  are getting tired or something and I can't see what I'm screwing up.

       

      here is the code:

       

      package
      {
      import flash.display.*;
      import flash.events.*;

      public class PatientView extends MovieClip
      {
        public var PVScreen:Screen = Screen.mainScreen; // This represents the primary display not calculating task bar/Dock.
                     // Display Objects within the bounds of the mainScreen can be
                     // hidden under task bar/Dock. Use "visibleBounds" to place
                     // display objects without being hidden under task bar/dock.
        public var PVBrowser;
        public var headtype:String = "FullHeader";
        public var title = "https://assistant-cert.emdeon.com/Patient/PatientView?Id=e5835162-39fa-4160-9b0a-203cff9bc b52";
        public var pagetype:String = "fullpage";
        public var pvtopmc;
        public var pvtabs;
        public var pvfooter;

        public function PatientView()
        {
         if(stage)
         {
          initPatientView();
         }
         else
         {
          addEventListener(Event.ADDED_TO_STAGE, initPatientView);
         }
        } // ----------------------------------------------------------------------------------------- ---------- End public constructor function PatientView().
       
        public function initPatientView(e:Event = null):void
        {
         // --- Main
         this.width = PADemo.resizeAsset(1024,PVScreen.visibleBounds.width,1024)-16;
         this.scaleY = this.scaleX;
         trace("PVScreen is: "+PVScreen);
         trace("pvtopmc is: "+pvtopmc);
         // --- Patient View Top
         pvtopmc.width = PADemo.resizeAsset(1024,PVScreen.visibleBounds.width,1024)-16;
         pvtopmc.scaleY = pvtopmc.scaleX;
         //pvtopmc.y = wqback.y;
         pvtopmc.x = PVScreen.visibleBounds.width - pvtopmc.width - 16;
        
         // --- Patient View Tabs
         pvtabs.stop();
         pvtabs.width = PADemo.resizeAsset(1024,PVScreen.visibleBounds.width,1024)-16;
         pvtabs.scaleY = pvtabs.scaleX;
         pvtabs.y = pvtopmc.y + pvtopmc.height;
         pvtabs.x = PVScreen.visibleBounds.width - pvtabs.width - 16;
        
         // --- Patient View Footer
         pvfooter.width = PADemo.resizeAsset(1024,PVScreen.visibleBounds.width,1024)-16;
         pvfooter.scaleY = pvfooter.scaleX;
         pvfooter.y = pvtabs.y + pvtabs.height;
         pvfooter.x = PVScreen.visibleBounds.width - pvfooter.width - 16
        
         PVBrowser = MovieClip(parent.parent.parent.parent);
         if(PVBrowser)
         {
          PVBrowser.scrollArea.update();
         }
        } // ----------------------------------------------------------------------------------------- ------------------ End public function initPatientView().

      } // ========================================================================================= ============================= End public class PatientView{}.
      } // ========================================================================================= ================================================== End package{}.

       

      Thanks in advance for your help.

        • 1. Re: Getting error 1010 on a movieclip even though it is defined in class
          kglad Adobe Community Professional & MVP

          does that movieclip (pvtopmc instance name) exist in the first frame of PatientView?

           

          if not, you'll need to fix that.

          • 3. Re: Getting error 1010 on a movieclip even though it is defined in class
            kglad Adobe Community Professional & MVP

            on your movieclip's timeline where pvtopmc exists put:

             

            trace(1,pvtopmc,this.currentFrame);

             

            in your class file, just above the line triggering your 1010 error, put:

             

            trace(2,this,this.currentFrame);

             

            copy and past the trace and error output after testing.

            • 4. Re: Getting error 1010 on a movieclip even though it is defined in class
              sawmangs4 Level 1

              Okay ran the traces.

               

              the trace on the timeline did not trace.

               

              here is what did trace:

               

              2 [object PatientView] 0

              resizeAsset called!

              TypeError: Error #1010: A term is undefined and has no properties.

              at PatientView/initPatientView()[C:\PAV2\PatientView.as:39]

              at flash.display::DisplayObjectContainer/addChild()

              at ATCBrowser/insertSWFAssets()[C:\PAV2\ATCBrowser.as:213]

              at PatientTabs/clickedview1()[C:\PAV2\PatientTabs.as:49]

              • 5. Re: Getting error 1010 on a movieclip even though it is defined in class
                kglad Adobe Community Professional & MVP

                i don't know what you could be doing to have a movieclip register its current frame as 0 in an as3 project, but something is very wrong with that.

                • 6. Re: Getting error 1010 on a movieclip even though it is defined in class
                  sawmangs4 Level 1

                  Okay, any idea how to try to track that down? All the MovieClips in question only have one frame.

                  • 7. Re: Getting error 1010 on a movieclip even though it is defined in class
                    kglad Adobe Community Professional & MVP

                    after you create PatientView, check its currentFrame.

                    • 8. Re: Getting error 1010 on a movieclip even though it is defined in class
                      sawmangs4 Level 1

                      Okay, I put this trace in the PatientView constructor function:

                       

                      trace(1,this,this.currentFrame);

                       

                      and it traces this: 1 [object PatientView] 1

                       

                      I put this trace just before the line that breaks:

                       

                      trace(2,this,this.currentFrame)

                       

                      and it traces this:

                       

                      2 [object PatientView] 0

                       

                      Here is the full class code:

                       

                      package
                      {
                      import flash.display.*;
                      import flash.events.*;

                      public dynamic class PatientView extends MovieClip
                      {
                        public var PVScreen:Screen = Screen.mainScreen; // This represents the primary display not calculating task bar/Dock.
                                     // Display Objects within the bounds of the mainScreen can be
                                     // hidden under task bar/Dock. Use "visibleBounds" to place
                                     // display objects without being hidden under task bar/dock.
                        public var PVBrowser;
                        public var headtype:String = "FullHeader";
                        public var title = "https://assistant-cert.emdeon.com/Patient/PatientView?Id=e5835162-39fa-4160-9b0a-203cff9bc b52";
                        public var pagetype:String = "fullpage";
                        public var pvtopmc;
                        public var pvtabs;
                        public var pvfooter;

                        public function PatientView()
                        {
                         if(stage)
                         {
                          initPatientView();
                         }
                         else
                         {
                          addEventListener(Event.ADDED_TO_STAGE, initPatientView);
                         }
                         trace(1,this,this.currentFrame);
                        } // ----------------------------------------------------------------------------------------- ---------- End public constructor function PatientView().
                       
                        public function initPatientView(e:Event = null):void
                        {
                         trace("PatientView called!");
                         // --- Main
                         this.width = PADemo.resizeAsset(1024,PVScreen.visibleBounds.width,1024)-16;
                         this.scaleY = this.scaleX;
                         trace(2,this,this.currentFrame);
                         trace(22,pvtopmc);
                         // --- Patient View Top
                         pvtopmc.width = PADemo.resizeAsset(1024,PVScreen.visibleBounds.width,1024)-16;
                         pvtopmc.scaleY = pvtopmc.scaleX;
                         //pvtopmc.y = wqback.y;
                         pvtopmc.x = PVScreen.visibleBounds.width - pvtopmc.width - 16;
                        
                        
                         // --- Patient View Tabs
                         pvtabs.stop();
                         pvtabs.width = PADemo.resizeAsset(1024,PVScreen.visibleBounds.width,1024)-16;
                         pvtabs.scaleY = pvtabs.scaleX;
                         pvtabs.y = pvtopmc.y + pvtopmc.height;
                         pvtabs.x = PVScreen.visibleBounds.width - pvtabs.width - 16;
                        
                         // --- Patient View Footer
                         pvfooter.width = PADemo.resizeAsset(1024,PVScreen.visibleBounds.width,1024)-16;
                         pvfooter.scaleY = pvfooter.scaleX;
                         pvfooter.y = pvtabs.y + pvtabs.height;
                         pvfooter.x = PVScreen.visibleBounds.width - pvfooter.width - 16
                        
                         PVBrowser = MovieClip(parent.parent.parent.parent);
                         if(PVBrowser)
                         {
                          PVBrowser.scrollArea.update();
                         }
                        } // ----------------------------------------------------------------------------------------- ------------------ End public function initPatientView().

                      } // ========================================================================================= ============================= End public class PatientView{}.
                      } // ========================================================================================= ================================================== End package{}.

                      • 9. Re: Getting error 1010 on a movieclip even though it is defined in class
                        kglad Adobe Community Professional & MVP

                        create a new project that just contains your PatientView movieclip and its class.  instantiate an instance from the main timeline and add it to the main timeline.

                         

                        any problem?