Trouble referencing instance name from different frame

Newbie here. All my code is in frame 1 and is working fine except for one onRelease event. In frame 20 (labeled "gameOver") there is a button which has an instance name of btnQuit. I want that button to do something onRelease. The code works fine if I put it inside the button like so: on (release) {......etc. But I would like to have all my code in frame 1 in a timeline called "scripts".
I think I'm missing something to reference the button's instance name (maybe a "_root", or "this", or some of those things that I don't fully understand).
Here's the code that works when put in frame 20 inside the button, but not in frame 1 in a different timeline:
btnQuit.onRelease = function () {
  // Calculate elapsed time
  var now = new Date()
  var elapsedTime = now - startTime; // startTime set beforehand
  var strTime:String = Math.floor(elapsedTime / (1000 * 60 * 60)) + ":" +
   (Math.floor(elapsedTime / (1000 * 60)) % 60) + ":" +
   (Math.floor(elapsedTime / (1000)) % 60);
  // Send data to PHP
  dataOut = new LoadVars();
  if ( finalScore > 89 ) {
    dataOut.passed = '1';
  } else {
    dataOut.passed = '0';
  dataOut.score = finalScore;
  dataOut.time_spent = strTime;
  dataOut.send("lesson.php","_self","POST");

The button has to be in the presence of the code when the code is executed.  So you either need to have that button in frame 1 or have that code in frame 20.  You could have it in frame 1 and turn it invisible until frame 20 if that is an option.

Similar Messages

  • How to get only column names from different tables as single table columns

    Hi All,
       I have one requirement in which we want only column names from different tables.
    for example :
     I have three tables T1 ,T2, T3 having
      col1 clo2 clo3 -->  T1 , 
      col3 col5 ,clo6 --> T2 ,
      Clo6 col8 col9 --> T3
    columns i want to get only all  Column names from all table as single Resultset not any data from that how can i get that empty resultset 
    because this empty result i want to bind in datagridview(front end) as Empty resultset 
    Please tell me anyways to do this
    Niraj Sevalkar

    If I understand you want an empty result set, just with metadata. SET FMTONLY do the trick:
    SET FMTONLY ON
    SELECT Col1, Col2, Col3, ....., Coln
    FROM
    T1 CROSS JOIN T2 CROSS JOIN T3
    SET FMTONLY OFF
    Another alternative is to include an imposible contition
    SELECT Col1, Col2, Col3, ....., Coln
    FROM
    T1 CROSS JOIN T2 CROSS JOIN T3
    WHERE 1 = 0
    If you are using a SqlDataAdapter in your client application. You can use the FillSchema method. the select command may be any select statement that returns the columns you want. Under the covers FillSchema will call SET FMTONLY ON.
    If you are using SqlCommand.ExecuteReader you can pass SchemaOnly to CommandBehavior argument. SET FMTONLY ON is called under the covers. Again the select command may be any select statement that returns the columns you want.
    "No darás tropezón ni desatino que no te haga adelantar camino" Bernardo Balbuena

  • Concatenate tables with same name from different servers - CR2013

    Hello,
    I need some help.  I need data from 2 tables with the same name on different SQL servers thru an ODBC connection. When I try to get the data by adding both to my datasource I get data from one or the other.  I have considered creating a view, but not sure how to handle this.  Thanks.

    Hi,
    Linked Servers are pretty simple and straightforward, just do a search for the procedure.
    I do have an additional comment, though.  Depending on what tables you're gathering, I've found noticeable differences in performance when I use a connector to a DB on Server Instance "A" linked to "B" versus Server Instance B linked to A.  I haven't determined the circumstances affecting one over the other.
    If I'm not happy with speed using a connector A, I try switching to B.  I like to use as much SQL code as possible, but you can't get around the connector still being a factor.
    Matt

  • Retrive data from different frames in the same HTML page

    Dear sirs,
    Consider a HTML page with 2 frames, frame1.html and frame2.html. Frame1 contains a textbox, and frame2 contains an "Ok" button.
    Could it be possible that, once I click "OK", and after being redirected to the proper servlet, such servlet could retrive information from Frame1?
    Or, in other words, it is possible for a servlet to get information from different html pages? (I mean INPUT elements like texboxes or radio buttons).
    Thanks in advance for any ideas provided.

    Hi,
    Try this out:
    window.parent.Frame1.document.formname.textbox1.value
    Best of luck

  • Udf to pass constant corrsponding to 2 file names from different location

    if i have one source file, i m able to pass the file name directly to the target through the udf below:
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return ourSourceFileName;
    But i have 2 files from different location. Now both files has dates at the end. how can i pass AAA for File1.txt and BBB for File2.txt. .
    after the above code, i have included below code too, but not working(*-for date n timestamps):
    if(ourSourceFileName.equals("ABC*.txt"))
    return "FILE1";
    else if(ourSourceFileName.equals("XYZ*.txt"))
    return "FILE2";
    please suggest

    Hi Basker,
    Error in activating object in IR - heres the total code i have used for this purpose. plz help in getting this.
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return  ourSourceFileName; 
    if(ourSourceFileName.equals("SOURCE_1*.txt"))
    return "File1";
    else if(ourSourceFileName.equals("SOURCE_2*.txt"))
    return "File2";
    Source code has syntax error:  /usr/sap/DXI/DVEBMGS31/j2ee/cluster/server0/./temp/classpath_resolver/Map27461f402eff11e0898d00144f1e71f0/source/com/sap/xi/tf/_MM_UPDATE_.java:839: unreachable statement if(ourSourceFileName.equals("SOURCE1_*.txt")) ^ /usr/sap/DXI/DVEBMGS31/j2ee/cluster/server0/./temp/classpath_resolver/Map27461f402eff11e0898d00144f1e71f0/source/com/sap/xi/tf/_MM_UPDATE_.java:844: missing return statement } ^ 2 errors

  • How to get the instance name from the SWFLoader?

    Hi Guys,
    I am new to Flex. i need help from u.
    i load the swf file through the SWFLoader in Flex 3.
    Than how to get the instace(button,text,etc.,) of the loaded
    swf.
    Please help me.

    Yes. hashcode is not absolutely unique. I know this.
    I had took this idea into my consideration. But it failed finally.
    Thanks
    To JN_.
    Maybe I still have some misunderstood descripte my question.
    neither the name not an "instance name" nor an "object name".
    So now, I really do not know how to call this.
    Can you tell me? Then I will not make the same fault next time.
    thanks.

  • How do i reference a movie clip instance name from inside child movie clips.

    I have a label I am referencing form a movie clip inside the movie clip which contains the "label_2."
    Here is the code I used:
    MovieClip(parent.parent).gotoAndPlay("return_2");
    Now I need to reference a instance name of a movie clip in side the same scene.
    What would the code be?

    You should probably start by reading the docs and/or google:
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/Event.html
    http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9 b90204-7fca.html
    http://www.google.com/search?hl=en&q=AS3+events
    Once you got the basics down, look into creating/using your own custom events:
    http://www.google.com/search?hl=en&q=AS3++custom+events
    http://www.adobe.com/devnet/actionscript/articles/event_handling_as3.html
    Event dispatching and event handling is one of the most important things about ActionScript. The sooner you get into them, the better.

  • Referencing repeated components from different AS file

    Hi
    I am having a View SatSetting.mxml and it has repeater
    component which is text field.I am trying to assign the value to it
    from different action script file like below code snippet
    msatView:SATSetting = new SATSetting();
    msatView.taxid_ti[0].text = "Testing";
    where taxid_ti is the id of the textinput inside the
    repeater.
    I am getting null exception at line #2
    I am following the steps in flex doc but still getting this
    error.
    Thanks in advance
    K

    What you need to do is pass a reference for your GUI mainline class to the constructor of your subcomponents and keep a reference to the subcomponents in the mainline. This way the main GUI object can refer to methods in the other objects and they can refer to methods in the GUI.
    eg:
    class GuiMain extends JFrame
        MyMenu menu;
        MyButtons buttons;
        GuiMain()
           menu = new MyMenu(this);
           buttons = new MyButtons(this);
           // the rest of the constructor
        // the rest of the class
        m.buildMenu("File");
    // in separate files
    class MyMenu
        GuiMain parent;
        MyMenu(GuiMain parent)
            this.parent = parent;
            // rest of constructor
        // rest of menu class
        void mnuExit()
           parent.doExit();  // ask parent to shut down
    // other classes

  • How to load the same classes of the same name, from different jars

    Hi,
    I have several different versions of my project in respective jars. I am trying to develop a configuration app, which will have the most current version of my app packaged within it. Then the user will make a selection, and if that selection is an older version, a specific class from one of the jars...which will continue to load other classes within that same jar. If it is the current version, the class will be found within the codebase.
    My question is if this is even possible? Can I load a class from a jar file which has the same file name and package as what is in my current code?

    nasch_,
    So I have been searchin around, and found some good tutorials on classloaders, But i still see a problem.
    Whether I use the same classloader for different sources or not, the problem lies within the reference to the class i am loading. Since this class (a different version of it), is also in the classpath, how does the code know which class is being returned?
    I am having trouble putting this into words, but basically. i don't see how my application will know that i am returning an instance of a class which is not in my classpath.

  • How do I call methods with the same name from different classes

    I have a user class which needs to make calls to methods with the same name but to ojects of a different type.
    My User class will create an object of type MyDAO or of type RemoteDAO.
    The RemoteDAO class is simply a wrapper class around a MyDAO object type to allow a MyDAO object to be accessed remotely. Note the interface MyInterface which MyDAO must implement cannot throw RemoteExceptions.
    Problem is I have ended up with 2 identical User classes which only differ in the type of object they make calls to, method names and functionality are identical.
    Is there any way I can get around this problem?
    Thanks ... J
    My classes are defined as followes
    interface MyInterface{
         //Does not and CANNOT declare to throw any exceptions
        public String sayHello();
    class MyDAO implements MyInterface{
       public String sayHello(){
              return ("Hello from DAO");
    interface RemoteDAO extends java.rmi.Remote{
         public String sayHello() throws java.rmi.RemoteException;
    class RemoteDAOImpl extends UnicastRemoteObject implements RemoteDAO{
         MyDAO dao = new MyDAO();
        public String sayHello() throws java.rmi.RemoteException{
              return dao.sayHello();
    class User{
       //MyDAO dao = new MyDAO();
       //OR
       RemoteDAO dao = new RemoteDAO();
       public void callDAO(){
              try{
              System.out.println( dao.sayHello() );
              catch( Exception e ){
    }

    >
    That's only a good idea if the semantics of sayHello
    as defined in MyInterface suggest that a
    RemoteException could occur. If not, then you're
    designing the interface to suit the way the
    implementing classes will be written, which smells.
    :-)But in practice you can't make a call which can be handled either remotely or locally without, at some point, dealing with the RemoteException.
    Therefore either RemoteException must be part of the interface or (an this is probably more satisfactory) you don't use the remote interface directly, but MyInterface is implemented by a wrapper class which deals with the exception.

  • Change database instance name from XE to something else

    Does anyone know how to change the database name during the XE installation?

    Just remember, especially if you are coming from the Microsoft SQL Server or the MySQL world ...
    One MySQL or SQL Server database is roughly one Oracle Schema. You can have any number of Schemas in an Oracle database. It may not be necessary to have a different database name, or multiple XE databases.

  • Same column name from different table

    i have a sql query as like this : "SELECT * FROM TABLE1,TABLE2". i use oracle. both TABLE1 and TABLE2 have the same column named 'COLUMN1'. while i get rows how i know the value of COLUMN1 from which table (TABLE1 or TABLE2).
    sample code snippet is above. do u help me!
    while (rs.next())
    value1 = rs.getString("COLUMN1");
    // is value1's value from table1 or table2. how do i know this?
    // i try value1 = rs.getString("TABLE1.COLUMN1"); but it doesn't work :(
    ....

    I case you don't know what an alias is, it would look something like this:
    SELECT a.COLUMN1 as FirstColumn1, b.COLUMN1 as SecondColumn1 FROM FirstTable a, SecondTable b
    Notice that in the FROM clause we've appended a short name for each table. You're not limited to one character, but I try to keep it simple. Now we can refer to the tables as a and b.
    Because I did that I have to refer to any ambiguous columns (although it's good practice to refer to ALL columns) using the table name prefix and a period. This tells the driver which "COLUMN1" I want. Then we include as AS clause which allows us to tell the driver what we want that column name to be when it's returned to us. This is specially usefule when I have two columns in two separate tables with the same name (as you have here) or if I'm calculating data (i.e. (a.QTY * b.PRICE) as UnitPrice) that doesn't have a column name, so here I can give it one.
    It's a little weird at first since you use the alias names in the select before you actually define them in the FROM clause, but you'll get use to it.
    Now you retrieve FirstColumn1 and SecondColumn1 from your ResultSet, not Column1.
    HTH.

  • How can I edit multiple clips with different frame rates on the same timeline

    how can I edit multiple clips with different frame rates on the same timeline

    You do not want to edit material from different frame rates on one timeline. You CAN do this, but it is a very bad idea - and this is why.
    Once you establish the sequence frame rate - lets say it is PAL material at 25fps, any material that you drop into the sequence other than 25 fps will have to be changed to play at 25 fps. If the material you add is NTSC (29.97), FCP will DROP 5 frames per sec to bring the frame rate down to 25 fps. Which 5 get thrown away? Every 6th one. This yields a funky cadence that becomes even more complex as as there are also interlaced fields (DV/NTSC is an interlaced format). Oh, and by the way, the image sizes are different as well. DV/PAL has 576 lines of resolution and DV/NTSC has 480. FCP has to scale up the NTSC to fit the PAL frame.
    You do not want FCP adjusting these things on the fly. You want to do a thoughtful (and time consuming) conversion so that you end up with all your material in one format with the best possible image from the conversion process. Compressor can do an adequate job with Frame Controls turned on. The Natress Standards Conversion FCP plugin is another way to go. A third option is to find a post house that can do the conversion for you using a hardware based process.
    The good news is, once everything is in the same format, editing it will be painless and the output process very quick.
    Whatever frame rate/ image size you select, I'd suggest using ProRes for the codec. It is 4:2:2 color and will withstand color correction and composting with much more grace than any variant of DV based codecs.
    Have fun.
    x

  • Multiple MovieClips with same instance name

    I'm following a tower defence tutorial and part of the code is set up so I can build towers on the "grass" movie clip. I wanted to add more patches of "grass" and gave them all the same instance name so I can be able to place towers on them, but I have the problem that I can only place towers on the first item I placed and has the instance name of "grass". I can't seem to place towers on the other patches of grass.
    I removed the instance name of the first patch of grass and it let me build towers on the second patch, but the second patch only.
    I was following this tutorial: http://www.goofballgames.com/2010/01/31/how-to-build-a-tower-defense-f lash-game-part-2-placing-towers/
    Here is the code for it I believe:
    onClipEvent (load)
        active = 0;
    onClipEvent (enterFrame)
        if (active == 1)
            setProperty("", _x, int((_root._xmouse - 10) / 20) * 20 + 20);
            setProperty("", _y, int((_root._ymouse - 10) / 20) * 20 + 20);
      hitTestOnGrassMovieClip = _root.grass.hitTest(_x, _y, 1);
            if (hitTestOnGrassMovieClip) {
                gotoAndStop(1);
       _root.ranger.gotoAndStop(1);
            else {
                gotoAndStop(2);
       _root.ranger.gotoAndStop(2);
            _root.ranger._x = _x;
            _root.ranger._y = _y;
            _root.ranger._width = _root["tower_" + tower].range * 2;
            _root.ranger._height = _root["tower_" + tower].range * 2;
    on (press)
    hitTestOnGrassMovieClip = _root.grass.hitTest(_x, _y, 1);
    hitTestOnDeSelectMovieClip = _root.deselect.hitTest(_x, _y, 1);
        if (hitTestOnGrassMovieClip || hitTestOnDeSelectMovieClip) {
            if (hitTestOnGrassMovieClip) {
       ++_root.towerCount;
       _root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 500 + _root.towerCount);
       a = _root["t" + _root.towerCount];
       a._x = _x;
       a._y = _y;
       a.active = 1;
      active = 0;
      setProperty("", _x, 1000);
      _root.selectedTower = "";
      _root.ranger._x = 1000;
      _root.ranger._width = 10;
      _root.ranger._height = 10; 
    }

    1.  You cannot use the same instance names for different objects and expect more than one to be targeted.  You need to assign unique names, or you can store references to them in an array and use the array to target them.
    2. You are posting AS2 code in the AS3 forum.  You should repost in the AS2 forum.  http://forums.adobe.com/community/flash/flash_actionscript

  • How can I make the Instance name the same as the name of the Movie clip in an animation.

    Hi, I am an animator for a small game project and I have this really big problem. Even though I used flash for animation for a long time I am a newbie when it comes to something technical. I just received a request to make every movie clip that I use  to have a consistent <Instance name> in every frame of the animation. Only if they told me this earlier... Is there an easier way to make the <Instance name> the same as the name of the Movie clip used other than manually entering it. I have 16 characters with 12 body parts with 20 animations each with about 6-7 frames for each body part it will take me months and nightmares evey night to enter everything by hand. Please help me keep my sanity!
    I'm not sure if I explain correctly, so here is a picture:
    Thank you!

    Thank you for the fast answer! I found this video on jsfl functionality that deals with a similar problem, I am not a coder so it will take me some time to figure it out, but when I do I will probably post the answer here. Here is the video:

Maybe you are looking for