5 Replies Latest reply: Aug 30, 2012 9:28 PM by kglad RSS

    currentLabel Problem

    TheScarecrow Community Member

      I have written a package that I am importing with a public function that wants to use the currentLabel but I am getting a 1120 errror and I am not sure why. I am wanting to use it to get the label of the maintimeline in an FLA. Can anyone help or done this before? Thanks.

       

      CODE:

      //Get Frame Label

                          public function getcurrentFrameLabel():void

                          {

                                    trace("Getting Label Name");

                                    trace(currentlabelName);

                                    currentlabelName = (currentLabel);

                                    //Get Next Frame Label from labesArray

                                    nextLabel = labelsArray.indexOf(currentlabelName) + 1;

                          }

        • 1. Re: currentLabel Problem
          kglad CommunityMVP

          you should copy and paste the complete error message after enabling "permit debugging" and indicate the problematic line number.  also, you'll need to post enough of the relevant code to evaluate it. 

          • 2. Re: currentLabel Problem
            TheScarecrow Community Member

            package code

            {

                      import flash.display.MovieClip;

                      import flash.display.Sprite;

                      import flash.utils.*;

                      import flash.text.TextField;

                      import flash.events.MouseEvent;

                      import flash.display.DisplayObject;

                      import flash.display.FrameLabel;

                      import flash.display.SimpleButton

             

             

                      public class allActivities extends flash.display.Sprite

                      {

            //Current Label

                                public static var currentlabelName:String = "path";

            //Choose Game Path Practice or Assessment;

                                public function choosePath():void

                                {

                                          //Get Current Label

                                          getcurrentFrameLabel();

                                          //Game Path Button Listeners Frame 1

             

                                          Practice.addEventListener(MouseEvent.CLICK,mouseClickPractice);

                                          addEventListener(MouseEvent.CLICK,mouseClickAssessment);

                                          //Admin Button;

                                          addEventListener(MouseEvent.CLICK, mouseClickHandler);

                                          trace("Listners Set");

                                }

                                //Get Frame Label

                                public function getcurrentFrameLabel():void

                                {

                                          trace("Getting Label Name");

                                          trace(currentlabelName);

                                          currentlabelName = (currentLabel);

                                          //Get Next Frame Label from labesArray

                                          nextLabel = labelsArray.indexOf(currentlabelName) + 1;

                                }

            }

            }

             

            The line that throws the error is




            currentlabelName = (currentLabel);

             

            Error 1120 Access of undefined property currentLabel.

            • 3. Re: currentLabel Problem
              kglad CommunityMVP

              sprites don't have a timeline and therefore don't have currentLabel property.

               

              if you're trying to retrieve the currentLabel of some movieclip (which is reasonable), you need to pass a reference to that movieclip to getcurrentFrameLabel and then use the currentLabel property of that movieclip.

              • 4. Re: currentLabel Problem
                TheScarecrow Community Member

                what if its the maintimeline of the FLA?

                • 5. Re: currentLabel Problem
                  kglad CommunityMVP

                  if your allActivities instances has been added to the display list, you can use MovieClip(root) to reference the maintimeline and use MovieClip(root).currentLabel to reference the main timeline's currentLabel property.

                   

                  .