How to stop one timer from another class?

I am trying to stop a timer in the stopwatch class MainMenu class. But my code does not work, here is my code:

in the class MainMenu I have method:

public function pauseGame (e:MouseEvent){

     timestop = new Stopwatch();

     timestop.Stoptimer(); }

in the Stopwatch class, I'm trying to stop my timer with:

public function Stoptimer(){

      timer.stop();

      timer.removeEventListener(TimerEvent.TIMER, timeFun);

      return; }

You pass a reference to the timer to the Stoptimer class.

Tags: Adobe Animate

Similar Questions

  • Simple enough, but calling one method from another class

    Hi all
    I know it's pretty simple, even though I do not see where I am going wrong for some reason any. Basically, I have a class that extends JPanel but when I try to call one of its methods in my main class I get an error. The code (I hope) is:

    Main.Java
    import java.awt.BorderLayout;
    // ...
    import javax.swing.UIManager;
    
    public class Main extends JFrame implements ActionListener {
    
         JFrame frame;
         public static JPanel statusBar;
    
         public Main() {
    
              // ...
    
              // Add a status bar
              statusBar = new StatusBar();
              mainPanel.add( statusBar, BorderLayout.SOUTH );
    
              setContentPane( mainPanel );
              // ...
         }
    
         // ...
    
         public static void setStatusBarText( String s ) {
              statusBar.setStatusText("Test");
         }
    
         // ...
    }
    StatusBar.java
    import java.awt.Color;
    // ...
    import javax.swing.SwingConstants;
    
    public class StatusBar extends JPanel {
    
         private int barWidth;
         private static JLabel status;
    
         public StatusBar() {
              super();
              //barWidth = Main.getProgramWidth();
              //setPreferredSize( new Dimension(barWidth,22) );
              setLayout( new FlowLayout( FlowLayout.LEADING ) );
              setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(160,160,160) ) );
    
              status = new JLabel("Test", SwingConstants.LEFT);
              //status.setVerticalAlignment( SwingConstants.CENTER );
              add( status );
         }
    
         protected void setStatusText( String s ) {
              status.setText( s );
              revalidate();
         }
    }
    The "statusBar.setStatusText ("Test")"; call in the main class file does not work and I get the error:

    >
    cannot find symbol
    symbol: setStatusText (java.lang.String) method
    Location: class javax.swing.JPanel
    statusBar.setStatusText ("Test");
    >

    Any ideas what I am doing wrong? I created an instance of the class called status bar StatusBar, can I use it to call the setStatusText() method (via statusBar.setStatusText ()) I thought everything is OK, then it does not work? Even if there is an easier way to do what I want to achieve (i.e. to update a JLabel since the 'central' main class file instead of setting the JLabel static and have all classes call him directly), I'd be glad to know where I am going wrong here nevertheless.

    Thank you very much
    Tristan
         public static JPanel statusBar;
    
         public static void setStatusBarText( String s ) {
              statusBar.setStatusText("Test");
         }
    

    >
    cannot find symbol
    symbol: setStatusText (java.lang.String) method
    Location: class javax.swing.JPanel
    statusBar.setStatusText ("Test");
    >

    The type of variable statusBar is JPanel. That's all the compiler takes into account. It is not relevant that at a certain point in the program, the type of the object pointed to by this variable is a subclass of JPanel (because at another time, it might be an instance of another subclass or JPanel itself.

  • How to make one file from another user on my laptop account?

    I have a file that I backed up on my laptop but didn't know it was on my son's user account, now I don't know how to transfer them to my user account... Help

    Hello

    Logon as ADMIN, then you can access all the areas of your computer. Then copy the file to a place
    on your account such as the C:\Users\Your user documents. Once copied, then you can remove it from
    the other account.

    I hope this helps.

  • How to update one column from another table

    Hello

    We have some sellers who are defined as employees but without employee_id for some reason any.  So I would like to update the correct number of a view of HR records.  Here is what I tried:

    update of po.po_vendors x

    Define employee_id = (select apps.per_people_v7 person_id y)

    where y.first_name |' '|| y.last_name = x.vendor_name)

    Error received: a row subquery returns more than one line.

    If I use this instruction to check, I'm correct employee_id or person_id home:

    Select apps.per_people_v7 person_id y, po.po_vendors x

    where y.first_name |' '|| y.last_name = x.vendor_name

    When I checked/compared with some old posts here, I could not just see where I did mistake.  Please notify.

    Thank you

    Ning

    Because for the same vendor id, you have a (employee id) id of the person twice in the target table. As Boneist said "fix data, difficulty of the request, fix the requirement...". »

    How many sellers are there in your target table?

  • How to update one table from another table

    Hello

    I have two tables, t1 or t2, I wrote the below query, but got an error as ORA-00904 ' identifier Inavlid b.purchase_capturedate. The query is:

    Update t1 a
    Set a.docdate = b.purchase_capturedate
    where (a.docid))
    Select docid_request from t2 b where a.docid = b.docid_request and b.itemcategoryid = 6)



    Help, please.


    Kind regards

    Hello

    describe your tables t1 and t2

    Concerning
    Sankar MN

  • When I shut down windows end progra - sample appears and windows will not be stopped, unless I click for end of program. Eny one have an idea how to stop this program from running?

    When I shut down windows end progra - sample appears and windows will not be stopped, unless I click for end of program. Eny one have an idea how to stop this program from running?

    Then, you will need to request Support Intel if the drivers you downloaded were appropriate for your hardware and Windows XP.

  • Calling functions from another class

    How one accesses a function from another class?

    Let's say I have a file called .as hand. My flash file uses this as this is the main class to make it work when you test the program. Let's say I have another class named Test that looks like this:

    package

    {

    public class Test

    {

    public void Test()

    {

    trace ("why don't you work?');

    }

    }

    }

    I want call the Test function when the game takes place (in the appellant to hand), how would he enter the main run file? I imported to it, made sure that the functions were public/static, created as a variable and it still doesn't work.

    Any help would be good

    the constructor for a class is different from a 'normal' function

    If you can't do something like

    meow: Test of var = new Meow();

    To call it thus:

    test: Test of var = new Test();

    test. Meow();

  • How to stop receiving messages from text from other devices

    How to stop receiving messages from text from other devices?

    Can you give us some more information please? Are you getting these texts in all of your devices, or family members?

    If you are getting the texts family members and share one Apple ID, that's why.

  • How to open a PDF from another Web site?

    I'm trying to use Adobe to fill out a job application. They said that safari could not and I need to get the latest version that I did, but now when I go on the web site it just continues to show me this message. How to open a PDF from another site?

    Right-click on the link to the pdf file, save it on your computer, open it from the inside Reader using file > open.

  • How to fill one shape with another shape, but not of models

    Hello

    How to fill one shape with another shape, but not of models. Example of this poster

    Screen Shot 2015-05-18 at 13.41.33.png

    put in a shape of the tree so that it looks like this:

    Heavy_type_tree.jpg

    Select your type with a vector path, which is the subject

    Object > envelope distort > make with top object.

  • FRM-92101 happens when I open one form from another and then close it.

    FRM-92101 happens when I open one form from another, check something, display a message to the user and exit the screen to the previous shape.

    Version of forms: 10.1.2.0.2. Java: 1.6.0_23. Browser: IE6

    When I put forward two messages of 'EXIT_FORM', all right and the second form is closed again to the first shape just like I wanted.
    In 9.0 forms, it did not.

    It has to do with the fact that I use JRE instead of JInitiator?
    Thank you.

    Take a look by using the built-in NAME_IN forms. You will find the NAME_IN function takes a STRING as parameter. Change your code to:

    IF NAME_IN('SYSTEM.CURSOR_ITEM') IS NOT NULL THEN
       SYNCHRONIZE;
    END IF;
    

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

  • How to access Enterprise manager from another computer

    Hello

    I have Oracle 10g installed on a PC. I can access this PC EM.
    I would like to know how to acceding Dbconsole EM from another computer on the same local network.

    Thank you

    RAF

    user1749272 wrote:
    Only, I solved the problem. It's the firewall blocks. Added the port 1158, then it worked.

    then, please provide 'useful' or 'correct' points as appropriate and mark it as "answered".

  • How could call a report from another report?

    Dear developers,

    How could call a report from another report?

    is this possible? and what is the call statement?

    Note: I use the 6i report



    Thanks in advance,


    Bil

    Hello

    It seems that you 'open' a quote before: orderby.
    You must "close" this quote after: orderby

    SRW.run_report ("report = SDCRVRF106 Cl_NO ='|"'|: CLIENT_no | "") ' || ' d1='||'''' || :D1 ||'''' ||' d2='||''''||:D 2 ||'' ' |' orderby =' | '''|| : o rderby | " ') ;

    concerning

  • Using a function from another class

    Information: Blackberry JDE 7.1.0

    BlackBerry 9930 Simulator - V 4.0.0.141

    The title of the topic seems simple, but I'm actually trying to use a X of class A function inside a function Y of class B and the GET, the value returned by X to a variable in B.

    Let me start by explaining what I currently have and then go on what I'm doing.

    I am using this class, the code for which I found online, to create a scrollable multi-line textbox.

    public class TextBoxField extends VerticalFieldManager {
    
          //define some variables to be used
          //in the class
          private int managerWidth;
          private int managerHeight;
          private EditField editField;
    
          public TextBoxField(int width, int height) {
                super(Manager.NO_VERTICAL_SCROLL);
                managerWidth = width;
                managerHeight = height;
    
                VerticalFieldManager vfm =
                    new VerticalFieldManager
                      (Manager.VERTICAL_SCROLL);
    
                  editField = new EditField(){
                    public void paint(Graphics g) {
                    getManager().invalidate();
                    super.paint(g);
                  }
                };
    
                vfm.add(editField);
                add(vfm);
              }
    
          public void paint(Graphics g) {
              super.paint(g);
              g.drawRect(0, 0, getWidth(), getHeight());
            }
    
          public void sublayout(int width, int height) {
              if (managerWidth == 0) {
                managerWidth = width;
              }
              if (managerHeight == 0) {
                managerHeight = height;
              }
              super.sublayout(managerWidth, managerHeight);
              setExtent(managerWidth,managerHeight);
            }
    
          public String getText() {
                return editField.getText();
              }
              public void setText(String text) {
                editField.setText(text);
              }
            }
    

    Then in another class that I created a "Set" function that instantiates the class textbox, to create two text boxes and a richfieldtext, add them to a HorizontalFieldManager and return the HorizontalFieldManager.

     HorizontalFieldManager Set(int set){
            HorizontalFieldManager hr1=new HorizontalFieldManager(FIELD_HCENTER);
    
            RichTextField set1 = new RichTextField("SET " + set + ":"){
                protected void layout(int width, int height)
                {
                    super.layout(75,30);//Width and height according to the button name;
                    setExtent(75,30);//width and height according to the button name;
                }
            };
            set1.setPadding(10, 5, 10, 10);
            TextBoxField set1W = new TextBoxField(40,25);
            set1W.setPadding(10, 5, 10, 0);
            TextBoxField set1R = new TextBoxField(40,25);
            set1R.setPadding(10, 5, 10, 0);
    
            hr1.add(set1);
            hr1.add(set1W);
            hr1.add(set1R);
    
            return hr1;
        }
    

    Now in my main class I call this function to add a 'Set' on the screen using:

    add(Set(1));
    

    For the creation of the 'Set' function instead of using the instance of the textbox class in the main class itself, it is because I will create several 'sets '.

    Now, as you can see, there is a public String getText() function in the TextBoxField() that returns the value of the editField. What I need to do, is to get the value in this field, once you press a button.

    I have the code for the function button, so this isn't a matter of concern. However I do not know how to retrieve the editField value when the button is pressed. I can get the value inside the Set()function, using the:

    String getval = set1W.getText();
    

    but can't reach it from the outside. I don't even know if it's possible in the first. If it is not could someone suggest a way where I could retrieve these values.

    Any help is appreciated.

    Thank you.

    Thanks for the suggestion. I found another workaround solution. Essentially implementation of an array of TextBoxFields and then pass them one by one the "Set()" method

    I tried this at the start before posting here, but due to a careless mistake when you declare the array of TextBoxFields, I couldn't make it work.

    In any case, the topic can be closed now, because the problem has been resolved. Thank you.

  • How to install photoshop transferred from another laptop?

    How to install photoshop I transferred to another Macbook Pro?  I transferred over a connection via bluetooth to a Macbook on another Macbook, the error message came when trying to install.  Help, please.

    You don't transfer one Mac to another, you install from the installation files

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

    -includes a link to access a page to download the Adobe programs if you do not have a disk or drive

    - or kglad links in response to #1 here can help https://forums.adobe.com/thread/2017859

    Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq

    - and also read https://forums.adobe.com/thread/1146459

Maybe you are looking for