Why does .currentFrame not find frames within movie clip? the button is not hiding. Flash AS3

actionscript-3buttonflashhide

I'm creating a "simple" slideshow for my sister using Flash CS5 AS3. I'm using the flash presentation template. I currently have the existing functional buttons that navigate any direction through the presentation. The only thing is that on the cover page, I just want to have an "Enter" button that hides when you move to frames > 1. I currently have the buttons all on one layer, the movieclip (slides_mc) on a separate layer, and the actions on it's own layer. All consisting of just one frame across on the main timeline. Within slides_mc there is no actionscript, and consists of 4 frames.

I'm getting no errors whatsoever when I run a test, but it's simply not finding specific frames within the movie clip. OR it's finding the frames but not executing .visible=false.

If I use the following:

if(slides_mc.currentFrame>1) enter_btn.visible=false;

It the button is visible on all four frames.

If I use the following:

if(slides_mc.currentFrame==1) enter_btn.visible=false;

The button disappears on frame 1, but never becomes visible again on any of the other frames.

If use the following:

if(slides_mc.currentFrame==2) enter_btn.visible=false;

The button is visible on all four frames.

Do I need to put this code within a function to call this and make it work?? Thanks in advance. This button hide issue is driving me nuts. I really need to go back to multimedia school.

If I forgot to mention crucial info or if you need to see any of the other code that may be affecting the outcome please let me know. Your help is greatly appreciated.

Best Answer

You could also do:

stage.addEventListener(Event.ENTER_FRAME, doThis);

 function doThis(){ if(slides_mc.currentFrame>1){enter_btn.visible=false;}}

Then the function would be checking for the currentFrame all the time.

Related Topic