• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Basic button script not working

New Here ,
Sep 13, 2010 Sep 13, 2010

Copy link to clipboard

Copied

well i lied it works at first but then it stops

I have a flash site that has a presentation page it has a menu of two buttons (1) to take you to a slide show and (2) that takes you to the gallery. these are the only two buttons that seem to work in control test movie, I get no errors.

The only button that is connected is the slideshow button (I havent done the gallery yet). This button takes you to frame two. where i have the main website. it has its own menu that spans across the entire website which is 25 frames. each frame represents a new page. i have mini menus at frames 3, 5, and ten. that are supposed to just advance the user to correct frame labels and stop.

here is my problem

the only buttons that work are the ones in the first frames.

the rollovers appear to work on all the pages when i advance the movie using the [ . ] key but i get no trace statement witch means that it is not being acknowledged, all my buttons are named properly i believe so i do not know what the problem is, here is the code as well, all is in frame one:

stop();

//handle events for buttons...

Gallery.addEventListener(MouseEvent.CLICK, clickSection);

Home.addEventListener(MouseEvent.CLICK, clickSection);

Location.addEventListener(MouseEvent.CLICK, clickSection);

Guest.addEventListener(MouseEvent.CLICK, clickSection);

Lodging.addEventListener(MouseEvent.CLICK, clickSection);

Cuisine.addEventListener(MouseEvent.CLICK, clickSection);

ExploreEcuador.addEventListener(MouseEvent.CLICK, clickSection);

Direction.addEventListener(MouseEvent.CLICK, clickSection);

Home.addEventListener(MouseEvent.CLICK, clickSection);

Lodging.addEventListener(MouseEvent.CLICK, clickSection);

Amenities.addEventListener(MouseEvent.CLICK, clickSection);

Hotel.addEventListener(MouseEvent.CLICK, clickSection);

Coast.addEventListener(MouseEvent.CLICK, clickSection);

BahiaDeCaraquez.addEventListener(MouseEvent.CLICK, clickSection);

CentralBankMuseum.addEventListener(MouseEvent.CLICK, clickSection);

IslaCorazon.addEventListener(MouseEvent.CLICK, clickSection);

RioChone.addEventListener(MouseEvent.CLICK, clickSection);

Beaches.addEventListener(MouseEvent.CLICK, clickSection);

CaboPasado.addEventListener(MouseEvent.CLICK, clickSection);

LaSegua.addEventListener(MouseEvent.CLICK, clickSection);

CerroSecoPark.addEventListener(MouseEvent.CLICK, clickSection);

WhaleWatching.addEventListener(MouseEvent.CLICK, clickSection);

SeasonalTours.addEventListener(MouseEvent.CLICK, clickSection);

HomePage.addEventListener(MouseEvent.CLICK, clickSection);

Contact.addEventListener(MouseEvent.CLICK, clickSection);

//end of menu

function clickSection(evtObj:MouseEvent) {

//trace shows what is happening.. in the output window

trace ("The "+evtObj.target.name+" button was clicked!")

//go to the section clicked on...

gotoAndStop (evtObj.target.name);

}

Help me Adobe-wan, you are my only hope...

TOPICS
ActionScript

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Sep 14, 2010 Sep 14, 2010

If you have those buttons in different keyframes but only have code assigned to them in one ketframe, then the only ones that will work will be the ones in the coded keyframe. When you create new keyframes, you create new instances.

Votes

Translate

Translate
LEGEND ,
Sep 14, 2010 Sep 14, 2010

Copy link to clipboard

Copied

If you have those buttons in different keyframes but only have code assigned to them in one ketframe, then the only ones that will work will be the ones in the coded keyframe. When you create new keyframes, you create new instances.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 14, 2010 Sep 14, 2010

Copy link to clipboard

Copied

I do not understand

i have the actions layers and it should span across all frames. and should control all the frames from one to twentytwo.

I attempted to put a new script on each of the key frames and i get error messages saying i had a duplicate function on line 36 (it says) =   function clickSection(evtObj:MouseEvent) {

I am sorry i am self taught so I do not know what to do to fix this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2010 Sep 14, 2010

Copy link to clipboard

Copied

You need to assign the event listeners in every frame where you have new button instances, but you cannot have functions with the same name.  Or have your buttons span the full timeline instead of creating new instances across the timeline.

Some code executes in the frame it is in, such as the event listeners you assign.  event listeners are only assigned to the instances that are present when it executes.   Some code sits in waiting, such as the event handler functions you create.  The functions will work across the timeline, so you don't need to duplicate them.

What I usually do is place frame-specific code (event listener assignments, function calls, etc) on a separate layer from than share-able code (vars, functions)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 14, 2010 Sep 14, 2010

Copy link to clipboard

Copied

wow that was kinda confusing but i think i understand i will meditate on what you said and hopefully i can figure it out. thank you for your help.

I would appreciate an example, but i think i can figure it out.

btw as a side question how much would you charge for for flash design (idk if you dled this file or not)

when the site is done it will feature a gallery along with the 12 pages

with special easing actionscript written for fades and such.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2010 Sep 14, 2010

Copy link to clipboard

Copied

I wouldn't begin to dl that file... probably couldn't open it even if I did, but with the warning of 17MB... no chance.  I charge for my time, so I can't suggest a dollar amount.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 14, 2010 Sep 14, 2010

Copy link to clipboard

Copied

here is a link to the file it is 17mb

it will only be up for 24 hours

if someone could take a couple minutes to see why the buttons are not working.

http://EmailLargeFile.com/d/CPEOAX8$AIC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 15, 2010 Sep 15, 2010

Copy link to clipboard

Copied

just a hint:
You can use less code that way maybe:

stage.addEventListener(MouseEvent.CLICK, clickSection);

function clickSection(evtObj:MouseEvent)
{

//trace shows what is happening.. in the output window

trace("The "+evtObj.target.name+" button was clicked!");

//go to the section clicked on...
try
{
  gotoAndStop(evtObj.target.name);
}
catch (err:Error)
{
}
}

Try it.

Hakan KIRIK - http://www.FlashDersi.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 15, 2010 Sep 15, 2010

Copy link to clipboard

Copied

I do not know what to say, but THANK YOU will have to suffice.

I do not know what motivated you to add an answer to an already resolved question, but THANK YOU, i was able to delete all the other code on all the different frames and just include that in the first frame and everything works perfectly. Thank you so much

YOURS WAS THE ANSWER I WAS LOOKING FOR

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 15, 2010 Sep 15, 2010

Copy link to clipboard

Copied

I do not know what to say, but THANK YOU will have to suffice.

I do not know what motivated you to add an answer to an already resolved question, but THANK YOU, i was able to delete all the other code on all the different frames and just include that in the first frame and everything works perfectly. Thank you so much

YOURS WAS THE ANSWER I WAS LOOKING FOR

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 15, 2010 Sep 15, 2010

Copy link to clipboard

Copied

just wanted to help you, after I saw so many lines of code...

Hakan KIRIK / http://www.FlashDersi.com / Istanbul

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 13, 2020 Jun 13, 2020

Copy link to clipboard

Copied

LATEST

Açıklama güzel yetersiz, benim gibi yeni başlamış biti için bu tuşları tek tek açıklar mısınız?

isislives

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines