FORUMS: list search recent posts

(Buttons not working) after thier timeline is navigated

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jessica Bassett
(Buttons not working) after thier timeline is navigated
on Jul 23, 2011 at 4:38:49 pm

Hi everyone I hope some one can help me out with this. Cus it's part of a website that's due august 1st >_<

-Alright so I have made a next, and a prev button. That navigate the timeline inside an mc "tabs_mc." This mc is
on the the main stage.
-When the next and prev buttons are pressed they goto 1 of 4 frame labels on this timeline inside tabs_mc.
-When one of these lables is reached an mc "thumbs" appears on the screen / stage.
-These mc's "thumbs1, thumbs2, thumbs3, and thumbs4" contain buttons that SHOULD be clickable.
-But are not after the prev, and next buttons are press. They are before the next, and prev button are press, but not after.

Any ideas as to way this is or even better how to keep these buttons enabled after the next, prev buttons are clicked?
I thought of making some sort of boolean to tell the each button that is needs to stay "true" after prev, and next are pressed.
But I'm a beginner so I don't know where to start. And i don't have anymore time for hours of research, so please HELP!


Heres the next, and prev button code:



//Button Listeners
/////next_mc.buttonMode = true;
/////prev_mc.buttonMode = true;

next_btn.addEventListener(MouseEvent.CLICK, nextSection);
prev_btn.addEventListener(MouseEvent.CLICK, prevSection);

function nextSection(event:MouseEvent):void {

var thisLabel:String = tabs_mc.currentLabel;//gets current frame label as string
var thisLabelNum:String = thisLabel.replace("thumbs","");//cuts the leading letter off of the number
var curNumber:Number = Number(thisLabelNum);//convert that sting number to a real number
if (curNumber < 4) {

var nextNum:Number = curNumber + 1; //adds 1 to the number so it can go to the nxet frame label
tabs_mc.gotoAndStop("thumbs" + nextNum); //this allows it to go to the next frame label

}

}
///////////////////////////////Previous Btn/////////////////////////////////
function prevSection(event:MouseEvent):void {

var thisLabel:String = tabs_mc.currentLabel; //gets curent frame label as string
var thisLabelNum:String = thisLabel.replace("thumbs","");
var curNumber:Number = Number(thisLabelNum);
var prevNum:Number = curNumber - 1; //subtracts 1 from the number so it can go to the prev frame label
tabs_mc.gotoAndStop("thumbs" + prevNum);
}

heres what the code for each of the buttons that arn't working looks like. there are 19 of them
The buttons are just movie clips with frame lables that indicate there up, over, and click states.


tabs_mc.thumbs1_mc.MtBaker_Thm_mc.buttonMode = true;

function MtBaker_Thm_btnOver (event:MouseEvent):void {
tabs_mc.thumbs1_mc.MtBaker_Thm_mc.gotoAndPlay("Over");
}
function MtBaker_Thm_btnUp(event:MouseEvent):void {
tabs_mc.thumbs1_mc.MtBaker_Thm_mc.gotoAndPlay("Up");
}
function MtBaker_Thm_btnClick(event:MouseEvent):void {
tabs_mc.thumbs1_mc. MtBaker_Thm_mc.gotoAndPlay("Click");
gotoAndStop("Description_baker");
}
tabs_mc.thumbs1_mc.MtBaker_Thm_mc.addEventListener(MouseEvent.ROLL_OVER,MtBaker_Thm_btnOver);
tabs_mc.thumbs1_mc.MtBaker_Thm_mc.addEventListener(MouseEvent.ROLL_OUT,MtBaker_Thm_btnUp);
tabs_mc.thumbs1_mc.MtBaker_Thm_mc.addEventListener(MouseEvent.CLICK,MtBaker_Thm_btnClick);



Thanx JAB


Return to posts index

demetri tashie
Re: (Buttons not working) after thier timeline is navigated
on Jul 25, 2011 at 3:35:40 am

jessica,

it is hard to say exactly what is going on without seeing your files, but i would be sure that it is a matter of code placement.

you might have code placed in different frames, and/or buried in different nested movieclips, either of which can cause code conflicts, error messages, and other unexpectred results.

try this : remove all your code and place it either in an external as file, or at least place it and keep it all on the first frame of the main timeline.

