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.

Similar Messages

  • Need help with linking buttons

    Can anyone help me with this problem I have.
    I have a gfx which I have created 6 shapes and converted them into simple buttons. I have urls sat inside an xml file. How can I get the buttons to use the urls set from within the xml file?
    Also how can I change the current external photo that is being loaded to load the url from a setting in the same xml file.
    I hope you arnt as confused as I am right now.
    I have packaged up the flash file which includeds the xml aswell.
    If anyone could help me out with this I would be very greatful.
    Thanks All
    http://www.onlineaddicts.co.uk/menu.rar

    Remove the code from all btns, as below paste it on main timeline
    Also no need to load xml twice as dome in image container...
    give an instance name to the outer container of btns - menumv
    use following method to openURL, use same for all the btns..
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    var myXML:XML;
    var myLoader:URLLoader = new URLLoader();
    myLoader.load(new URLRequest("links.xml"));
    myLoader.addEventListener(Event.COMPLETE, processXML);
    function processXML(e:Event):void
    myXML = new XML(e.target.data);
    trace(myXML);
    menumv.carbtn.addEventListener(MouseEvent.CLICK, openURL);
    function openURL(e:MouseEvent):void
    navigateToURL(new URLRequest(myXML.car.url));
    http://www.darshanrane.com

  • Please Help with linking buttons to media

    Hi,
    I'm creating a virtual tour of my site and i have a couple of
    things i'm stuck on. I've done an intro, and after that 6 buttons
    roll in which you can click on that open up videos. I need the end
    of the intro to now be 'frozen' or looped or something. How do i do
    that? I've worked out the action script so that you click on the
    button and the video plays, BUT how do i make the video invisible
    before you click the button? At the moment it's just on the screen.
    I also need each button to simultaneousy open up two mp3
    files...what's the action script for that? I've been using script
    assist and i'm stuck.
    Thank you.

    Hard to explain without seeing what you accomplished so far.
    For the intro either add a keyframe then add either a stop action
    or a gotoAndPlay action. For the video give the player an instance
    name, then use actionscript to make it invisible. There are
    tutorials on this forum for adding sounds to buttons:
    For the MP3 issue here are some tutorials (thanks Chris G):
    http://www.kennybellew.com/tutorial/
    and
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=194&threadid =1106533&highlight_key=y&keyword1=attach%20and%20sounds%20and%20button

  • 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>

  • How to use user defined object with linked button

    Hi experts
    Can I use user defined table data with linked button. If yes then how. plz give me sample examples.
    Regards
    Gorge

    If you have an UDO in your form, or any other, the FormDataLoad eventhandler should be used.
    Take care, it is not inside the eventhandler.
    for VB:
    Select SBO_APPLICATION in the classes, and select FormDataLoad event
    Private Sub SBO_Application_FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.FormDataEvent
    in C#
    Add a new eventhandler as
    // declaration
    SBO_Application.FormDataEvent += new SAPbouiCOM._IApplicationEvents_FormDataEventEventHandler(ref SBO_Application_FormDataEvent);
    // eventhandler:
    public void SBO_Application_FormDataEvent(ref SAPbouiCOM.BusinessObjectInfo BusinessObjectInfo, out bool BubbleEvent)

  • Anyone help with linking a bank account to your apple id. The form wants a phone number I only have a UK mobile number and it doesnt sem to want to accept it keeps l;ooping me back to entering a phone number.

    Anyone help with linking a bank account to your apple id. The form wants a phone number I only have a UK mobile number and it doesnt sem to want to accept it keeps l;ooping me back to entering a phone number.

    If you are trying to setup a charge card number on the Apple Store - make sure you are in the Correct country site - icon bottom right last time I saw it - where you can change country.  

  • Help with linking a button?

    Ok, so I'm making a small little choose your own adventure
    type game in flash, just using buttons to navigate between the
    screens, fairly simple. I have the first frame with two buttons,
    one links to start, the other links to info. the second button
    works fine. when i launch the start button, it takes me to a movie
    clip on the third frame. this clip plays till it gets to frame 75,
    where i have actionscript follows.
    getout.addEventListener(MouseEvent.CLICK, getoutclick);
    function getoutclick(e:Event):void {
    gotoAndPlay("home");
    getout is a labeled instance of a button in the library,
    which I want to take me to the next frame, but for the moment I
    just want it to replay so I know that it works, which is why it's
    linked to "home" now.
    Every time frame 75 loads, i get the following error.
    TypeError: Error #1006: addEventListener is not a function.
    at Symbol1/::frame75()
    I used the same method to link buttons on the first frame,
    and now it isn't working on this one. Any ideas?

    check Symbol1 for a stray line of code.

  • Trouble with Linking Buttons to Articles in Other Folios

    I am very new to DPS as in I just started working with it less than a week ago. My main problem now is linking buttons from one page in a Folio to another.
    My set up right now is this:
    I have a folio named "Cover" that has the landscape and protrait version of the articles.
    I have a button placed on the articles that I want to link from Cover to a folio named "Menu" which also has both orientations
    I understand the 'navto://', but I am not clear on how you connect folios of the same project.
    Reading through the Adobe tutorials definitely walks me through setting this up, but not how to make it all work together easily.
    Thank for any help.
    -Frank

    Your terminology is somewhat confusing.
    My best bet is that you want to link from a certain page in one article (e.g. "Cover") to a certain page in another (e.g. "Menu").
    If that's correct, then
    navto://Menu or navto://Menu#0
    will send you to first page of "Menu" article
    navto://Menu#1
    will send you to the second page of "Menu" article
    navto://Menu#2
    will send you to the third page of "Menu" article
    and so on...

  • Help with dynamic button click inside titleWindow

    Hi Everyone, Your Help is much appreciated
    I am building a flex application and I want the user to click
    on a button and send them to another website. Basically I am
    creating a tileList that holds thumbnails (created using item
    renederer) and on click a popup with the same image and button will
    be created. I get errors when I click the link button. This is what
    I have so far:
    // This is my custom item renderer
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    horizontalAlign="center"
    verticalAlign="middle">
    <mx:Image source="{data.@thumbnailImage}" />
    <mx:Label text="{data.@title}" />
    </mx:VBox>
    // My TileList
    <mx:TileList id="tileList"
    dataProvider="{xmlListCollection}"
    itemRenderer="CustomItemRenderer"
    maxColumns="4"
    columnWidth="140"
    rowCount="2"
    rowHeight="140"
    verticalScrollPolicy="off"
    horizontalScrollPolicy="off"
    itemClick="tileList_itemClick(event);" />
    // This is my code
    private function tileList_itemClick(evt:ListEvent):void {
    // Set the TitleWindow
    myTitleWindow = new TitleWindow();
    myTitleWindow.title = evt.itemRenderer.data.@title;
    myTitleWindow.width = 350;
    myTitleWindow.height = 600;
    myTitleWindow.showCloseButton = true;
    // Set the Image
    img = new Image();
    img.maintainAspectRatio = true;
    img.buttonMode = true;
    img.useHandCursor = true;
    img.source = evt.itemRenderer.data.@fullImage;
    img.addEventListener(MouseEvent.CLICK , image_click);
    //Set the Label
    myLabel = new Label();
    myLabel.text = evt.itemRenderer.data.@title;
    myLabel.setStyle("fontWeight","bold");
    // Here I set the Button but its not functioning
    var btn:Button = new Button();
    btn.label = evt.itemRenderer.data.@link;
    btn.buttonMode = true;
    btn.addEventListener(MouseEvent.CLICK,clickHandler);
    myTitleWindow.addChild(img);
    myTitleWindow.addChild(myLabel);
    myTitleWindow.addChild(btn);
    PopUpManager.addPopUp(myTitleWindow, this, true);
    PopUpManager.centerPopUp(myTitleWindow);
    // This is the Part I can't get it to work
    private function clickHandler(e:MouseEvent):void{
    var url:String = "
    http://" + data.@link;
    var myRequest:URLRequest = new URLRequest(url);
    navigateToURL(myRequest,'_blank');
    My xml looks like this
    <gallery>
    <image title="Image One"
    thumbnailImage="assets/big.jpg"
    fullImage="assets/small.jpg"
    link="www.google.com"
    description = "Search Google"/>
    </gallery>

    What error?
    Is your url being concatenated correctly? Trace it.
    Tracy

  • 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 assignment- buttons that control movie clips

    I am pretty new to flash and my professor gave us an assignment with little help or tutorials.
    He wants us to create a SWF that features a house and it's front yard and two buttons.
    One button that says Sunrise, and one that says Sunset.
    When I push the sunrise button, the sun needs to rise above the house and stay there.  When I push the Sunset button, it needs to set- and then a ufo needs to land on the lawn.
    So i think I have a pretty good grasp on the assignment, but the actionscript is throwing me off.  How can I make buttons that will control the sun movie clip to rise- stay above the house, and then set?  The ufo is a whole new matter.   The sunset button should make the sun lower and then a ufo land on the lawn.
    Please help explain/link me to the proper tutorials.   One thing that i'm worried about is that the sun will rise- and then stay above the house even if i click the sunset button.
    Your help is greatly appreciated.

    Well i can think of a few ways to do this.
    Depending on what you have been taught so far you should be able to do this if you know how to make a button, a movie clip, and the basic script for the timeline. ie. play,stop, gotoandplay etc.
    I understand you have been set a task and you want the answer straight away. But i doubt he would have given you anything you couldn't handle. Also I learnt more from trial and error and searching the net than from most of my teachers at coll and uni, It's frustrating i know, but the buzz you get when you finally crack it is amazing. Stick in there!
    That being said i remember the panic I suffered and like to help so here's a thought:
    You could just have the 2 buttons play a basic movie clip. The sky could rotate one way to make the sun rise and add a "stop" in the actions to make it stay there, and to the left to sunset with both images together but not being shown all the time by using a mask. You could even add in the ufo to the clip but this would only work if you added an extra part to the movie so that when the ufo has landed it flys out again and then begins to rotate the sun and moon again. ( buttons would be dissabled during the play modes to avoid chaos) This is just a quick thought. I'm sure there are several ways of doing this depending on how fancy it needs to be.
    If your teacher really has given you no notes on buttons,movieclips and actionscript i would sujest Adobe TV. Nice videos that explain step by step. OR try downloading a tutorial file with buttons and movie clips and look at the coding they use in the file. Thats how i have learnt most of it since finishing Uni.
    Good Luck
    Cobie

  • Help with linking files

    I have several projects with 1000's of little clips in them- that have become unlinked- normally I can just use link media and that resolves it, but it seems like there has been either name changes to them (numbering in project panel seems different) or pathway to my ext hard drive has changed-help appreciated!!!

    Are you on a Mac, or a PC?
    If PC, what OS version do you have?
    The easiest way to find out exactly how your version of Windows sets drive letters is to go to Help, then type in "drive letter," without the quotation marks in the query box. You will then get all references to drive letter, and choose Setting Drive Letter, or similar syntax. That will step you through the process, and probably even provide a link to the disc management utility for your version.
    If you are on a Mac, then it would be Volume Name, but I cannot help with anything more than that, being a PC-only guy.
    Good luck,
    Hunt

  • Help with linked files/ compound paths please

    Hi - I am working with an illustrator file from another designer which has a compound path with linked files - when you link a new file the image is automatically resized and clipped to the path.  I am able to edit it but i want to make my own from scratch and can't figure it out. I'm working with Illustrator CS6. Any help greatly appreciated. Thanks

    Hi Steve - thanks for the reply - my question was a bit vague as I wasn't entirely sure what I was working with but I think your point about the new linked image scaling to the same size as the existing file has helped me understand it a bit more.  What I want to know how to do is to make an entirely new file with a clipping mask that I then link an image to.  I made a file with a clipping mask on the page and then chose file>place but the image I import is not being clipped (I ticked the link option when importing it) I see it working with the existing file I'm working with but I need to know how to make a new one myself.
    If this makes it clearer here's what I want to do ...
    I am making a banner, I have 3 flat jpegs of t-shirts that I want to place on the banner without their white background.  I made a clipping mask the same shape as the outline of the t-shirt and now I want to import the jpeg so it is a linked file and is clipped by the clipping mask and so I can use it in future to import different t-shirt image in without scaling and clipping them each time.
    REally appreciate your help, thanks.

  • Problem with Link Button

    Hi
    I've got a linked button in a column within a matrix that shows Sales Order Document Numbers. I've set it to link to the Sales Order form using the following code:
            oColumn = oColumns.Add("OrderNum", SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON)
            oColumn.TitleObject.Caption = "Order Number"
            oColumn.Width = 200
            oColumn.Editable = False
            oLink = oColumn.ExtendedObject
            oLink.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_Order
    The problem I've got though is that if the Sales Order is created with a manually entered Document Number I get the following error when clicking on the linked button.:
    "You are not permitted to perform this action [Message 200-30]"
    I guess the reason it is happening is that the DocEntry and DocNum are different and the Linked Button is using the DocEntry as reference to which Sales Order needs to be opened when the linked button is pressed.
    Is there anyway to stop this from happening and for the Linked Button to function as normal even if the Sales Order has a manually entered document number? So is there a way to allow the Linked Button to link through to a Sales Order using the DocNum not the DocEntry?
    Steve

    Cheers mate. I've just tried setting using the PressLink property of the EditTextColumn object however it's not letting me set the EditTextColumn to the column I have in my matrix. The code I have is:
                                            Dim b As SAPbouiCOM.Column
                                            Dim oEditTC As SAPbouiCOM.EditTextColumn
                                            Try
                                                If pVal.Before_Action = False Then
                                                    oForm.Freeze(True)
                                                    oEditTC = oMatrix.Columns.Item("DocEntry")
                                                    oEditTC.Visible = True
                                                    oEditTC.PressLink(pVal.Row)
                                                    oEditTC.Visible = False
                                                    oForm.Freeze(False)
                                                End If
                                            Catch test As Exception
                                                MsgBox(test.Message)
                                            End Try
    The error I am getting is "Specified Cast Is Not Valid". The type of column I am trying to bind to is a "it_LINKED_BUTTON".
    Steve

  • 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

Maybe you are looking for