Help with multiple buttons on navigation bar

I'm new to AS3 and am doing my first project. I
believe that I've got a problem coding AS3 with bad AS2 habits.
I can click on one button and it goes to the correct frame, but then none of the others work.
It doesn't matter which button I click on. The first one works. Then nothing.
I've traced it - and they aren't active. Why?
I have 9 buttons on my nav menu. Following a tutorial, I've coded them to work as follows (I'm pretty sure I don't need: import flash.events.MouseEvent; : every time.
On Frame 1 actions layer I have:
stop();
import flash.events.MouseEvent;
Weddings_btn.addEventListener(MouseEvent.CLICK,aClick);
function aClick(event:MouseEvent):void{
gotoAndStop("Wedding");
import flash.events.MouseEvent;
Garden_btn.addEventListener(MouseEvent.CLICK,bClick);
function bClick(event:MouseEvent):void{
gotoAndStop("Garden");
import flash.events.MouseEvent;
Seasons_btn.addEventListener(MouseEvent.CLICK,seasonsClick);
function seasonsClick(event:MouseEvent):void{
gotoAndStop("Seasons");
import flash.events.MouseEvent;
Floral_btn.addEventListener(MouseEvent.CLICK,cClick);
function cClick(event:MouseEvent):void{
gotoAndStop("Floral");
import flash.events.MouseEvent;
Orchids_btn.addEventListener(MouseEvent.CLICK,dClick);
function dClick(event:MouseEvent):void{
gotoAndStop("Orchids");
import flash.events.MouseEvent;
Baskets_btn.addEventListener(MouseEvent.CLICK,eClick);
function eClick(event:MouseEvent):void{
gotoAndStop("Baskets");
import flash.events.MouseEvent;
Memorials_btn.addEventListener(MouseEvent.CLICK,fClick);
function fClick(event:MouseEvent):void{
gotoAndStop("Memorials");
import flash.events.MouseEvent;
Animals_btn.addEventListener(MouseEvent.CLICK,gClick);
function gClick(event:MouseEvent):void{
gotoAndStop("Animals");
import flash.events.MouseEvent;
Contact_btn.addEventListener(MouseEvent.CLICK,hClick);
function hClick(event:MouseEvent):void{
gotoAndStop("Contact");

If your menu layer has keyframes that's your issue. The code you have in frame 1, won't be there past a keyframe...
You only need to import once - imports should go at the very top. Also if your menu buttons are MovieClips you can 'inject' the label name into them and then just use one listener, greatly simplifying your code:
import flash.events.MouseEvent;
Weddings_btn.goLabel = "Wedding";
Garden_btn.goLabel = "Garden";
Weddings_btn.addEventListener(MouseEvent.CLICK,aClick);
Garden_btn.addEventListener(MouseEvent.CLICK,aClick);
function aClick(e:MouseEvent):void
     gotoAndStop(e.currentTarget.goLabel);

Similar Messages

  • Help with multiple buttons

    I'm writing a linked list program and I have two buttons in my program, one to add a node and one to remove a node. The actionPerformed method is in a different class. What I'm having trouble with is how to figure out which button was pressed so I can do the correct action. Any help is appreciated.

    Use event.getSource() or event.getActionCommand()

  • Buttons on navigation bar not working??

    Hello all, I am in a web design class and im currently wokring on my website. When i made my navigation bar in adobe fireworks and saved/exported it then tried to open it in dreamweaver cs6. The way i did this was insert>image objects>fireworks HTML then selected the html version of the nav bar. But for some reason when i try to do live view or open it in browser the buttons don't work, they worked when I opened them from fireworks. Someone help please :/

    The old Fireworks code relied on javascript for the menus.  If the javascript file is not in the proper location or is missing then the menus will not work.  In order to tell if this is the page we would need access to a test page online to view your code.  In case this is not possible, I am also including a link to the KB article discussing how this process works from FW to DW to explain all of the steps.
    Macromedia Fireworks - Working with Macromedia Fireworks MX buttons and navigation bars : Export the navigation bar

  • Help with linking buttons to Scenes

    Hey,
    Rookie to Flash and AS3. Just needed some help with my buttons. Im making a flash program about pancakes (random I know). I have a "Mainmenu" scene and then a "Recipe" scene. I have a button on my mainmenu which takes me to the recipe page when I click it, the code behind the button is
    "stop();btn_recipe.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);function mouseDownHandler(event:MouseEvent):void {
    gotoAndStop(1, "Recipe");
    Then when I arrive at my recipe page I have a button which will take me back to my MainMenu, the code behind that button is:
    "stop();btn_home.addEventListener(MouseEvent.MOUSE_DOWN, mouse5DownHandler);function mouse5DownHandler(event:MouseEvent):void {
    gotoAndPlay(1, "MainMenu");
    So I run my program and the first button works and takes me to recipe page but the button to get to the main menu does nothing, click it and no response or anything
    Please help

    First, hopefully having all your code mushed onto the same line is a copy/paste error, otherwise it should look like...
    stop();
    btn_recipe.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    function mouseDownHandler(event:MouseEvent):void {
         gotoAndStop(1, "Recipe");
    If the intention is to click the buttons to make them work, then you should use CLICK instead of MOUSE_DOWN.  MOUSE_DOWN can be a persistent state whereas CLICK involves releasing it afterwards.
    As for the code to get you back home, where is it located on the timeline?  Are you getting any error messages when you try to use it?
    One thing you should learn to use is the trace() function.  It is useful for troubleshooting.  You can use it now to see if your second button is talking to the function at all...
    stop();
    btn_home.addEventListener(MouseEvent.CLICK, mouse5DownHandler);
    function mouse5DownHandler(event:MouseEvent):void {
         trace("the button works okay");
         gotoAndPlay(1, "MainMenu");
    If you don't get that message in the output panel, you'll know the button is not properly coded to work.
    Most folks here will recommend you get away from using scenes in a design that includes navigation--they have a history of being problematic.  Instead of using scenes, divide the one main timeline up into sections or use movieclips for the sections and manage their visibility... or do a bit of both.

  • Need help with a button

    Hello,
    I need help with a button. I created a button and set it up
    so that when you click and hold it, the button becomes lighter in
    color (I used Alpha). I want the button to stay this light color
    after i release the click. Right now it goes back to the normal
    color when I release the click. Can somone help we this?
    Thanks!

    rpofclt wrote:
    > Hello,
    >
    > I need help with a button. I created a button and set it
    up so that when you
    > click and hold it, the button becomes lighter in color
    (I used Alpha). I want
    > the button to stay this light color after i release the
    click. Right now it
    > goes back to the normal color when I release the click.
    Can somone help we
    > this?
    you can't use the button itself if you want to maintain the
    DOWN state after
    release as button automatically resets itself once the mouse
    lives the HIT zone.
    Use movie clip instead and on press simply send it to a frame
    where there
    is DOWN state like image.
    Best Regards
    Urami
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • Help with multiple httpservice calls

    I need help with multiple httpservice call back to back, doing 10 different mysql query at startup of the app loading results into 14 datagrids/combobox all queries are to different tables.

    Hello,
    I think what Grizzzzzzzzzz means is the following:
        <mx:HTTPService id="serviceOne"
            url="here goes url"
            result="resultHandler1(event);"
            fault="faultHandler(event);"/>
        <mx:HTTPService id="serviceTwo"
            url="here goes url"
            result="resultHandler2(event);"
            fault="faultHandler(event);"/>
        <mx:HTTPService id="serviceThree"
            url="here goes url"
            result="resultHandler3(event);"
            fault="faultHandler(event);"/>
         // Result handler 1
         private function resultHandler1(event:ResultEvent):void{
              //Here do something with the results
             xmlCollection = event.result as XML;
             //then call the next service
             serviceTwo.send();
          // Result handler 2
          private function resultHandler2(event:ResultEvent):void{
              //Here do something with the results
             xmlCollection = event.result as XML;
             //then call the next service
              serviceThree.send();
    I hope this helps,
    Pierre

  • Help required with multiple buttons

    Hi all, i'm working on a charity project that entails the clicking of buttons in order to purchase a "virtual plot" on a grid system.
    There are hundreds of buttons involved.
    What I need to know are the following :
    a) Is there a way for me to set the actionscripting to a "parent" button then multi copy the button around the grid maintaining the scripting.
    b) When a button is clicked, it goes out to paypal, is there a way to AUTOMATICALLY disable the button once the transaction takes place
        and the user gets re-directed back to the website.
    c) When different buttons are clicked, is there a way to only have the URL of the last clicked button open up......in other words not have a whole
        load of different pages to the same paypal account open. (EG. If I click 20 buttons, I don't want 20 links to paypal open, only the last clicked button)
    I guess there is quite a bit of information I'm looking for help with but I am fairly new to Actionscript. Any help at all is greatly appreciated.
    Many thanks in advance.
    Ray

    a) Is there a way for me to set the actionscripting to a "parent" button then multi copy the button around the grid maintaining the scripting.
    yes, but that's probably not what you want because each button will do exactly the same thing (unless you encode an if-statement that takes different actions based on the objects instance name).  you'll probably want to use a for-loop to encode your buttons so you don't have much typing to do.
    b) When a button is clicked, it goes out to paypal, is there a way to AUTOMATICALLY disable the button once the transaction takes place
        and the user gets re-directed back to the website.
    yes, as long as you setup flash and paypal to communicate when a transaction is completed.
    c) When different buttons are clicked, is there a way to only have the URL of the last clicked button open up......in other words not have a whole
        load of different pages to the same paypal account open. (EG. If I click 20 buttons, I don't want 20 links to paypal open, only the last clicked button)
    yes, but flash needs some way to determine a user has made the final choice.

  • SAP WebGui -  Hide "Standard buttons"/ "Address/navigation bar"

    Dear,
    We would like to use the WebGui for some HR transactions.
    To prevent some wrong operation executed by users like selecting "Back" button and "forward" button of Web browser (IE or FireFox), we would like to hide "Standard buttons". To prevent also any URL modification, we would like to hide the "address/navigation bar" and if possible the "menu bar (File/Edit/view/Favorites)"
    Could you please provide us your help?
    Thank you,
    Regards,
    Z. Lamarti

    Hi Z. Lamarti,
    I can assist with two out of 3 requests. However your request are really IE / FIREFOX rather than ITS/SAP
    First read the following WIKI in relation to:
    "To prevent some wrong operation executed by users like selecting "Back" button and "forward" button of Web browser (IE or FireFox), we would like to hide "Standard buttons"
    The following has nothing to do with the Browser buttons - but helps in restricting the access of the ESS services accessed via the ITS
    [How to terminate a user session with integrated ITS when the transaction |http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=25427]
    AND
    [Article - Employ SAP GUI for HTML instead of an Internet service |http://wiki.sdn.sap.com/wiki/display/HOME/Article-EmploySAPGUIforHTMLinsteadofanInternet+service]
    RE URL's
    Rather than hiding the bar - could use a Reverse Proxy. The SAP WEB Dispatcher can be used for this function.
    See:[SAP Web Dispatcher |http://wiki.sdn.sap.com/wiki/display/SI/SAPWebDispatcher]
    In order to secure your SAP system you can put an SAP Webdispatcher (or application gateway like a reverse proxy) in the outer DMZ, which filters the incoming requests and forwards them to the corresponding application servers.
    Regards,
    Oisin
    Edited by: Oisin ONidh on May 30, 2011 4:10 PM
    Initial URL's had a strikethrough in them

  • Using the same action sequence with multiple buttons and exclusive conditional interactions

    Hi all,
    first of all, pardon me for my english and if I post questions already answered, but I can't find anything about that.
    I'm new to flash and I decided to use Flash Catalyst to speed up the building process of a multimedia presentation for university.
    I have a menu with 10 buttons that change a text box on rollover (I converted it to a button label) and I need to reset the name of the current page on RollOut. Since the action sequence for it is the same of every button on one page, is there a faster way to apply the sequence than repeating it for every button? (I had to do it 10x10=100 times... and what if I made some mistake? )
    Another question is I want to disable the interaction of the menu button of the current page, but conditional interaction let me choose only an "if in state" condition an not a "if not in state". How can I do this? should I simply disable the button on that page?
    Thanks a lot for the help!
    Cheers from Italy

    I answered to myself by grouping buttons and disabling the button in his state.
    Thanks anyway!

  • I need help with a button animation!

    Hi,
    I hope someone can help with a simple-looking problem which
    nonetheless has me stumped!
    I have a feeling that I've missed something obvious.
    I've created a movie clip to act as a button (I've called it
    "abs_button") and placed it on the stage.
    My main movie has one frame.
    Within the "abs_button" movie clip there are 5 layers.
    Labels, actions, default button state, rollover state and rollout
    state.
    Technically, default button state, rollover state and rollout
    state could be on the same layer as they don't overlap, but I've
    given each animation its own layer for clarity.
    FRAME 01.
    Default button state is one frame with a graphic of the
    button. Just a label at the start ("abs_up") and a "stop();" action
    at the end.
    FRAME 02 to 31.
    Rollover state is a 30 frame animation. Label at start
    ("abs_over"), "stop()"; action at the end.
    FRAME 32 to 62.
    Rollout state is a 30 frame animation. Label at start
    ("abs_out"), "stop()"; action at the end.
    All animations were achieved with tweens.
    My initial "abs_button" code:
    on (release) {
    getURL("targetPage.htm", "_self");
    on (rollOver) {
    gotoAndPlay("abs_button", "abs_over");
    on (rollOut) {
    gotoAndPlay("abs_button", "abs_out");
    As it stands, the animation jumps to frame 1 of "abs_out" on
    rollout.
    I need the "abs_over" animation to always play through to the
    end, as the "abs_out" is "abs_over" in reverse (i.e. image grows
    large on rollover and shrinks again on rollout.
    I've tried for 2 days to solve this, but I clearly need help.
    My experiments with variables simply didn't work.
    I would be grateful if someone could tell me where I'm going
    wrong!
    Thanks,
    Andy

    use this:
    on (rollOver) {
    gotoAndPlay("abs_over");
    Since the code is attached directly to the movieclip, you
    don't have to
    identify the clip. A gotoAndPlay() function takes a frame
    number or a
    frame label name as its argument, never the name of the clip
    that
    contains the frame number or name.
    Rob
    Rob Dillon
    Adobe Community Expert
    http://www.ddg-designs.com
    412.243.9119

  • Help with multiple contacts with multiple phone numbers

    I'm fairly new to the iPhone so thanks in advance for any help with this issue.
    I have contact list with records for a lot of people (300+), each with several phone numbers each, home, mobile & work, etc, .I can't seem to find a way to have the iPhone announce the name & number or name & type (home,mobile,work) of the caller from the contact list, my old cell phone could do that easily.
    At the moment what I've been doing as a work around for a few (important) people is to create a custom ringtone for that caller & that phone number.  Since it also seems there's no way to attach a different ringtones to each number in a single contact record I've had to create multiple contact records for each person, each with a different name/number combination such as "John Doe Work", "John Doe Home" or John Doe Mobile" then assign to it the custom ringtone I created for that name/number. 
    I need to this so that if I receive a call while I'm driving (or whatever) that I can't answer right then for some reason (often happens),  the ringtone I created for that name & number helpfully lets me know  who & where their calling from.  It's very important to know where someone is calling from, if someone's calling from home then I know I've got some time,  but if their calling from work then I need to get back to them quickly.
    This is a real pain!, having to make multiple contacts & ringtones for a every person with multiple numbers is a extraordinary waste of time.  My old cell phone could do this with no problem but there doesn't seem to be any way to do this with my new iphone.  Am I missing something here?  I am new to the iPhone so if there’s a solution to this that I’ve missed I'd very much appreciate the assistance.
    Thanks in advance.
    Al

    https://discussions.apple.com/message/18271382#18271382

  • Little bit of help[ with a button.

    Good day all!
    I need help making a button. This is what I want to happen.
    I have a bunch of text, One of the words "merino" is bule as
    to say there is a link hear! And I want an image of the "merino" to
    come up, like a "ALT" box. Or have an image in the "ALT" box?
    I know how to do this in "Flash" i.e just drop in the image
    on the over state of the button event. Easy as pie! This is why I
    cant get to grips with Dreamweaver! I hate it!
    But I am willing to learn and maybe in time love???
    Thanks all!

    "satrop" <[email protected]> wrote in
    message
    news:f0o4t7$954$[email protected]..
    > Good day all!
    >
    > I need help making a button. This is what I want to
    happen.
    >
    > I have a bunch of text, One of the words "merino" is
    bule as to say there
    > is a
    > link hear! And I want an image of the "merino" to come
    up, like a "ALT"
    > box.
    >
    > I know how to do this in "Flash" i.e just drop in the
    image on the over
    > state
    > of the button event. Easy as pie! This is why I cant get
    to grips with
    > Dreamweaver! I hate it!
    >
    > But I am willing to learn and maybe in time love???
    HTML is a lot different from Flash! :-)
    I believe you could do this using DW's Show-Hide layer
    behavior - have
    mousing over the link trigger a layer with the image to
    appear. Someone else
    may have a better idea.
    Just FYI, having to mouse over a link in order to get more
    information about
    it isn't usually appreciated by users. You *might* want to
    re-think this
    plan..
    Patty Ayers | Adobe Community Expert
    www.WebDevBiz.com
    Free Articles on the Business of Web Development
    Web Design Contract, Estimate Request Form, Estimate
    Worksheet

  • Help With Radio Buttons -- URGENT!!

    Hi i am new to using UI compents in flash.
    Basically i havnt a clue where to start.
    Just some simple action script will help and be much
    appreciated if someone can give me it.
    Basically i have a question to ask which requires radio
    buttons to answer the question.
    I have a question and the answers are A, B, C, D.
    I want:
    A to equal 1
    B to equal 2
    C to equal 3
    D to equal 4
    E to equal 5
    Would someone be able to tell me how to set up the radio
    button so that the value of the radio button is stored into an
    array called SCORE.
    i dont need a tutor for arrays, i can do them, i just need
    help with the radio buttons so a reference to an array would be
    enough, eg how to store the answer from the radio button in an
    array.
    Thank you

    Place the radio buttons on the stage and set their parameters
    to what you need. Make sure that for each group of radio buttons
    you give them the same group name. Then you could use something
    like this:
    var listenerObject:Object = new Object();
    var answerArr:Array = new Array();
    listenerObject.click = function(eventObj:Object) {
    answerArr.push(eventObj.target.selectedData);
    trace(answerArr);
    radioGroup.addEventListener("click", listenerObject);
    radioGroup refers to the group name for the buttons.
    eventObj.target will refer to the actual radio button
    clicked.
    Tim

  • Need help with encore buttons - highlights

    Hi All
    I am seeking help with Encode CS5. I have a project working fine except that I dont have highlights for buttons, at least I think thats what its called. So when the mouse or remote control navigates up/down toa button it changes colour.
    In the properties of my button, the highlight option is greyed out.
    How do I apply highlights ?
    many thanks
    Chris Anderson

    Hi Bill
    Thanks for your reply.
    Here are 2 screen prints. One from encore the other from photoshop.
    First time I have inserted images, and they seem a little small on this message - if you have any problems reading I could email to you.
    I have highlighted the first button - which is called 'Highlights' - same issue with all the other buttons.
    Do you have to use photoshop to add highlighting? or can you do this in encore - i dont have much experience with photoshop.
    Not sure how to check 'Color Set' ? can you tell me how to get that for you - same for transparency for states? - I havent experienced them or changed them as I dont know how to
    Yes it was duplicated - have left a message not to reply
    Thanks again
    Chris

  • UWL - Help with Decision Buttons

    Hello SDNers,
    I'm customizing the UWL iView to show approval itens only, and their respective decision buttons.
    Everything looks ok, but when someone try to submit the decisions it shows the message:
    "reject wasn't correct"
    Where "reject" is the name I gave to the action.
    It also happens with the approval action.
    Below is the XML I've created.
    Does someone have a clue in what that message means, or what I've done wrong?
    Thanks in advance!!

    Hi There,
    Make sure that your decisionKeys are correct.  I have seen issues with this many times.  Log on to the backend system and call  SAP_WAPI_DECISION_READ or SWK_DECISION READ for a specific workitem  (You can get the details of the workitem id from the support information on the UWL - enable this and you can check this specific workitem)  The decision key is an internal value (typically a numeric value) corresponding to the selected decision used by the provider.
    You will need to ensure that you have x amount of decisions configured in the xml file, where x = the amount of decisions configured in the backend system.
    For additional help with this topic please see the userDecision Action Handler documentation:
    http://help.sap.com/saphelp_nw70/helpdata/en/7a/df014b037141ca9afc6433ed42b519/content.htm
    Beth Maben
    EP - Senior Support Consultant II
    AGS Primary Support
    Global Support Centre Ireland
    Please see the UWL Wiki @
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/bpx/uwl+faq  ***

Maybe you are looking for

  • Edit Image

    I recently added Adobe Acrobat 9.0 (standard) and want to know how to get "Edit Image" tool to appear?

  • The *.icc file is associated with PS process after assigning profile for a picture of CMYK mode ?

    Hi everyone, I have a curious problem for your help  My OS is Windows 7. Start PS and open an image, choose "Edit" -> "Assign Profile...", in the pop-up dialog there is a drop-down list showing many system profiles, and I find all of these *.icc file

  • Regarding Non-Cumulated Key figures

    Dear All, I wanted to create Multiprovider which includes infocube having Non-cumulative key figures .When I am including that Non-cumulative key figure in the Multiprovider , I am getting an error "Inconsistencies were found when checking MultiProvi

  • RV180W and server logs

    I updated my RV180W to the latest firmware and found that port forwarding works I started using it. I've just noticed that since changing over to the RV180W, my Apacher server logs show the router's IP address instead of the remote IP address - every

  • CS5 Bridge - Windows.  Can't delete old files

    I have no trouble deleting new files but have tried every method and old tif and psd files refuse to delete.  Can it be because files uploaded on CS3 can't be deleted using CS5?