from there, you can better evaluate it line by line to make sure that you are correctly referencing everything. start by adding back one bit of code at a time, testing after each new addition. use trace statements to make sure your code is working.

if you are still really stuck, you can try posting your file for us to look at, or ask for more specific help


Return to posts index

Jessica Bassett
Re: (Buttons not working) after thier timeline is navigated
on Jul 25, 2011 at 8:11:37 pm

thank you so much for your reply.

I currently have all my code on the main timeline but not on the same layer. I have the next and previous button code on one layer and everything else on another.I will try what you said though.

how do you link your code as an external file though?

And How do you write trace statements?

I've uploaded the source file for you or anyone to take a better look.
2677_map.fla.zip

Thank you so much :)


Return to posts index


demetri tashie
Re: (Buttons not working) after thier timeline is navigated
on Jul 26, 2011 at 3:47:28 pm

I did take a look at your file. here are some thoughts:

i think your original question:
QUOTE:
-These mc's "thumbs1, thumbs2, thumbs3, and thumbs4" contain buttons that SHOULD be clickable.
-But are not after the prev, and next buttons are press. They are before the next, and prev button are press, but not after.

Any ideas as to way this is or even better how to keep these buttons enabled after the next, prev buttons are clicked?

is based on an eroneous assumption - that this file actually compiles correctly. It doesn't (at least for me) and that would lead to your other issues.

you are referencing in code movieclips that are not recognized yet by the compiler.

'thumbs1' is on frame 1 of 'Tabs_mc', and so it and its nested movieclips are therefore available to be recognized by your code.

on the other hand your movieclips in question ( those contained within thumbs2,thumbs3 and thumbs4) are placed on 'future' frames.
that is, thumbs2 is on frame 19 of Tabs_mc, and thumbs3 on frame 40, thumbs 4 on frame 58.

so the movieclip 'buttons' on thumbs1 would/could work, where as those on thumbs 2,3,4 would not work - and those are the ones showing up AFTER the prev/next buttons are clicked.

how to fix this? well, you could review your code and make sure that you are not referencing any movieclip in your code until it will be 'seen' on the stage ( in other words, until they actually enter the 'display list'). there are different ways that could be used to accomplish this.

however, a better, more up to date approach, is to remove the reliance on timelines to do your effect(s) (although it is OK to use the small multi- frame-labeled timelines that act as buttons , with their 3 states created by going to coresponding frame labels).

the overall theory is to have everything either on the first frame already, or added to it as needed. some of the popular ways would be to have all the possible movieclips on the first frame, and change their alpha properties as needed so they appear or dissappear as required.
or do the same with their visibility property.
or items can be added from the Library via 'addChild' and removed ( 'removeChild') as needed.
or they can be externally loaded and removed assets ( swfs, image files,etc).

if you feel up to , you can explore this file that i uploaded for you.2681_2677mapcs4.fla.zip it reworks your file with some major changes..
Your main timeline is now just a 1 frame timeline. Likewise your Tabs_mc is totally reworked to be a 1 frame movieclip also. all the nested movieclips within the original Tabs_mc were placed directly within it.

the next button ( you can rework the previous button yourself ), works by now simply changing the y position of the clip to reveal the appropriate part under the mask. Look inside the clip to see how it was created.
a variable 'buttonPosition' was created which keeps track of where it is.

another variable 'currentClip' was created to keep track of a new movieclip.
this clip is your 'description text'. i have to assume that you will also have other info and/or images to appear along with the description (otherwise the text could have been handled using dynamic text changes instead).
these other assets can be added inside of these 'description' clips. i just did a few of these - you will have to do the others, based on these, yourself. the code corresponding to the other icons has been disabled. rework them and add them back one at a time.

so now the icon 'clicks' do this: clicking on an icon will turn the visibility off for the current 'description' movie clip, and will make visible the appropriate 'description;' movieclip.
it will also set the value of the current movieclip .

as always, there are many different ways to approach a project. this is just one of them

i hope this helps rather than confuses. if you have further questions regarding this file feel free to ask.


Return to posts index

Jessica Bassett
Re: (Buttons not working) after thier timeline is navigated
on Jul 28, 2011 at 12:42:15 am

Hey Just wanted to let you know that I was very happy to see you found a solution to my issue I'm currently finishing the other buttons. Once I'm done I will let you know if everything worked. I have alot of other things I'm working on right now so It might be a little while. But again just wanted to say thank you!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]