We help IT Professionals succeed at work.

Flash CS3 currentFrame

Ok,
I have a main timeline and several labaled frames like
home,about,products, services,contac
Also have a menubar with buttons labeled the same
home,about,products, services,contac
Now how do I get the name of the label that I'm currently at to applay a filter
for example
menubar_mc.currentFrame.name.filters = [navBtnGlow,navBtnGlow2];
I get the following error when using the above sintax
1119: Access of possibly undefined property name through a reference with static type int.
Comment
Watch Question

Commented:
I don't know what you are trying to do...

menubar_mc.currentFrame should render the frame number as in 1, 2 and so on...  In that sense, menubar_mc.currentFrame.name does not make sense at all since .name is the property of a movieClip not a number...
Also, .filters is a property of a movieClip as well, so the only logical one I can think of from your example would be this... (I am totally not sure if that's what you are trying to do or not though...)
   menubar_mc.filters  = [navBtnGlow, navBtnGlow2];

CyanBlue

Author

Commented:
I just want to know how to get the name of the frame or the "label" of the  frame that I'm currently at.
with action script 3...is this posible....??

Don't get too trouble with what I'm trying to do.....!!

Commented:
The currentLabel should render you the frame name of the current frame...
   http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/MovieClip.html#currentLabel

CyanBlue

Author

Commented:
What about : currentLabel
menubar_mc.currentLabel.filters = [navBtnGlow,navBtnGlow2];
get the same error...?

Author

Commented:
When I use: trace(this.currentLabel);
I do get exactly what I want.
Now if I have  a MoveiClip named " menubar_mc" and insede I have another MovieClip named "home"
menubar_mc.home.filters = [navBtnGlow,navBtnGlow2];
How do I refer to it using currenLabel property
I've already tried this, but get an error
menubar_mc.(this.currentLabel).filters = [navBtnGlow,navBtnGlow2];

Commented:
this.currentLabel is string not a movieClip, and string cannot have a filter if you know what I mean...

So, what do you get when you do this: trace(this.currentLabel);

What is the actual path to the movieClip that you'd like to apply the filters???

CyanBlue

Author

Commented:
When using trace(this.currentLabel);
I get, home,about,products,services,contact and this is what I though I needed.

My MovieClip is menubar_mc.home
And i works just fine when I do
menubar_mc.home.filters = [navBtnGlow,navBtnGlow2];

Now it is posible to put the value of the trace, instead of the name of the MovieClip ...?


Commented:
Then try this...
   menubar_mc[this.currentLabel].filters = [navBtnGlow,navBtnGlow2];

CyanBlue

Author

Commented:
That's exactly the syntax I needed.
So when refering to a MovieClip with a variable it goes between brakets....correct....?

Commented:
Not all the time...

If you do movieClip1.movieClip2.name, you get the correct movieClip2's name because 'movieClip2' is type MovieClip in this case...  But your case has 'movieClip2' as string which requires brackets like movieClip["movieClipNameInString"].name for that...

CyanBlue

Author

Commented:
OK