Skip to main content
Inspiring
April 17, 2006
Answered

triggering actions using frame labels

  • April 17, 2006
  • 6 replies
  • 639 views
Not sure how to do this one: I want to trigger an action when the playhead reaches a certain labeled frame. I can make it work using:
if (_currentframe == 10){
dothis;
}

but I anticipate moving things around in the timeline so I would rather have the action triggered when the playhead reaches a certain frame label. I tried using something like:
if (frameLabel == "myframenamehere") {
dothis;
}

but that doesn't work. Any help much appreciated!

Michael
This topic has been closed for replies.
Correct answer Newsgroup_User
Michael,

> Not sure how to do this one: I want to trigger an action
> when the playhead reaches a certain labeled frame.

The is a common request. Unfortunately, Flash simply doesn't support
this feature.

> I tried using something like:
> if (frameLabel == "myframenamehere") {
> dothis;
> }
>
> but that doesn't work.

I'm always curious how it happens that people just "try using"
something. I suppose there's no harm in that -- and sure, experimentation
may just teach a person something new -- but the practice seems odd to me as
as a general approach. Not saying this is *your* general approach, just
that I see this a lot in the forums.

Since you're dealing with movie clips, here, your best bet is to read up
on the "MovieClip class" entry of the ActionScript Language Reference.
Classes define objects, and just about everything in ActionScript is an
object. Movie clips are defined by the MovieClip class. Their
characteristics are listed under the Properties summary, things they can do
are listed under the Methods summary, and things they can react to are
listed under the Event summary.

There simply isn't a frameLabel property, or a _framelabel property, or
any other property to do with frames.


David
stiller (at) quip (dot) net
Dev essays: http://www.quip.net/blog/
"Luck is the residue of good design."


6 replies

Newsgroup_UserCorrect answer
Inspiring
April 17, 2006
Michael,

> Not sure how to do this one: I want to trigger an action
> when the playhead reaches a certain labeled frame.

The is a common request. Unfortunately, Flash simply doesn't support
this feature.

> I tried using something like:
> if (frameLabel == "myframenamehere") {
> dothis;
> }
>
> but that doesn't work.

I'm always curious how it happens that people just "try using"
something. I suppose there's no harm in that -- and sure, experimentation
may just teach a person something new -- but the practice seems odd to me as
as a general approach. Not saying this is *your* general approach, just
that I see this a lot in the forums.

Since you're dealing with movie clips, here, your best bet is to read up
on the "MovieClip class" entry of the ActionScript Language Reference.
Classes define objects, and just about everything in ActionScript is an
object. Movie clips are defined by the MovieClip class. Their
characteristics are listed under the Properties summary, things they can do
are listed under the Methods summary, and things they can react to are
listed under the Event summary.

There simply isn't a frameLabel property, or a _framelabel property, or
any other property to do with frames.


David
stiller (at) quip (dot) net
Dev essays: http://www.quip.net/blog/
"Luck is the residue of good design."


Inspiring
April 17, 2006
Thanks again David for your help. Even though I can't do things exactly has I want to, it's good to know that I can stop going down the wrong road in my attempts. I will take a look at the MovieClip class.

Michael
babo_ya
Inspiring
April 17, 2006
You could create a global variable and assign the frame label in different frames.
And use that global to see which frame you are at.