interrupt an event of any other event handler

Is it possible to have an event that interrupts another handful rutin event? I mean, I have an event handle the structure with several events (case). One of this event takes place, and the structure begins to run in rutin. Meanwhile, rutin is running, another event takes place. Is it possible to stop rutin from first event to run the other?

Thank you!

No. not really.

Structures of the event has no any code embedded in them that can take a long time to run and block the other events.  If you do not have one such routine, you must move to the other while loop using an architecture of producer/consumer with queues.  The structure of the event would just load a command into a queue that the other dequeue while loop and start working on.  The structure of the event loop will become quickly available to treat other events.

If the second event is one that is designed to interrupt the first routine, then you just need to have the right communication architecture to send to the other loop.  This could be another queue order, perhaps a declarant or accident.  A local variable or functional global variable.

Remember that you can not stop any structure in the middle of its processes.   A time of loop can be stopped, but all the code in the while loop should run before this iteration of the loop stops.

Tags: NI Software

Similar Questions

  • event.localX of a MovieClip regardless of any other DisplayObject over/under/inside

    Here is an example:

    var table:Table = new Table();
    stage.addChild(table);
    //table covers the whole stage
    for (var i:int = 0; i<= 10; i++){
      var book:Book = new Book();
      book.x = Math.random() * stage.stageWidth;
      book.y = Math.random() * stage.stageHeight;
      if (Math.random() < .5){
        stage.addChild(book)
      }
      else {
        table.addChild(book)
      }
    
    stage.addEventListener(MouseEvent.CLICK, clicked); //notice that the eventListener is added to the stage
    
    function clicked(event:MouseEvent){
    trace(event.localX, event.localY);
    }
    
    
    

    what I need here, it's the localX or locally TO THE TABLE, not another thing.

    so the general question is "how to return event.localX of a certain MovieClip regardless of any other DisplayObject over/under/to inside it, without defining the mouseChildren to false (which I need to be enabled).

    This question is another discussion I had on actionscript 3 - event.localX of a MovieClip regardless of any other DisplayObject over/under/inside - Stack Overflow

    function clicked (event: MouseEvent) {}

    var globalPt:Point = new Point (event.stageX, event.stageY);

    var tablePt:Point = table.globalToLocal (globalPt);

    trace (tablePt.x, tablePt.y);

    }

    SOLVED

  • Trouble finding a place for my event handler

    I'm a newbie on my first work programme. I'm trying to teach myself JavaFX by creating a program simple Tic-Tac-Toe. I created an AnchorPane to hold the TIC-TAC-TOE grid which consists of 4 Cree-crossing lines that have been created in the JavaFX scene generator. There are 2 horizontal and 2 vertical lines. In the Java program, I loaded my FXML file and my TIC-TAC-TOE grid looks great. I created 9 ImageView that match 9 of TIC-TAC-TOE squares. I load those with x.jpg or o.jpg images. Those that work very well and I can see them on my network manually.

    I can't find out how to make them appear if I click in one of the squares. I created a rectangle and is the same color as the grid and without border and place in the center square. I put a fx:id = "MMR" (medium-medium rectangle) and an onMouseClicked = "#handleRMM" in the FXML file.

    I created an event handler, and I know it's because I put System.out.println ("Clicked!"); and I can see it on the NetBeans console. But the rest of the event to display the X does not appear.

    I can't get to work in the main part public class handler extends Application of the program. But the AnchorPane, my ImageViews and everything is defined in part public void start (primaryStage stage) of the program. For this purpose, I can not access the ImageViews to the event handler. I will list my code, and I hope someone can tell me what I'm doing wrong. Thanks in advance.

    David
    package tictactoe;
     
     
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javafx.application.Application;
    import javafx.fxml.FXML;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.*;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.layout.AnchorPane;
    import javafx.stage.Stage;
     
    /**
     *
     * @author David
     */
    public class Main extends Application {
     
        
        /**
         * @param args the command line arguments
         */
        public void main(String[] args) {
            Application.launch(Main.class, (java.lang.String[])null);
        }
     
        @Override
        public void start(Stage primaryStage) {
            
            
            try {
                            
               
                AnchorPane page = (AnchorPane) FXMLLoader.load(Main.class.getResource("TicTacToe.fxml"));
                Scene scene = new Scene(page);
                
                primaryStage.setScene(scene);
                scene.getStylesheets().add("tictactoe/tictactoe.css");
                primaryStage.setTitle("TicTacToe");
                ImageView mm =new ImageView();//Middle Middle
                final ImageView lt =new ImageView();//Left Top
                final ImageView lm =new ImageView();//Left Middle
                final ImageView lb =new ImageView();//Left Bottom
                final ImageView tm =new ImageView();//Top Middle
                final ImageView bm =new ImageView();//Bottom Middle
                final ImageView rt =new ImageView();//Right Top
                final ImageView rm =new ImageView();//Right Middle
                ImageView rb =new ImageView();//Right Bottom
                //mm.setImage(new Image("tictactoe/images/x.jpg"));
               
                //page.getChildren().add(mm);
                
                mm.relocate(246,145); mm.setFitWidth(100); mm.setFitHeight(100);
                lt.relocate(107,35);
                lm.relocate(107,145);
                lb.relocate(107,260);
                tm.relocate(246,35);
                bm.relocate(246,260);
                rt.relocate(375,35);
                rm.relocate(375,145);
                rb.relocate(375,260);
                
                page.getChildren().add(mm);
                //page.getChildren().remove(mm);
                page.getChildren().add(lt);
                page.getChildren().add(lm);
                page.getChildren().add(lb);
                page.getChildren().add(tm);
                page.getChildren().add(bm);
                page.getChildren().add(rt);
                page.getChildren().add(rm);
                page.getChildren().add(rb);
            
                primaryStage.show();  
                
            
            }
               
                                 
         
            
            catch (Exception ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                        }
                
        
        }
    
         
        public void handleRMM() {
            
           ImageView mm =new ImageView();
            mm.relocate(246,145); mm.setFitWidth(100); mm.setFitHeight(100);
            mm.setImage(new Image("tictactoe/images/x.jpg"));
            
            System.out.println("Clicked!");
        }
        
    }
    and my FXML file:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.scene.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.image.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.shape.*?>
    <?scenebuilder-stylesheet tictactoe.css?>
    
    <AnchorPane id="AnchorPane" fx:id="anchor" prefHeight="400.0" prefWidth="600.0" style="" xmlns:fx="http://javafx.com/fxml" fx:controller="tictactoe.Main">
      <children>
        <Line endX="100.0" endY="1.0" layoutX="15.0" layoutY="125.0" startX="450.0" startY="1.0" />
        <Line endX="100.0" endY="0.0" layoutX="15.0" layoutY="250.0" startX="450.0" startY="0.0" />
        <Line endX="-100.0" endY="-125.0" layoutX="301.0" layoutY="158.0" startX="-102.0" startY="180.0" />
        <Line endX="-100.0" endY="-125.0" layoutX="465.0" layoutY="163.0" startX="-100.0" startY="180.0" />
        <Rectangle id="rlt" fx:id="rmm" arcHeight="5.0" arcWidth="5.0" fill="WHITE" height="122.50001525878906" layoutX="202.0" layoutY="127.0" onMouseClicked="#handleRMM" stroke="WHITE" strokeType="INSIDE" width="163.4998779296875" />
      </children>
    </AnchorPane>

    Just my $0.02 worth.

    Any interactive game is a starting point quite complex. The logic of a game is quite complex (even if it's a really simple game). TIC-TAC-TOE, you'll not only to deal with the mouse click but you need a way to tell if it's a valid move (i.e. If the place is not already busy). Is not difficult in itself, but you need to know where to keep the underlying data to this logic, and really data (State of play) must be independent of the display of the game: in short, at a certain level, you will need to understand the model-view-controller architecture.

    Now you are at the stage where you're still trying to understand the syntax of the language, and you have little chance to learn than just trying codes and post on the forums. Of course, you can look at other resources too and there are more resources for learning Java I can possibly list, but perhaps Oracle's Java tutorial [url http://docs.oracle.com/javase/tutorial/java/index.html] would be a good starting point. Understand the first three chapters or so meets immediate syntax issues you encounter.

    If you have other references, Kathy Sierra "head first Java" and "Thinking in Java" Bruce Eckel are the ones who always get good customers.

  • Event handler does not

    Greetings!

    My college professor told me about flash builder and it's good for mobile applications. I've never done anything with actionscript before and had my first foray in recent days. However, I quickly ran into a problem. I draw a rectangle and are now trying to use event handlers. For now, I meant add the event handler for click on the rectangle. When to perform a specified function.

    rectangle.addEventListener (MouseEvent.CLICK, RectClicked);

    But even if there is nothing wrong anywhere in my application when you click the first rectangle, nothing happens. This is true for other events of mouse and keyboard. My teacher said that it may have something to do with saw generator flash student at College and currently having the trial here at home. It may not allow you to use certain features.

    What I have to buy flash builder first before being able to use certain features?

    Hey Koopa,

    The two examples that I've downloaded work, so...

    When you're in FlashBuilder, there are a number of different default options to run.

    1. There is an option "Debug".

    2. There is an option "Run".

    3. There is a 'Profile' option (may be available only in Pro version)

    The 'Debug' option passes with tracks included and connects the debugger in any browser plugin you use (if you have version _installΘe_ the debugger player http://www.adobe.com/support/flashplayer/downloads.html ). THIS IS the OPTION DESIRED if you want to see traces.

    The 'game' option just fires the film and has no connection with the debugger.

    The 'Profile' option is almost certainly a little more that you're ready for.

    Check, then check again, that you run and you should see all workers.

    G

  • Is there a c# example to use the event handler ExpressionEdit Custom Button control

    TestStand 4.1

    VISUAL C# 2008

    I've added the event handler for ExpressionEdit events as I would any event handler:

    exprEdit.ButtonClick += new NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEventHandler (_ExpressionEditEvents_ButtonClickEvent);

    Then, I create the event handler using the syntax

    public void _ExpressionEditEvents_ButtonClickEvent(NationalInstruments.TestStand.Interop.UI.ExpressionEditButton btn)

    {

    }

    I get the following error when I compile Isaiah:

    Error 1 no overload for delegate matches '_ExpressionEditEvents_ButtonClickEvent' 'NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEventHandler '.

    I guess that means that I don't have the right parameters or types in my statement of event handler, but it corresponds to the object browser.  Any ideas on what I'm missing?

    See my last edition but I think you want your handler to look like this:

    Public Sub exprEdit_ButtonClick (ByVal sender,
    NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEvent
    (e)

  • Control does not after the exit of the loop of event handler

    My application brings together several controls user input.  When the user presses the OK button, it exits the event handler and the treatment.  During the treatment, it is not able to read the new values of the controls.  And in fact is no longer meets the stop button.

    When executing the attached VI, you will find that you can press the button of the switch and the LED indicates the status of the switch (this is my input from the user).  Now, press the OK button.  If you press the switch button, you will see that it works only once.  In addition, the stop button unresponsive to user input.  If you do not press the button, the stop button will cause the 2nd loop exit.

    Why the 2nd loop is unresponsive to the switch?

    It is a simplified version of my application in which two loops are separate from the States of my state machine.  There are several other States as well.

    The case of the event of the "change value" event has the property set to lock the Panel before the VI when the event is raised until the case of the event is over.

    Because the left while the loop is running not but the structuer event is always active FP everything is locked.

    Uncheck this option in the "edit event".

    Tone

  • initialize the PostProcess event handler

    Hello world

    We develop a PostProcess event handler that loads a choice list values and to do a calculation based on the values of research and the parameters passed.

    The Manager will have to face a lot of events, we are a little worried that the execution could get affected too (despite the asynchronous nature of the handlers).

    Is it possible to precompute for example loading of research (which is always the same) and other calculations in an initialize() method so that the Manager is not obliged to all over again for each event?

    Thanks for your help in advance!

    To use the search in initialize the first you must instantiate full LookupOperation API to initialize and create a global variable to use the value during the life cycle of the event handler

    It is not recommended "global variables should not initialize in this method.

    Initialize method will be called only once during the event handlers loading, IE every time u start the server.

    The object created in the initialize method will still be in memory. It depends on the size of your list of choices.

    If it contains huge data not recommend you store it in the initialize method. As it will eat your memory.

    __

    When closing a thread like a response please do not forget to mark the messages correct and useful to make it easier for others to find their

  • IOM, 11g event handler: get the actor

    In an event handler, is it possible to get the actor (the user who makes the changes on the target user) in the orchestration, or elsewhere in the eventhandler object?

    At any time you can get current actor with the api ContextManager.

  • How to add an event handler (to the click or mouseover) symbol on the timeline of the scene

    Is it possible to add an event handler on the main stage anime who controls a symbol?  Thus, for example, if you had several symbols on the stage, each with their own unique name, then on the main stage you wanted to add a list of event handlers specific to these symbols to affect a change when you interacted with this symbol.

    For example when you click on the symbol a few things happen here...

    (1) for (name of the symbol) click starts the animation of the symbol

    2) roll (symbol name) the symbol animation stops

    (3) the symbols background image is set on the main timeline.

    All this can be done easily on the symbol itself, but those is possible since the main timeline (scene).  Anyone know a solution?

    Yes

    1. Add jquery min CDN (https://code.jquery.com/jquery-2.1.1.min.js) to the script library (from the "Add js to URL" option.

    2. in the compositionReady event handler try something like that - the "many event handlers section" located here: http://learn.jquery.com/events/handling-events/

    Code example

    item = sym.$("btn");

    Element.on ({}

    MouseEnter: function() {}

    Do something

    Alert ("gliding on a div");

    },

    MouseLeave: function() {}

    Do something

    Alert ("the mouse has left a div");

    },

    click on: function() {}

    Do something

    Alert ("clicked on a div");

    }

    });

    end of the sample code

    A way to do among many others. In the use above cases pay special attention to the point of separation between the "chained" events

    HTH

    Darrell

  • OIM 11 g: initialization event handler

    Hello
    I'm looking on best practices with regard to Manager initialization event.

    More precisely, if my event handler requires the services API (UserManager, tcLookupOperationsIntf, etc.) or a database connection (tcDataProvider), where and when should we get? It seems that the options are:

    (1) constructor
    (2) initialize() method
    (3) on request when it is used in the methods execute() or validate().

    About 1 & 2, it seems these are called only once (ever), and not every time the handler is called, which may indicate that they would not be good places to get a connection of database for example.

    Best practices around that?

    Thank you!

    Not any technical reason but, I don't think you'll use code very complex and cumbersome in eventhandler where you use n number of API. And in this case, you ensure that the initializaion all is done only if the Execute method executes.

  • The onDeactivate event handler does not work in InDesign CC. Why?

    Hi guys.

    I'm working on a script in Javascript for InDesign CC.

    The big problem is that the onDeactivate event handler does not work.

    Here is an example that works in InDesign CSx, but not in InDesign CC:

    #target indesign
    var w = new Window ("dialog", "Test onDeactivate");
    var et_1 = w.add("edittext", [undefined, undefined, 300, 30], "Lorem ipsum");
    var et_2 = w.add("edittext", [undefined, undefined, 300, 30], "Dolor sit amet");
    var st = w.add("statictext", [undefined, undefined, 300, 30], "CONSOLE:\r\r", {multiline: true});
    et_1.onDeactivate = et_2.onDeactivate = function(){
         st.text = "CONSOLE: I left the field with this text:\r\t«" + this.text +"»"; }
    var b_ok = w.add("button", undefined, "OK");
    w.show();
    

    The script displays a dialog with text edit fields window 2: when a field loses focus (by clicking on the other), the "CONSOLE" shows the text of the old domain.

    Adobe, please, solve this problem as soon as possible.

    Thank you.

    Giorgio

    This is a bug, and it has been reported. Please report it to yourself, more the better reports. It's no good Adobe invite you in this forum to fix something.

    Peter

  • Pretreat the Event Handler Question

    I developed a class according to the metalink notes 1262803.1 'Sample Code for A Custom event handler implemented for process prior to the course create user management look' it worked fine but I have the following problem:
    The algorithm must search for users in order to generate a user id, and this process uses the OIMClient Api which requires a connection to the IOM (Username, Passwor and provider_url). I don't want to encode any variable.
    OimClient has something like anonynous connection?
    Is necessary use a properties file to specify the connection information?

    Thank you

    Your event handlers, you can use Platform.getService () method instead of using oimClient. Platform is available inside the IOM and would go without credentials.

    HTH,
    BB

  • event handler onMouseClicked does not

    I'm currently playing with Netbeans 7.0 and JavaFX 2.0 beta (Java 1.6.0_26, Windows XP operating system) and noticed, that the handler onMouseClicked doesn't seem to work properly.

    I have added one to the scene, but he triggered only very visit, when I hit the button on the mouse several times very quickly. On the other side onMousePressed and onMouseReleased managers work as expected.

    I also tried to add a click event handler to other nodes such as a Rectangle or a component, but it's always the same behavior.

    What is a (known) bug or limitation of version beta or am I missing something here?

    Here's a short example:
    public void start(Stage primaryStage) {
            primaryStage.setTitle("JavaFX");
            
            final BorderPane root = new BorderPane();
            final Scene scene = new Scene(root, 800, 600, Color.BLACK);
            scene.setOnMouseClicked(new EventHandler<MouseEvent>() {
                public void handle(MouseEvent event) {
                    System.out.println("click");
                }
            });
            primaryStage.setScene(scene);
            primaryStage.centerOnScreen();
            primaryStage.setVisible(true);
    }
    Kind regards

    Kai

    Edited by: 865264 the 11.06.2011 13:29 (thanks for the tip, Darryl)

    This is a known bug, see http://javafx-jira.kenai.com/browse/RT-13968 for explanation.

  • [JS CS5] problem with memory leak possible with the dialog box in the event handler

    Hello

    I'm having a very difficult problem.

    I am attaching a script in a handler for a menu item, by using an installation script menu that I wrote based on one by Marc Autret. My version of the script menu installation attach a bunch of event handlers at the same time, to the actions of different menu.

    What is the event handler, with that I have a problem is to prompt the user for a URL and then applies the URL as a hyperlink to the text selection, with our house style for the way in which the URL should look like.

    The problem is the following:

    1. all other installed menu actions work very well, except for this one.

    2. the addition of URL script works fine, when you run it directly from the script menu.

    3. the combination of #1 and #2 (using the script to add URL by function as an event handler in the Edit menu) blocks to InDesign. But it is only after the addition of URL script has finished and done what it was supposed to do!

    4. when I comment on the section of the script URL adding user input, so that instead of saying

    userInput = myDisplayDialog();
    

    It is said

    userInput = "http://thisworks.com";   // userInput = myDisplayDialog();
    

    It works well as an event handler.

    So obviously a problem with the dialog box, but only when adding URL script is executed as an event handler. My first guess is that this is some kind of memory leak, but I think I am following the model of. destroy() the way I saw it elsewhere.

    Someone knows something like that before?

    I can provide all relevant if necessary scripts, but they are quite complicated. The most important of them is the input of the user function. Here it is:

    var myDisplayDialog = function( defaultText ) {
      
        var defaultText = defaultText || "";
        
        var myDialog = app.dialogs.add({
            name: "Type in a URL"
        });
        
        var myOuterColumns = [];
        var myInnerColumns = [];
        var myOuterRows = [];
        var myBorderPanels = [];
        var myTextEditboxes = [];
        var myInput;
        
        myOuterColumns[0] = myDialog.dialogColumns.add();
        myOuterRows[0] = myOuterColumns[0].dialogRows.add();
    
    
        myBorderPanels[0] = myOuterRows[0].borderPanels.add();
        myInnerColumns[0] = myBorderPanels[0].dialogColumns.add();
        myInnerColumns[0].staticTexts.add({
            staticLabel: "URL:"
        });
        
        myInnerColumns[1] = myBorderPanels[0].dialogColumns.add();
            
        myTextEditboxes[0] = myInnerColumns[1].textEditboxes.add({
             minWidth: 300,
             editContents: defaultText ? defaultText : "http://"
        });
        
        var myResult = myDialog.show();
        var myInput = myTextEditboxes[0].editContents;
        
        myDialog.destroy();
    
        if (myResult == false) {
              exit();
        }
        
        return myInput;
    
    }
    
    

    Hi Richard,

    Unfortunately, there is no guarantee that the ScriptUI longer work.

    Thake a peek here: http://forums.adobe.com/message/2881364

    --

    Marijan (tomaxxi)

    http://tomaxxi.com

  • Is it possible to listen to a motion tween and use an event handler to do something?

    I looked at a few tutorials Manager tween event but could not understand how to operate with the below. I copied the code in 'tween and paste it into a framework that presents an animated character. I want the character to run across the screen, and after the Tween is finished, I want to be able to jump to a different image.

    Thank you.

    [AS3]

    Import fl.motion.AnimatorFactory;
    Import fl.motion.MotionBase;
    Import fl.motion.Motion;
    flash.filters import. *;
    to import flash.geom.Point;
    var __motion_run:MotionBase;
    if(__motion_run == null) {}
    __motion_run = new Motion();
    __motion_run. Duration = 24;

    Call overrideTargetTransform to prevent scale, tilt,
    or values of rotation is made relative to the target
    transformation of the original object.
    __motion_run.overrideTargetTransform ();

    Subsequent calls to addPropertyArray assign data values
    for each property interpolated. There is only one value in the table
    for every frame of the tween, or less if the last value
    remains the same for the rest of the frames.
    __motion_run.addPropertyArray ('x', [0,14.7826,29.5652,44.3478,59.1304,73.913,88.6957,103.478,118.261,133.043,147.826,162.609, 177.391,192.174,206.957,221.739,236.522,251.304,266.087,280.87,295.652,310.435,325.217,34 0]);
    __motion_run.addPropertyArray ("y", [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);
    __motion_run.addPropertyArray ("scaleX", [1.000000]);
    __motion_run.addPropertyArray ("scaleY", [1.000000]);
    __motion_run.addPropertyArray ("Scewx", [0]);
    __motion_run.addPropertyArray ("transformations", [0]);
    __motion_run.addPropertyArray ("rotationConcat", [0]);
    __motion_run.addPropertyArray ("blendMode", "normal");
    __motion_run.addPropertyArray ("cacheAsBitmap", [false]);

    Create an AnimatorFactory instance, that will manage
    targets for the corresponding request.
    var __animFactory_run:AnimatorFactory = new AnimatorFactory (__motion_run);
    __animFactory_run.transformationPoint = new Point (0.500000, 0.500000);

    Call the function on the AnimatorFactory addTarget
    instance to target a DisplayObject with this Motion.
    The second parameter is the number of times where the animation
    going to play - the default value 0 means there will be a loop.
    __animFactory_run.addTarget (lancer, 1);
    }

    [/ AS3]

    You create an interpolation of manual editing and then copying the motion as AS3 code (which looks always a little weird, compared to your animation with AS3 from scratch with Adobe fl.transition package, or greensock TweenLite, or any other 3rd party tyween engine of coding). And I presume that eager to customize it with a completion event detection.

    First, familiarize yourself with the AS3 package that defines such things when you use Flash to convert your tweens as code:

    Package: fl.motion

    http://livedocs.Adobe.com/Flash/9.0/ActionScriptLangRefV3/FL/motion/package-detail.html

    Here you will see classes in this package. And there is an interested, MotionEvent.

    MotionEvent

    http://livedocs.Adobe.com/Flash/9.0/ActionScriptLangRefV3/FL/motion/MotionEvent.html

    Right at the top of this page is an example of adding an event listener, which I'll paste here...

    import fl.motion.MotionEvent;
    abox_animator.addEventListener(MotionEvent.MOTION_END, afterMotion);
    function afterMotion(e:MotionEvent) {
       trace("animation complete!");
    }
    

    CS4/CS5 names your class objects of movement as "__motion_SymbolName". In your case, it is __motion_run. As above, to add the event to your object, follow these steps:

    import fl.motion.MotionEvent;
    
    __motion_run.addEventListener(MotionEvent.MOTION_END, afterMotion);
    function afterMotion(e:MotionEvent) {
       trace("animation complete!");
    }
    

    If you're curious about making all your animation from scratch using the code, I highly suggest to check greensock Tween engine:

    http://www.greensock.com/

Maybe you are looking for