Copy link to clipboard
Copied
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;
}
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
what if its the maintimeline of the FLA?
Copy link to clipboard
Copied
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.
.