Help with buttons and AS3

I need urgent help for a college project, I've drawn a map and I have some photographs that appear on the map from the timeline one after another. I want the timeline to be activated when I press a Button On the map of where I've been on holiday but I have no Idea how to put it together.

While I can offer a couple ideas, you'll need to spend some time figuring out how to use Flash... maybe get some formal training with it.
For the photographs, create each set of them as a movieclip, and give each movieclip an instance name so that you can control its visibility using code.  Initially you will want to set the visible property of them all to false, likely done in the first frame of the timeline (ex: imageGrp1.visible = false; ).  Then you will use your buttons to make them visible.
To code one of the buttons, you need to assign it an instance name as well.  Then you need to assign an event listener for that button to detect when it gets clicked, and an event handler function to go with the event listener... the listener calls the function into action when the event occurs.
ex:
// the event listener for a button with an instance name of imgGrp1Button...
imgGrp1Button.addEventListener(MouseEvent.CLICK, showGrp1);
// and the event handler function for the CLICK listener
function showGrp1(evt:MouseEvent):void {
      imageGrp1.visible = true;
If you want to hide any visible set when you select a new one, then you can create a function that sets them all visible = false and call that function both at the start in frame 1 and in each button event handler function (before you set the selected set to be visible).

Similar Messages

  • Help with buttons in AS3

    Hi Folks,
    I'm stuck with a simple flash movie I need to create in which two images fade in and fade out, and each of them must be clickable and hyperlink to a separate URL.
    I've got the fading going okay, but I cannot for the life of me get even a single button to work on it.
    If it's helpful I can send along what I've got so far.  Any assistance would be greatly appreciated.
    Regards,
    Andrew.

    Hi Ned,
    Thank you for the followup email.
    I think I was close - I was aware of the changes between AS2 and AS3, but I
    think I was putting the Action in the wrong place.
    Next question - if I have 2 buttons (say btn1 and btn2), how do I make btn1
    available for say frames 1-60, and btn2 available from frames 61-120?
    I am primarily a ColdFusion developer, and a complete newbie to flash, so
    sorry if this is a dumb question.
    Regards,
    Andrew.
    2009/5/15 Ned Murphy <[email protected]>
    In AS3, to make a button work with code, you need to add an event listener
    for it.  In the timeline that holds that button, in a separate actions layer
    that you create, in a frame numbered the same as where that button exists,
    you would add the event listener:
    >
    btn1.addEventListener(MouseEvent.CLICK, btn1Click);
    >
    Descriptively, that line of code contains the following:
    >
    buttonInstanceName . displayObjectMethod (eventClass . eventType,
    eventHandlerFunction);
    >
    The name of the function for processing the clicking of that button was
    already defined at the end of the event listener assignment, so now you just
    have to write that function out:
    >
    function btn1Click(evt:MouseEvent):void {
       var /String = "http://www.awebsite.com/awebpage.html";
       var req:URLRequest = new URLRequest(url);
       navigateToURL(req);
    >

  • Hi there... I need a little help with buttons and their actions using flex builder 4.5

    I run a repo company and have zero experience in the developing applications and I could use some help from anybody that is willing to give it.... Here is a basic idea of what I need...  let's say there are 3 states... state 1 has a question that says "car you read this?" and a "yes" and a "no" button... when you select either answer, you go to slide 2.  Slide 2 with have a question like "Is the sky brown?" and a "yes" and a "no" button and when either button is selected, you are taken to Slide 3.  Slide 3 needs to be some sort of a text form that is created by the user selecting the buttons and the screen would say something like "yes, i can read this.  no, the sky is not brown", or "no, I can't read this.   yes, the sky is brown" .  I know how to get the buttons to take the user to the correct new slide, but I do not know how to get the buttons to insert specific text somewhere else when any button is selected.... Can anybody help me?  Youtube is only getting me so far, and my kids are driving me nuts while I'm trying to figure this monster out...  I've gotten several slides created and some screens have several buttons, I just need to see what I need to put in the code to get it to do this type of function 

    Also where can I read up on setting my .Xdefaults and xmonad.hs file? I ripped someones from this forum, and it works nice, but I want to make my onw, but cant find any decent documentation. Thanks.
    At the moment, the best source for configs are those posted in the screenshots thread (for both Xdefaults and xmonad.hs), the xmonad config archive (and the available docs from the root page on that site), and our own thread.  Unfortunately you'll have to sort of scrounge for good docs on the xmonad.hs at the moment, since most of the information was written for the 0.4 version of xmonad.  The configuration has since been made MUCH simpler.
    Hope that helps some.

  • NEED HELP WITH BUTTONS IN AS3!!

    Hello, I am stumped with an action scripting problem. I'm
    trying to create a really basic website in flash using buttons to
    jump from scene to scene. Let's say I want to do something as
    simple as make scene 1 jump to scene two right? I'll place in my
    scene 2 button on my first page:
    But instead of the scene changing to the next scene after I
    press the button, these errors come up!!
    1180: Call to a possibly undefined method on.
    1120: Access of undefined property release.
    1120: Access of undefined property _root.
    I've tried asking in so many different forums, I usually do
    pretty good with action scripting for buttons. But this is my first
    time doing it with cs3. I'm utterly confused, someone please help!!
    Thank you.
    The code on this page is the code I was using to try to
    change scenes...Oh! and whenever I try to put a code in the actual
    button, it won't let me. I just get a message that says something
    like "Can't have any actions applied to it".

    foxxpop,
    > But instead of the scene changing to the next scene
    > after I press the button, these errors come up!!
    >
    > 1180: Call to a possibly undefined method on.
    > 1120: Access of undefined property release.
    > 1120: Access of undefined property _root.
    You're using three terms that aren't supported in
    ActionScript 3.0: the
    on() function, the release parameter to that function, and
    _root. In
    ActionScript 3.0, you'll have to give your button an instance
    name and wire
    it up like this:
    http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3
    In that blog entry, you'll see (with explanation) something
    that looks
    like this:
    myButton.addEventListener(
    MouseEvent.CLICK,
    function(evt:MouseEvent):void {
    trace("I've been clicked!");
    Just bear in mind that you can also make that a named
    function, like
    this:
    myButton.addEventListener(MouseEvent.CLICK, clickHandler);
    function clickHandler(evt:MouseEvent):void {
    trace("I've been clicked!");
    > I've tried asking in so many different forums, I usually
    do
    > pretty good with action scripting for buttons. But this
    is
    > my first time doing it with cs3.
    Your issue isn't Flash CS3, it's that your FLA file is
    configured for
    ActionScript 3.0. If you change that to AS2, you can go right
    on using the
    same approach you used to -- and you'll be able to attach
    code directly to
    objects. ;)
    David Stiller
    Co-author, The ActionScript 3.0 Quick Reference Guide
    http://tinyurl.com/2s28a5
    "Luck is the residue of good design."

  • Help with buttons and hovering over them

    Hey all,
    I'm having trouble with a certain portion of code that I can't seem to get. What I want to do is display some sort of text when I hover the mouse over a specific button. I do not want to do this with a tool tip as there are other issues with using that method. So I need to print out something onto a JLabel whenever the JButton has the mouse over it. The catch is, the button may or may not have the current focus. How would I go about doing this? I have worked on it for a couple hours now and cannot figure it out. Thanks for the help.

    how would i differentiate between each specific button that has this listener? what i mean is i have about 8 different buttons that i want to do this for, so would the code go like this:
    public void mouseEntered(MouseEvent me) {
           if( me.getSource().getComponent() == myButton){
                     System.out.println("Just a test");
    }i'm not near a compiler currently but i think that is correct. or am i wrong?

  • Help with buttons and graphics

    ok all I get on this is about a hundred runtime errors starting with NullPointerException.
    public class Ers2View extends FrameView{
    Image image;
    static Paint paint;
    public Ers2View(SingleFrameApplication app) {
    super(app);
    initComponents();
    slapButton = new javax.swing.JButton();
    slapButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    slapButtonActionPerformed(evt);
    private void slapButtonActionPerformed (java.awt.event.ActionEvent evt) {                                          
         Graphics g= image.getGraphics();
         Paint rect=new Paint();
         Paint.paint(g);
    (new file)
    package ers2;
    import java.awt.Graphics;
    public class Paint{
    public static void paint(Graphics g) {
         g.drawRect (10, 10, 200, 200);
    ok guys comon I really need help on this one. Im using netbeans btw.

    AndrewThompson64 wrote:
    >
    No i know where the problem is but i have no idea how to fix it. I think part of the problem is that I never tell it to draw on the JPanel. But Netbeans makes weird code so im not sure how to make the drawRect command implemented on the panel.>
    - People about these parts comment on Java problems, not Netbeans problems. Netbeans has its own [forums for Netbeans problems|http://forums.netbeans.org/] (<- link), try them.
    - As far as the Java code goes, you will get a much better chance of help if you..
    a) Post an SSCCE (<- link), rather than random code snippets that you think encapsulate the problem. Let's face it, you don't know the answer, and until you do, you cannot be sure the fix is to be found in the code snippets you post. Can you?
    b) Post code in between code tags to retain the formatting and indentation. To do that, select the code and click the CODE button on the Plain Text tab of the message posting form.Easy there tiger, this is not a netbeans problem, so he is in the right place.
    The code does look to be SSCCE or close anyways (remove the ... lines and if it still compiles and run I would say this is SSCCE).
    The code tags is a huge problem here though. I am trying to read it without getting a headache, best as I can tell the OP seems to be doing some really funny stuff with paint. Like is he overriding paint to paint a square? That can't be good!
    JSG

  • Need help with button and motion tween...

    I'm trying to create a simple game. Right now I have one button that when clicked moves the character across the screen. My issue is trying to make the player stop looping after I click the button. If I just insert stop for the last frame it will only loop once and stop, but it will not play again after the button is clicked. I've tried using players_turn boolean but couldn't get that to work. Any help will be appreciated. Thanks!
    [AS]
    package
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        import flash.events.KeyboardEvent;
        import flash.ui.Keyboard;
        import flash.events.Event;
        import flash.ui.Mouse;
        public class Main extends MovieClip
            //Player variables
            var players_turn:Boolean = true;
            //Enemy variables
            public function Main()
                //Add event listeners
                buttonAttack.addEventListener(MouseEvent.CLICK, onButtonAttackClick);
            //Event handlers
            function onButtonAttackClick(event:MouseEvent):void
                if (players_turn == true)
                    //Player attacks enemy
                    player.gotoAndStop(2);
                    trace("attack");
                    trace(players_turn);
            //trace(players_turn);
            /*if (players_turn == false)
                player.stop();
                players_turn = true;
    [/AS]

    player is a symbol that is classic tweened. It has to frames. The first is a still frame with a stop action. The second has been converted as a symbol to show the player move across the screen and back.   When the attack button is clicked the player moves across the screen and back but it keeps on looping. If I add a stop action to the last frame it will move and comeback and stop but it will not move anymore when the button is clicked again.

  • Need help with buttons and fading clips

    howdy,
    I have 3 buttons on a stage that play 3 different movies.
    While no button is pressed, there is a looping video on the stage
    playing. When a button is pressed, that looping movie needs to fade
    out and fade in the movie that button calls for. I have attached
    script but it isn't working at all. Not sure where to go from here.
    thanks for your help.

    Hello again,
    Now I'm completely lost. Where should I add that code in your
    last post?
    thanks.

  • Help with buttons and timing

    I have four buttons, each with an advanced action.  Only the first one works.  I know it's related to the button timing, but I can't figure out how to fix it.

    Let's try some troubleshooting 101.  Remove the complexity to isolate the issue.
    Try setting each button just to have a Continue action again and test. This will show whether the problem is with the buttons or with the Advanced Actions you've assigned to them.
    If the buttons work fine with Continue actions, try dragging your first button off the stage area into the scrap area and then test the slide again.  If the button that is first in line NOW works, but others don't, then I would look at these advanced actions carefully because there may be something in the logic that is fouling things up. 
    For example, standard actions do not release the playhead unless you also add an extra Continue action line, whereas Conditional Actions do not require this same Continue action.
    Rod Ward
    http://www.infosemantics.com.au/troubleshoot-adobe-captivate

  • Help with buttons :S

    hi all,
    i'm new to flash but i have an idea whats going on with webpages. I need some help with buttons! i have a website and its has a stage and 9 different flv's (screens). I've been trying to read online and i can't find out how to navigate to different screens, example below
    home          |            |
    about us     |  stage   |
    contact       |            |
    you click one one button it updates the stage. also i'm using actionscript 2.0.
    thanks for any help ahead of time
    Thank you,

    Is it a wi-fi or cellular connection that isn't working?  If its wi-fi and other people/computers/phones can connect check your settings.  If its cellular, are other people's phones (on the same carrier) working in the same location? If other people can't connect then it is likely a network problem.  If others can you may need to reset/restore you iPhone.

  • Help with writing and retrieving data from a table field with type "LCHR"

    Hi Experts,
    I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
    Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
    Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
    Thanks in advance,
    C
    SAVING THE LIST DATA TO DB
    DATA: L_WA(800).
    LOOP AT T_TAB into L_WA.
    ZDBTAB-DATALEN = STRLEN( L_WA ).
    MOVE: L_WA to ZDBTAB-RAWDATA.
    ZDBTAB-LINENUM = SY-TABIX.
    INSERT ZDBTAB.
    READING THE DATA FROM DB
    DATA: BEGIN OF T_DATA,
                 SEQNR type ZDBTAB-LINENUM,
                 DATA type ZDBTAB-RAWDATA,
               END OF T_TAB.
    Select the data.
    SELECT linenum rawdata from ZDBTAB into table T_DATA
         WHERE repid = w_repname
         AND rundate = w_rundate
         ORDER BY linenum.
    Populate calling Internal Table.
    LOOP AT T-DATA.
    APPEND T_DATA to T_TAB.
    ENDLOOP.

    Hi Anuj,
    The unicode flag is active.
    When I run our report and then to try and save the list data a dump is happening at the following point
    LOOP AT T_TAB into L_WA.
    As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
    When I try to load a saved list the dump is happening at the following point
    APPEND T_DATA-RAWDATA to T_TAB.
    T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
    In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
    Regards
    C

  • I use iphone 3GS, after upgared to ios5, my phone restart when i took picture with   button and while playing music .. what happened?

    I use iphone 3GS, after upgraded to ios5, my phone restart when i took picture with   button and while playing music .. what happened?

    Basic troubleshooting steps in the following order.
    1. Reset. Press and hold both Power and Home Buttons together till Apple Logo appears.
    2. Restore to a backup.
    3. Backup, Restore in iTunes and setup as new.

  • Help with count and sum query

    Hi I am using oracle 10g. Trying to aggregate duplicate count records. I have so far:
    SELECT 'ST' LEDGER,
    CASE
    WHEN c.Category = 'E' THEN 'Headcount Exempt'
    ELSE 'Headcount Non-Exempt'
    END
    ACCOUNTS,
    CASE WHEN a.COMPANY = 'ZEE' THEN 'OH' ELSE 'NA' END MARKET,
    'MARCH_12' AS PERIOD,
    COUNT (a.empl_id) head_count
    FROM essbase.employee_pubinfo a
    LEFT OUTER JOIN MMS_DIST_COPY b
    ON a.cost_ctr = TRIM (b.bu)
    INNER JOIN MMS_GL_PAY_GROUPS c
    ON a.pay_group = c.group_code
    WHERE a.employee_status IN ('A', 'L', 'P', 'S')
    AND FISCAL_YEAR = '2012'
    AND FISCAL_MONTH = 'MARCH'
    GROUP BY a.company,
    b.district,
    a.cost_ctr,
    c.category,
    a.fiscal_month,
    a.fiscal_year;
    which gives me same rows with different head_counts. I am trying to combine the same rows as a total (one record). Do I use a subquery?

    Hi,
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    user610131 wrote:
    ... which gives me same rows with different head_counts.If they have different head_counts, then the rows are not the same.
    I am trying to combine the same rows as a total (one record). Do I use a subquery?Maybe. It's more likely that you need a different GROUP BY clause, since the GROUP BY clause determines how many rows of output there will be. I'll be able to say more after you post the sample data, results, and explanation.
    You may want both a sub-query and a different GROUP BY clause. For example:
    WITH    got_group_by_columns     AS
         SELECT  a.empl_id
         ,     CASE
                        WHEN  c.category = 'E'
                  THEN  'Headcount Exempt'
                        ELSE  'Headcount Non-Exempt'
                END          AS accounts
         ,       CASE
                        WHEN a.company = 'ZEE'
                        THEN 'OH'
                        ELSE 'NA'
                END          AS market
         FROM              essbase.employee_pubinfo a
         LEFT OUTER JOIN  mms_dist_copy             b  ON   a.cost_ctr     = TRIM (b.bu)
         INNER JOIN       mms_gl_pay_groups        c  ON   a.pay_group      = c.group_code
         WHERE     a.employee_status     IN ('A', 'L', 'P', 'S')
         AND        fiscal_year           = '2012'
         AND        fiscal_month          = 'MARCH'
    SELECT    'ST'               AS ledger
    ,       accounts
    ,       market
    ,       'MARCH_12'          AS period
    ,       COUNT (empl_id)       AS head_count
    FROM       got_group_by_columns
    GROUP BY  accounts
    ,            market
    ;But that's just a wild guess.
    You said you wanted "Help with count and sum". I see the COUNT, but what do you want with SUM? No doubt this will be clearer after you post the sample data and results.
    Edited by: Frank Kulash on Apr 4, 2012 5:31 PM

  • MOVED: [Athlon64] Need Help with X64 and Promise 20378

    This topic has been moved to Operating Systems.
    [Athlon64] Need Help with X64 and Promise 20378

    I'm moving this the the Administration Forum.  It seems more apporpiate there.

  • I have problems with buttons and Forms in my trial proof of Indesign CC, how can I fix it?

    I have problems with buttons and Forms in my trial proof of Indesign CC, how can I fix it?

    Moved to InDesign forum.
    You can start by telling us what the problem is.

Maybe you are looking for