PDA

View Full Version : Listen for the Frame Number and Display Current Frame.



SuperiorAssassi
November 17th, 2009, 10:55 AM
I have tried this a dozen different ways and I really am at my wits end.

I have a presentation that works like a powerpoint. Everything is working as it should, except one part. I have a movie clip with an instance named slides, and I want to actively display which frame number you are in this move clip.

I have tried more than one why but I see no reason why this should not work:

var frameNum:Number = this.slides.currentFrame;
this.frameText.text = "Páquina " + frameNum + " de 173";

It appears to work at first, but does not update when I navigate the slides. It constantly says 1. Before I just added a function to the back and next buttons to frameNum++ and frameNum--, but after I created the Menu I would prefer it to automatically detect what frame it is on.


Some quick help would be much appreciated.

Maqrkk
November 17th, 2009, 11:11 AM
In this code:


var frameNum:Number = this.slides.currentFrame;

you assign the currentFrame property of the slides MovieClip to the variable. Maybe:


this.currentFrame;

would work?

SuperiorAssassi
November 17th, 2009, 11:17 AM
No, that gives me a 1076 error.


In this code:


var frameNum:Number = this.slides.currentFrame;you assign the currentFrame property of the slides MovieClip to the variable. Maybe:


this.currentFrame;would work?

birdwing
November 17th, 2009, 12:16 PM
is "slides" the MC that shows the actual content. Or is it the menu?

where are you declaring your variable. You have to keep in mind variable scopes. if you have "slides" and then you have "menu" this.slides.currentFrame will be looking for "slides" as if it was INSIDE "menu" that is if you are declaring the variable from within the "menu" MC.

If you are declaring the variable from within "slides" then this.currentFrame should work. However its not, so I am guessing that you are declaring this elsewhere.

"menu" will NOT be able to see "slides" because it is a different object. Unless "menu" is a child of the "slides" MC if that is the case then you will have to reference it with _parent

SuperiorAssassi
November 17th, 2009, 12:19 PM
is "slides" the MC that shows the actual content. Or is it the menu?

where are you declaring your variable. You have to keep in mind variable scopes. if you have "slides" and then you have "menu" this.slides.currentFrame will be looking for "slides" as if it was INSIDE "menu" that is if you are declaring the variable from within the "menu" MC.

If you are declaring the variable from within "slides" then this.currentFrame should work. However its not, so I am guessing that you are declaring this elsewhere.

"menu" will NOT be able to see "slides" because it is a different object. Unless "menu" is a child of the "slides" MC if that is the case then you will have to reference it with _parent


I wish it were that simple. The dynamic text object is located directly on the stage. I tried to use the absolute location of the instance, but for some reason root.instanceName always gives me a fit.