all groups > flash actionscript > october 2006 >
You're in the

flash actionscript

group:

Getting the frame label



Getting the frame label rc3rdmd
10/18/2006 8:10:18 PM
flash actionscript: Is there a way to return the value of the frame labels?

I want to create a list of all the frame labels to use as a navigation tool.

Thanks.

Re: Getting the frame label kglad
10/18/2006 9:50:26 PM
Re: Getting the frame label NSurveyor
10/19/2006 1:58:48 AM
In AS3, it's extremely simple:

this.currentLabels is an array of FrameLabels with name and frame properties.

for(var i=0;i<this.currentLabels.length;i++){
var cL = this.currentLabels[i]
trace(cL.frame+': '+cL.name);
}
Re: Getting the frame label nivek311
10/19/2006 2:55:31 PM
Ok - so is there a way to randomly select a frame label along a timeline using
AS1 or AS2? I have 4 labels along approx 2500 frames that I need to randomly go
to on load. Just a random quote rotator. I'm currently using this:
labelselect = random(_currentframe)+1100;
_root.allquotes.gotoAndPlay(labelselect);

Thanks ...
Re: Getting the frame label kglad
10/19/2006 3:48:10 PM
again, no. you cannot use a.s.1.0 and you cannot use a.s. 2.0 to access frame
labels. a.s. 3.0 does allow frame label access as explained by ns.

but if you only have 4 frame labels, you can just hardcode those frame numbers
in an array, select a random array index and goto that frame number.
Re: Getting the frame label nivek311
10/19/2006 3:56:37 PM
Nevermind - was easier than I thought. This worked:
labelselect = "quote" + Math.floor(Math.random() * 5);
_root.allquotes.gotoAndPlay(labelselect);

Re: Getting the frame label kglad
10/19/2006 4:01:11 PM
AddThis Social Bookmark Button