Copy link to clipboard
Copied
I am trying to find a way to get my menu bar working. Little info, I am a beginner in Flash just learned the essential DVD from Adobe.
My menu bar has the following:
(About Us) (Services) (Quality) (Projects) (Contact Us)
Each page will have a motion shape tween and slide the page down.
I have type in this actions :
stop();
import flash.events.MouseEvent;
//---aboutus Button Timeline change---\\
aboutus_btn.addEventListener(MouseEvent.CLICK, aboutusClick);
function aboutusClick(event:MouseEvent):void{
gotoAndPlay("aboutus");
}
//---services Button Timeline change---\\
services_btn.addEventListener(MouseEvent.CLICK, servicesClick);
function servicesClick(event:MouseEvent):void{
gotoAndPlay("services");
}
//---quality Button Timeline change---\\
quality_btn.addEventListener(MouseEvent.CLICK, qualityClick);
function qualityClick(event:MouseEvent):void{
gotoAndPlay("quality");
}
//---projects Button Timeline change---\\
projects_btn.addEventListener(MouseEvent.CLICK, projectsClick);
function projectsClick(event:MouseEvent):void{
gotoAndPlay("projects");
}
//---contactus Button Timeline change---\\
contactus_btn.addEventListener(MouseEvent.CLICK, contactusClick);
function contactusClick(event:MouseEvent):void{
gotoAndPlay("contactus");
}
This actions only works when I click to the next labels but doesn't work when I want to click back to the previous labels. For example, if I click onto (About Us) to (Services) and (Services) to (Quality) and (Quality) to Projects and (Projects) to (Contact Us)... it all works. If I then click from (Contact Us) back to (Projects) or even any previous buttons... it does NOT work??
Anyone? Please help!
Copy link to clipboard
Copied
is your code attached to one frame?
do you have each button in exactly one keyframe?
Copy link to clipboard
Copied
This is my timeline structure. The code for the action frame is in hi-lite in yellow.
Is this clear enough?
I also tried rewriting the action like below, but still have the same problem.
stop();
aboutus_btn.addEventListener(MouseEvent.CLICK, onaboutusClick, false, 0, true);
services_btn.addEventListener(MouseEvent.CLICK, onservicesClick, false, 0, true);
quality_btn.addEventListener(MouseEvent.CLICK, onqualityClick, false, 0, true);
projects_btn.addEventListener(MouseEvent.CLICK, onprojectsClick, false, 0, true);
contactus_btn.addEventListener(MouseEvent.CLICK, oncontactusClick, false, 0, true);
function onaboutusClick(evt:MouseEvent):void {
gotoAndPlay("aboutus");
}
function onservicesClick(evt:MouseEvent):void {
gotoAndPlay("services");
}
function onqualityClick(evt:MouseEvent):void {
gotoAndPlay("quality");
}
function onprojectsClick(evt:MouseEvent):void {
gotoAndPlay("projects");
}
function oncontactusClick(evt:MouseEvent):void {
gotoAndPlay("contactus");
}
Copy link to clipboard
Copied
the buttons you assigned mouse listeners don't always exist when you move past frame 53 or 54.
to remedy, clear all the keyframes greater than 60 in your button layers. then insert keyframes at 65, 76 etc for all your buttons. then without removing any button from the stage in 65, 76 etc change the button properties you want changed (like the color).
BUT, you cannot replace, for example, the services button on frame 65 with a different button (even if it looks the same to you except for a text color change).