Need help writing correct code for nested button

This is the code on the main timeline.
stop();
garage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
    gotoAndPlay("open");
The movieClip gDoor is nested inside of garage and "open" is a label on that timeline.  I know the gotoAndPlay("open"); isn't correct.  How would i target the label on the nested timeline.
the link below is to dowload the fla
clienttestsite.x10.mx/beta/garage.fla

The problem is that you have an event listener assigned to the garage, which is blocking/overriding interaction with anything inside of it.  When you click on the chest's button, you are still clicking on the garage, which does the gotoAndPlay("open")... where it stops at the stop();
One way to get around this is to assign an instance name to the door and assign the opening code to that....
stop();
garage.door.addEventListener(MouseEvent.CLICK, openHandler);
function openHandler(event:MouseEvent):void{
   garage.play();
garage.chest.closeBtn.addEventListener(MouseEvent.CLICK, closeHandler);
function closeHandler(event:MouseEvent):void{
   garage.gotoAndPlay("close");
Notes: as shown in the code above...
- use CLICK instead of MOUSE_DOWN.
- in the openHandler use play() instead of gotoAndPlay("open"). You are already in the "open" frame, and it is only because the stop() is used up that it actuallys works.
Doing what I explain above also makes it so that you can click the door to close things as well.

Similar Messages

  • Need help to write code for 'Print" button......!

    Hi all,
    I am working in oracle forms 6i.I am creating forms for ordering product/quantity(Entering quantity/product details). In my form i have "Print button" to print the quantity details which is in multi-record block(database item).Please help me of how to write code for print button. If u had any source code please post it.
    Please help asap......!
    Thanks
    regards,
    jame

    You haven't got an answer or a reply because this question is asked so many times.
    Why don't you search the forum to find them?

  • Need help writing a code for this program

    Design a code that reads a sentence and prints each individual word on a different line

    tsith's suggestion is excellent. Run it and see what happens. I just did that myself and doing so I learned something new about the Scanner class.
    Before you run it, add a couple of extra System.out.println for (hopefully) illustrating debugging purposes:
    import java.lang.String;
    import java.util.Scanner;
    public class Sentence {
        // main line of program
        public static void main(String[] args) {
            boolean z;
            String a;
            Scanner keyboard = new Scanner(System.in);
            System.out.print("Enter sentence: ");
            z = keyboard.hasNext();
            while (z) {
                System.out.println("z = " + z + ". Fetching the next word...");
                a = keyboard.next();
                System.out.println(a);
            System.out.println("Done!");
    }Let us know if the program ever prints "Done!" to the console. While you are waiting, read what the javadocs has to say about the Scanner class, and pay extra attention to what it says about the hasNext() and next() methods:
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html

  • Need help writing a query for following scenario

    Hi all, I need some help writing a query for the following case:
    One Table : My_Table
    Row Count: App 5000
    Columns of Interest: AA and BB
    Scenario: AA contains some names of which BB contains the corresponding ID. Some
    names are appearing more than once with different IDs. For example,
    AA BB
    Dummy 10
    Me 20
    Me 30
    Me 40
    You 70
    Me 50
    Output needed: I need to write a query that will display only all the repeating names with their corresponding IDs excluding all other records.
    I would appreciate any input. Thanks

    Is it possible to have a records with the same values for AA and BB? Are you interested in these rows or do you only care about rows with the same value of AA and different BB?
    With a slight modification of a previous posting you can only select those rows that have distinct values of BB for the same value of AA
    WITH t AS (
    SELECT 'me' aa, 10 bb FROM dual
    UNION ALL
    SELECT 'me' aa, 20 bb FROM dual
    UNION ALL
    SELECT 'you' aa, 30 bb FROM dual
    UNION ALL
    SELECT 'you' aa, 30 bb FROM dual
    SELECT DISTINCT aa, bb
      FROM (SELECT aa, bb, COUNT(DISTINCT bb) OVER(PARTITION BY aa) cnt FROM t)
    WHERE cnt > 1;

  • Need help with LabVIEW code for motor control.

    Hi,
    My name is Sasi. I am a BME grad student working on my thesis topic of evaluating spine implants for low back pain. For this I am building a test machine that would apply pure moments to a spine specimen. I am using LabVIEW 8.5 to implement control of a brushless AC servo motor. My requirement is,
    Step 1: Initialize the motor.
    Step 2: Start moving it at a uniform RPM to the right (This RPM value too user can enter).
    Step
    3: While doin Step 2; simultaneously read torque cell data (Using DAQ
    asst.). DAQ o/p is from 0 V to 10 V; 0 V being -10 Nm n
                10 V being  +10 Nm
    Step 4: When Torque value reaches +10 Nm, i.e 10 V, the motor stops.
    Step
    5: From the position where motor stopped (i.e no need to reset to
    initial position) Start moving in the opposite direction at the same
                uniform RPM as in Step 2 while reading torque cell data.
    Step 6: Once again when torque reaches -10 Nm, i.e. 0 V, the motor should stop.
    Step 7: Repeat 'Step 2' to 'Step 6' 3 times.
    Step 8: Reset motor postion.
    Till now I have managed to get the motor to move forward n backward @ a desired vel, accl, n deceleration for 3 cycles. I am attaching my code. I am having problem inserting the code for reading DAQmx amidst all this. Can anyone help me out.
    Thnks,
    Sasi.
    Solved!
    Go to Solution.
    Attachments:
    Test_012609.vi ‏35 KB

    Hi Sasidhar,
    I took a look at your problem and I think I have a workable solution for you.  I definitely agree with Lynn's suggestion of using parallel loops.  This will allow the DAQmx portion to run uninhibited by the motion portion, and vice versa.  Plus, you only need to iterate the motion loop whenever the voltage level crosses a threshold.  So, by iterating on the motion code in the same loop that you are iterating on DAQmx code, you are essentially wasting processor.
    I created a VI that should do what you are wanting.  I tested it out myself and it works great.  You might have a tweak a few things to apply to your system (like motion board ID and DAQmx physical channel, etc.).  I used two parallel loops and event-based programming.  Basically the motion loop starts the motor spinning at the specified velocity.  Once the motor is spinning, it waits for the DAQmx loop to tell it that the voltage value has crossed the threshold.  When the voltage value exceeds the maximum threshold (which I set to a value slightly less than 10 to allow for jitter and saturation), the DAQmx loop signals the motion loop that it can finish its iteration.  The motion loop stops the motion, reverses the direction, and starts the motion again.  Once motion has started, it again waits for the DAQmx loop to tell it that a threshold has occurred, but this time, it is looking for a minimum threshold.  I used "Occurrences" to implement the event-based programming in LabVIEW.
    I have commented the code rather thouroughly, so hopefully the comments will answer any remaining questions.  The benefit of using event-based programming for this is that you save processor time, and your motion is more closely synchonized with the DAQmx.  Instead of iterating the motion loop as fast as you can, checking for updates each time, you just pause it, and wait for the other loop to tell you when to start up again.  In the mean time, the processor doesn't have to worry about iterating that loop over and over again.  Also, when the occurrence does occur, you catch it immediately, instead of having to wait until the next iteration.  Thus, you are more closely synchronized with the DAQmx portion of the code.
    I hope this will help you.  Please post back if you have any questions about the code or its implementation.  Good Luck!
    Message Edited by Wes P on 02-03-2009 05:18 PM
    Wes P
    Certified LabVIEW Developer
    Attachments:
    Motion and DAQ.vi ‏59 KB
    DAQmx Loop.png ‏24 KB
    Motion Loop.png ‏17 KB

  • Need help with Labview code for DAQmx

    I'm currently trying to write Labview code for some thesis research and am having problems.  I'm using the cDAQ 9172 with strain gage modules and two voltage input modules.  I'll be reading/recording a voltage from an external source on one channel, while recording strains and accelerations with the other channels.  I need to do all this simultaneously.
    Everything I've done to this point has been in SignalExpress so I'm not sure how to program any of this.  I also need to be able to calibrate the strain gages prior to each set of recordings.  Any help you guys could offer would be greatly appreciated.  Thanks.

    Hi,
    I'm not sure how much this will help you, but I've attached a screen dump of code from a project I did that sounds pretty similar to what you're working on. The code is from a subVI that I used to create the daqMX measurement task for my data acquisition. I was also using a 9172. This was written in 8.5, but the only thing that you may not have access to is the functions for null offset and shunt cal of the strain gage channels. Hopefully this will at least get you started on your way to setting this up.
    Andrew Carollo
    Attachments:
    create task.jpg ‏208 KB

  • Need help writing Java Code

    Hi everyone, I don't know if I am in the right forum, but I am new in writing Java coding and I am confuse on what to do and how to write the code.
    I have this question and I just dont know what to do:
    How can I write a java code in the following question?
    The question:
    40 hours normal salary
    After the 40 horas, you will pay an addition 1.5 hours
    Display the total salary.
    how to I write a code for this? Thank you in advance. I know this may be very simple to you but its very hard to me. Thanks again... :)

    hi i think this is what your looking for you didnt really make it to clear but here it is anyway hope it helps
    class Hours
    public static void main (String [] args)
    //declare variables
    double hours;
    double overtime;
    double totalhours;
    System.out.println ("Enter hours worked");
    hours = Console.readDouble ();
    overtime = 1.5;
    if (hours > 40)
    totalhours = overtime + hours;
    System.out.println("You are entitled to an additional 1.5 hours");
    System.out.println("Your total hours are" + totalhours);
    else
    System.out.println ("Total hours worked are " + hours);
    }//end main
    }// End hours

  • Need help in simple code for LayeredPane

    Hi,
    here is my simple code for displaying layered pane,
    why is it not working, when i comment label.setBounds();
    also is there a way to have a transparent layer, like
    what i want to do it
    have ont JPanel with some painting on it
    then i want to add one more JPanel over it which is transparent
    Ashish
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TestLayeredPaneFrame extends JFrame
         public TestLayeredPaneFrame()
              super("layered pane");
              this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              JLayeredPane layeredPane =new JLayeredPane();
              layeredPane.setPreferredSize(new Dimension(400,600));
    int x = 30;
    int y = 30;
    for (int i = 0; i < 3; i++) {
    x +=30;
    y +=30;
    origin.x += offset;
    origin.y += offset;
    layeredPane.add(new myLabel(x ,y ), new Integer(i));
              Container contentPane = this.getContentPane();
              contentPane.add(layeredPane, BorderLayout.CENTER);
              JPanel panel = myGlassPane();
              this.setGlassPane(panel);
              setSize(new Dimension(800,600));
              this.setVisible(true);
         private JLabel myLabel(int x, int y)
         JLabel label = new JLabel("My Name");
    label.setVerticalAlignment(JLabel.TOP);
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setOpaque(true);
    label.setBackground(Color.BLUE);
    label.setForeground(Color.black);
    label.setBorder(BorderFactory.createLineBorder(Color.black));
    label.setBounds(x, y, 140, 140);     
    return label;     
         public static void main(String args[])
    TestLayeredPaneFrame tlp = new TestLayeredPaneFrame();
    }     

    Hi,
    here is my simple code for displaying layered pane,
    why is it not working, when i comment label.setBounds();
    also is there a way to have a transparent layer, like
    what i want to do it
    have ont JPanel with some painting on it
    then i want to add one more JPanel over it which is transparent
    Ashish
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TestLayeredPaneFrame extends JFrame
         public TestLayeredPaneFrame()
              super("layered pane");
              this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              JLayeredPane layeredPane =new JLayeredPane();
              layeredPane.setPreferredSize(new Dimension(400,600));
    int x = 30;
    int y = 30;
    for (int i = 0; i < 3; i++) {
    x +=30;
    y +=30;
    origin.x += offset;
    origin.y += offset;
    layeredPane.add(new myLabel(x ,y ), new Integer(i));
              Container contentPane = this.getContentPane();
              contentPane.add(layeredPane, BorderLayout.CENTER);
              JPanel panel = myGlassPane();
              this.setGlassPane(panel);
              setSize(new Dimension(800,600));
              this.setVisible(true);
         private JLabel myLabel(int x, int y)
         JLabel label = new JLabel("My Name");
    label.setVerticalAlignment(JLabel.TOP);
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setOpaque(true);
    label.setBackground(Color.BLUE);
    label.setForeground(Color.black);
    label.setBorder(BorderFactory.createLineBorder(Color.black));
    label.setBounds(x, y, 140, 140);     
    return label;     
         public static void main(String args[])
    TestLayeredPaneFrame tlp = new TestLayeredPaneFrame();
    }     

  • Need help in the code for updating a record ( conditional update)

    all set
    Edited by: 871431 on Jul 9, 2011 6:30 PM

    871431 wrote:
    Hi
    I am looking to update a table which contains approved & unapproved records, for that date & fund combination it should allow only one unapproved record.
    what I did is check if the record is U if the incoming value is Unapproved for that fund & date combination raise error, but if I need to update that Unapproved record it raises error....so I need to update that record, and raise error if trying to insert another unapproved record.
    Hope I am clear....Not clear for me
    Help needed plsPlease realize & understand that everyone here speaks SQL
    please post DDL for table
    please provide sample/test data & then explain using actual test data what the results should be & why

  • Need help with html code for password logins

    I'm building a site and need to have a login page where multiple users can have unique usernames and passwords and then all be redirected to the same page within the same website.  Does anyone have any code advice or tips on how this can be done in iweb.  I getting stuck at the point in the code where I have to enter the site to be redirected to upon entering the correct username and password.  I would greatly appreciate any advice or tips.  Thanks

    Its done on the server rather than in iWeb....
    http://www.iwebformusicians.com/iWeb/Comments-Password-Protect.html

  • Need help with correction inscript for duplication on regular basis

    Hi,
    I am using Oracle 10.2.0.4 on Win 2008 R2. We have Archive mode enabled and no rman catalog is used. I have a requirement where i have to duplicate prod sevrer on regular basis to development server.
    I have created few batch files so that the entire process in automated. Stored all the scripts in c:\script\clone\ directory.+
    I have taken the backup copy of password and spfile from prod server and copied to the development server in same location.
    These are the scripts i run in order:
    *1_clone.bat*
    set ORACLE_SID=orcl
    sqlplus / as sysdba @c:\script\clone\2_test.bat
    *2_test.bat*
    shutdown immediate
    startup nomount
    host rman target sys/oracle@live nocatalog auxiliary / @c:\script\clone\3_rman.rcv
    *3_rman.rcv*
    run {
    allocate auxiliary channel d1 type disk;
    duplicate target database to ORCL NOFILENAMECHECK;
    exit
    When the duplication process in about to finish, i get below error:
    contents of memory script:
    shutdown clone;
    startup clone nomount;
    executing Memory Script
    RMAN-03002: failure of duplicate DB command at 07/31/2012 08:02:21
    RMAN-03015: error occured in stored script memory script
    RMAN-06136: Oracle error from auxiliary database: ORA-01013: user requested cancel of current operation
    Recovery Manager complete
    SQL>
    When i press exit, this window closes and i can run the alter database open resetlogs;+ command from a new sql prompt. I check online and some suggest there might be a window open with system user connected. Please suggest any changes in the script.
    Best Regards,

    Hello;
    Having another session with system user will cause rman to throw this error. For example another session used to start up database in nomount mode still being active.
    Duriing the cloning process the rman session needs to be exclusively connected to the auxiliary instance (no other session are allowed).
    Duplicate post
    request for help with rman cloning script
    Best Regards
    mseberg
    Edited by: mseberg on Jul 31, 2012 5:02 AM

  • Need help getting a code for photoshop

    I have had Adobe Photo Album Starter Edition 3.2 on my computer sinse 2007. and it has been registered . but every once in awhile it would say it is not registered but it still let me look at my pictures so i didnt worry about it. now it is doing it and i reregistered it again but this time it wont let me look at my pictures untill i enter a code that was spose to be emailed to me. it has been days now of me trying and i still am not getting no emails with a code, and i cant look at my pictures, and i had adobe erase my chip after it was done downloading. So those are the only copy i have of those pictures. Can you help me ? send me a doe to unlock it or something, please .....

    PS Starter is long a dead product. Whatever automatisms were in place to provide activation codes ondoubtedly no longer exist. As Wade said, contact support directly. Though I'm pretty certain they can't help you, either. Simply use anotehr image viewer/ editing program like PSE.
    Mylenium

  • NEED HELP WITH REDEEMING CODE FOR OS LION!

    im running 10.6.8 and im trying to update to Lion , im qualifyed to update free apple has sent me a code to redeem on the mac app store but i says " the code you have entered is not recognised as a valid code."
    PLEASE HELP!

    IVE DONE IT, IF YOUR USING HOTMAIL EMAIL - CLICK DOWNLOAD ON THE ABOVE YOU MESSAGE AND A LINK SHOULD APPEAR, YOU SHOULD HAVE GOT ANOTHER EMAIL SAYING YOUR CODE - COPY AND PASTE THE CODE YOU GOT INTO THE LINK AND CLICK NEXT OR SOMETHING, THEN YOU SHOULD GET ANOTHER CODE AND GO TO MAC APP STORE ON YOUR LEFT YOU SHOULD HAVE "QUICK LINKS" AND UNDER THAT YOU SHOULD HAVE REDEEM CLICK THAT AND TYPE IN THE CODE YOU GOT FROM THE LINK THEN YOUR DONE!
    Ps. if you did not get the email check your junk/spam folders.

  • Need help writing startupItem/launchd for dansguardian

    Hey there,
    i want to write a startupitem for dansguardian (or should i use launchd?).
    i am quite new to this stuff, but thinking positive! the problem is i don't really know which file exactly starts dansguardian. there is a unix-executable in usr/local/sbin/dansguardian which i can use to start dansguardian through
    sudo /usr/local/sbin/dansguardian
    in terminal. without sudo it won't work, i then get a message saying
    vierstein$ /opt/local/sbin/dansguardian; exit
    Unable to setgid()
    logout
    i can manage dansguardian through a webinterface called webmin and i can easily start and stop it there through a link.
    i did not figure out yet how the dansguardian webmin module starts/stops it and which files/commands it uses to do that..
    how can i write a startup script for dansguardian, because doing it manually is a bit laborious. i am a bit desperate here, have been trying so many things during the last two days and i'm really stuck. hopefully somebody here knows a way to do this.
    the following code I put in a file called DansGuardian in /Library/StartupItems/Dansguardian - the file is a unix-executable
    #! /bin/sh
    # DansGuardian Filter
    . /etc/rc.common
    StartService ()
    if [ "${DGSQUID:=-NO-}" = "-YES-" ]; then
    CheckForNetwork
    if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi
    ConsoleMessage "Starting DansGuardian Content Filter"
    /usr/local/sbin/dansguardian -s
    fi
    StopService ()
    /usr/local/sbin/dansguardian -q
    RestartService ()
    /usr/local/sbin/dansguardian -r
    RunService "$1"
    my StartupParameters.plist file in the same folder says
    Description = "DansGuardian Content Filter";
    Provides = ("Content Filter");
    Requires = ("Web Proxy");
    OrderPreference = "None";
    after rebooting i get this in console
    SystemStarter[55]: The following StartupItems were not attempted due to failure of a required service:
    SystemStarter[55]: /Library/StartupItems/DansGuardian
    it would be great if somebody here knew how to do this right

    in case somebody else is looking for an answer on this, here is the working launchd script. i did not write it myself though..
    put the following code in
    /Library/LaunchDaemons/org.dansguardian.dansguardian.plist
    change the "Program" string to point to your binary, and the "WatchPaths" as well. The way this one works is that it waits until Squid is launched before it starts. That's what the WatchPath does - it looks for Squid's PID file to be created, and then launches DansGuardian.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>org.dansguardian.dansguardian</string>
    <key>Disabled</key>
    <false/>
    <key>UserName</key>
    <string>root</string>
    <key>GroupName</key>
    <string>nogroup</string>
    <key>Program</key>
    <string>/opt/dansguardian/sbin/dansguardian</string>
    <key>ProgramArguments</key>
    <array>
    <string>dansguardian</string>
    <string>-N</string>
    </array>
    <key>RunAtLoad</key>
    <false/>
    <key>OnDemand</key>
    <false/>
    <key>WatchPaths</key>
    <array>
    <string>/opt/squid/var/logs/squid.pid</string>
    </array>
    <key>Umask</key>
    <integer>027</integer>
    <key>ServiceDescription</key>
    <string>The DansGuardian Content Filter Daemon</string>
    </dict>
    </plist>

  • ADO Database Connection: Need help with correct syntax for 'Execute' Method

    My server Windows 2008R2 taking more than 30 hours to complete backup
    so next backup getting fail
    is there any option to set start backup after 24 hours if previous backup complete

    I have a script that I am trying to cobble together, but I am stuck at attempting to execute an SQL query against and ADO connection. My code is as follows:Powershell $FQDNUpper = $Computer.ToUpper() + ".domain.dn1.dn2" $FQDNLower = $Computer.ToLower() + ".domain.dn1.dn2" $shell = New-Object -ComObject "Wscript.Shell" # for use later in script $cnn = New-Object -ComObject "ADODB.Connection" $cnn.ConnectionString = "Connection_String" $cnn.Open() $query = "SELECT CAST(ID AS nvarchar(50)) ID FROM Machine WHERE Name=$FQDNUpper AND Role = 0" $rs = $cnn.Execute($query,' ',1) #If statement that will qualify if $FQDNUpper returned anything else try $FQDNLowerWhen executing the code I receive an error:
    PowershellArgument: '2' should be a System.Management.Automation.PSReference. Use [ref].At line:9 char:5+ $rs = $cnn.Execute($query,' ',1)+ ...

Maybe you are looking for