Catching Custom Events in Actionscript

I have a custom component that opens a new window with a video player in it. I need to pass a bunch of stuff into it, so there's a lot of binding expressions. I need to be able to catch it's complete event (when the video is finished playing). But the event I dispatch isn't working. Here's my custom component class:
[CODE]
<?xml version="1.0" encoding="utf-8"?>
<!-- This is a window component which creates a transparent window with no system chrome (no bars, close, min, max buttons, resize stuff) that contains a single video object to be able to play videos from a folder called "videos" in the root of this application. This screen is spawned from the main MXML WindowedApplication using AS 3. -->
<s:Window xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    xmlns:customComponents="customComponents.*"
                    systemChrome="none" visible="true" transparent="true" showStatusBar="false" width="400" height="300"
                    >
    <fx:Metadata>
        [Event(name="MOVIE_LOAD", type="flash.events.Event")]
        [Event(name="MOVIE_FINISH", type="flash.events.Event")]
    </fx:Metadata>
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:layout>
        <s:BasicLayout />
    </s:layout>
    <fx:Script>
        <![CDATA[
            import org.osmf.events.TimeEvent;
            [Bindable]
            public var displayScreenWidth:int = 1024;
            [Bindable]
            public var displayScreenHeight:int = 768;
            [Bindable]
            public var videoName:String;
            // Note that the following two variables are set to true by default because the screen saver goes in first.
            [Bindable]
            public var muteVideo:Boolean=true;
            [Bindable]
            public var loopVideo:Boolean=true;
            // In order to allow it to play, I had to extend the play method for the VideoDisplay to a public function.
            public function play():void
                videoDisplay.play();
            protected function dispatchMovieLoad(event:Event):void
                var eventObj:Event = new Event("MOVIE_LOAD");
                dispatchEvent(eventObj);
            protected function dispatchMovieFinish(event:TimeEvent):void
                var eventObj:Event = new Event("MOVIE_FINISH");
                dispatchEvent(eventObj);
        ]]>
    </fx:Script>
    <s:VideoDisplay id="videoDisplay" x="0" y="0" width="{displayScreenWidth}" height="{displayScreenHeight}" source="videos/{videoName}"
                                    autoPlay="true" muted="{muteVideo}" loop="{loopVideo}" complete="dispatchMovieFinish(event)" />
</s:Window>
[/CODE]
When I try to catch the event, I use this code:
[CODE]
/* Plays a video, and enables sound and disables looping. It also defines what do to when the video reaches completion. */
protected function playVideo(vidName:String):void
    videoScreen.addEventListener(Event.MOVIE_FINISH, loadScreenSaver);
    videoScreen.muteVideo = false;
    videoScreen.loopVideo = false;
    videoScreen.videoName = vidName;
    videoScreen.play();
[/CODE]
The problem is, i get the error by the addEventListener line that reads:
Multiple markers at this line:
-1119: Access of possibly undefined property MOVIE_FINISH through a reference with static type Class.
-addEventListener
I don't know how to get around this. When I type "addEventListener(" and hit control+space bar, I see "Event.MOVIE_FINISH" on the list, citing my custom component as the source. Even when I had it called movieFinish in the component, I still saw "MOVIE_FINISH" for my event in the code help. So, I changed the name, but I cannot get rid of the error, and therefore my program won't compile fully. Any ideas?

The first argument to addEventListener() is just a string.  You can do:
    videoScreen.addEventListener("MOVIE_FINISH", loadScreenSaver);

Similar Messages

  • How to Access Custom Event using AS3?

    Hi All,
    Maybe it's that its Monday morning and my brain is still foggy, but I can't seem to figure out how to set custom events using AS3.
    I have a custom GridRow itemRenderer, and have declared the event using the appropriate metatags.
    Then I create the GR item dynamically using AS3 instantiation, but the event is not available for selection in the intellisense drop-down.
    Let's take the following as an example:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Grid
         xmlns:mx="http://www.adobe.com/2006/mxml"
         xmlns:renderers="com.brassworks.renderers.*"
         creationComplete="componentInit();"
    >
         <mx:Script>
              <![CDATA[
                   private function componentInit():void
                        newRow     :MyRow     = new MyRow();
                        //newRow.myEvent is not an available option to set
              ]]>
         </mx:Script>
    </mx:Grid>
    Then the itemRenderer:
    <?xml version="1.0" encoding="utf-8"?>
    <GridRow
         xmlns:mx="http://www.adobe.com/2006/mxml"
         xmlns:classes="com.brassworks.components.classes.*"
         creationComplete="componentInit();"
    >
         <mx:Metadata>
              [Event(name="myEvent", type="flash.events.Event")]
         </mx:Metadata>
         <mx:Script>
              <![CDATA[
                   private function itemChanged(event:Event):void
                   Alert.show("test");
                   this.dispatchEvent(new Event("myEvent"));
              ]]>
         </mx:Script>
         <mx:GridItem>
              <mx:TextInput
                   change="itemChanged"
              />
         </mx:GridItem>
    </GridRow>
    How do I go about setting the handler method for custom events on instantiated items? Do I need to do this via the AddEventListener() method? Does this mean that events aren't exposed in ActionScript like they are in MXML? (In MXML all I have to do is <MyRow myEvent="handler(event)" />.)
    Thanks!
    -Mike

    Yes, I you need to do this via the addEventListener() method.
    myRow.addEventListener( "myEvent", myHandler );
    I hope that helps.
    Ben Edwards

  • Registering classes to raise noncustom events in ActionScript 3

    I'm using ActionScript 3 in Flash Professional and I'd like my class to raise an event, not a custom event but an existing one. I've set up my class so that it extends EventDispatcher. In the documentation http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/EventDispa tcher.html the example declares a custom event by adding a static String variable:
    class CustomDispatcher extends EventDispatcher {
            public static var ACTION:String = "action";
    I assume that enables:
    dispatcher.addEventListener(CustomDispatcher.ACTION, actionHandler);
    or at least auto-complete when you've typed 'dispatcher.addEventListener(' into the Flash Professional IDE.
    But lots of classes that raise events raise a mixture of existing noncustom events. For example if you have an instance of a flash.netFileReference and type
    fileRef.addEventListener(
    a long list of potential events to listen for is given including DataEvent.UPLOAD_COMPLETE_DATA, Event.SELECT, HTTPStatusEvent.HTTP_STATUS, SecurityErrorEvent.SECURITY_ERROR, etc.
    If I want my class to be registered to raise those existing events, what code do I need? Preferably so that the IDE knows instances of my class may raise the event and suggests them in the addEventListener auto-complete/intellisense list.
    (PS I hope it is OK to cross-post; I've asked this on StackOverflow too. I'll update either thread with a pointer to the answer.)

    Laurent answered over on StackOverflow:
    To make the events show up in the intellisense, you need to register them using the Event metatag:
    [Event(name="eventName", type="package.eventType")]
    Add this just before the classes that dispatches this event.

  • Implementing Custom Event - non-static referencing in static context error

    Hi,
    I'm implementing a custom event, and I have problems adding my custom listeners to objects. I can't compile because I'm referencing a non-static method (my custom addListener method ) from a static context (a JFrame which contains static main).
    However, the same error occurs even if I try to add the custom listener to another class without the main function.
    Q1. Is the way I'm adding the listener wrong? Is there a way to resolve the non-static referencing error?
    Q2. From the examples online, I don't see people adding the Class name in front of addListener.
    Refering to the code below, if I remove "Data." in front of addDataUpdatelistener, I get the error:
    cannot resolve symbol method addDataUpdateListener (<anonymous DataUpdateListener>)
    I'm wondering if this is where the error is coming from.
    Below is a simplified version of my code. Thanks in advance!
    Cindy
    //dividers indicate contents are in separate source files
    //DataUpdateEvent Class
    public class DataUpdateEvent extends java.util.EventObject
         public DataUpdateEvent(Object eventSource)
              super(eventSource);
    //DataUpdateListener Interface
    public interface DataUpdateListener extends java.util.EventListener
      public void dataUpdateOccured(DataUpdateEvent event);
    //Data Class: contains data which is updated periodically. Needs to notify Display frame.
    class Data
    //do something to data
    //fire an event to notify listeners data has changed
    fireEvent(new DataUpdateEvent(this));
      private void fireEvent(DataUpdateEvent event)
           // Make a copy of the list and use this list to fire events.
           // This way listeners can be added and removed to and from
           // the original list in response to this event.
           Vector list;
           synchronized(this)
                list = (Vector)listeners.clone();
           for (int i=0; i < list.size(); i++)
                // Get the next listener and cast the object to right listener type.
               DataUpdateListener listener = (DataUpdateListener) list.elementAt(i);
               // Make a call to the method implemented by the listeners
                  // and defined in the listener interface object.
                  listener.dataUpdateOccured(event);
               System.out.println("event fired");
    public synchronized void addDataUpdateListener(DataUpdateListener listener)
         listeners.addElement(listener);
      public synchronized void removeDataUpdateListener(DataUpdateListener listener)
         listeners.removeElement(listener);
    //Display Class: creates a JFrame to display data
    public class Display extends javax.swing.JFrame
         public static void main(String args[])
              //display frame
              new Display().show();
         public Display()
         //ERROR OCCURS HERE:
         // Non-static method addDataUpdateListener (DataUpdateListener) cannot be referenced from a static context
         Data.addDataUpdateListener(new DataUpdateListener()
             public void dataUpdateOccured(DataUpdateEvent e)
                 System.out.println("Event Received!");
    //-----------------------------------------------------------

    Calling
        Data.someMethodName()is referencing a method in the Data class whose signature includes the 'static' modifier and
    might look something like this:
    class Data
        static void someMethodName() {}What you want is to add the listener to an instance of the Data class. It's just like adding
    an ActionListener to a JButton:
        JButton.addActionListener(new ActionListener()    // won't work
        JButton button = new JButton("button");           // instance of JButton
        button.addActionListener(new ActionListener()     // okay
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Vector;
    import javax.swing.*;
    public class EventTest extends JFrame
        Data data;
        JLabel label;
        public EventTest()
            label = getLabel();
            data = new Data();
            // add listener to instance ('data') of Data
            data.addDataUpdateListener(new DataUpdateListener()
                public void dataUpdateOccured(DataUpdateEvent e)
                    System.out.println("Event Received!");
                    label.setText("count = " + e.getValue());
            getContentPane().add(label, "South");
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setSize(300,200);
            setLocation(200,200);
            setVisible(true);
        private JLabel getLabel()
            label = new JLabel("  ", JLabel.CENTER);
            Dimension d = label.getPreferredSize();
            d.height = 25;
            label.setPreferredSize(d);
            return label;
        public static void main(String[] args)
            new EventTest();
    * DataUpdateEvent Class
    class DataUpdateEvent extends java.util.EventObject
        int value;
        public DataUpdateEvent(Object eventSource, int value)
            super(eventSource);
            this.value = value;
        public int getValue()
            return value;
    * DataUpdateListener Interface
    interface DataUpdateListener extends java.util.EventListener
        public void dataUpdateOccured(DataUpdateEvent event);
    * Data Class: contains data which is updated periodically.
    * Needs to notify Display frame.
    class Data
        Vector listeners;
        int count;
        public Data()
            listeners = new Vector();
            count = 0;
            new Thread(runner).start();
        private void increaseCount()
            count++;
            fireEvent(new DataUpdateEvent(this, count));
        private void fireEvent(DataUpdateEvent event)
            // Make a copy of the list and use this list to fire events.
            // This way listeners can be added and removed to and from
            // the original list in response to this event.
            Vector list;
            synchronized(this)
                list = (Vector)listeners.clone();
            for (int i=0; i < list.size(); i++)
                // Get the next listener and cast the object to right listener type.
                DataUpdateListener listener = (DataUpdateListener) list.elementAt(i);
                // Make a call to the method implemented by the listeners
                // and defined in the listener interface object.
                listener.dataUpdateOccured(event);
            System.out.println("event fired");
        public synchronized void addDataUpdateListener(DataUpdateListener listener)
            listeners.addElement(listener);
        public synchronized void removeDataUpdateListener(DataUpdateListener listener)
            listeners.removeElement(listener);
        private Runnable runner = new Runnable()
            public void run()
                boolean runit = true;
                while(runit)
                    increaseCount();
                    try
                        Thread.sleep(1000);
                    catch(InterruptedException ie)
                        System.err.println("interrupt: " + ie.getMessage());
                    if(count > 100)
                        runit = false;
    }

  • How to receive the custom event in the listening portlet (No backing file)

    I have couple of portlets (JPF based). Portlet A is firing an event
         public Forward processAction()
              PortletBackingContext context =PortletBackingContext.getPortletBackingContext(this.getRequest());
              String message = "XXXXX";
              context.fireCustomEvent("customevent", message);
              Forward forward = new Forward("success");
              return forward;
    I have configured the Portlet B's eventhandler to listen for the 'customEvent' and invoke the pageFlowAction 'listenForEvent'
         @Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "test2.jsp") })
         public Forward listenForEvent() {
              Forward forward = new Forward("success");
              return forward;
    Portlet B's method listenForEvent is indeed getting invoked, but is there a way I can retrieve the 'Event' object (as fired by Portlet A) inside the listenForEvent. I could have done this via the Backing file, but for some reasons i cann't use the backing file. Is there a way i can get the CustomEvent and the associated payload in my listening JPF portlet, without a backing file?
    The WLP version is 10.3

    Hello,
    I originally said:
    All you should need to do is to modify the method signature for your event-receiving method. The method signature should be:
    public void listenforEvent(HttpServletRequest request, HttpServletResponse response, Event event)
    where Event is a com.bea.netuix.events.Event object. You can then cast this to a CustomEvent object.
    But I mis-read your earlier post about catching the custom event and invoking a pageflow action. When you do that, you will lose the custom event's payload (your message), and there is no way to retrieve it from your pageflow action.
    The only way you can actually retrieve the event's payload is using a backing file for the portlet, with a method having the signature I mentioned above. You can then set a request attribute with the event's payload and still have it invoke the pageflow action, at which time you could retrieve the request attribute value-- assuming you don't need to run this portlet over WSRP. Over WSRP, the event-handling and pageflow action-invoking lifecycles will happen with independent request objects, so you would need to store the event payload in session to work over WSRP.
    Kevin
    Edited by: kfrender on Aug 31, 2009 3:34 PM

  • Custom Event Issue

    Hope you flex geniuses can help me on this one....
    the issue: an action script custom event is being dispatched
    by one object but is not being "heard" by it's parent despite the
    fact that a) the child object uses the [event] declaration in it's
    class definition, b) the event is being correctly dispatched, and
    c) the parent object uses an addEventListener method to listen for
    the event.
    the layout:
    includes an application component (mxml) that has as it's
    only direct child an action script custom component called
    FloorPlan. On creationComplete the floor plan object instantiates
    an action script class called Booth as many times as is required
    (based on the number of booths that needs to be displayed on the
    floor plan) and then adds the instances to itself via addChild()
    method. The booth objects are based on Sprite class and so they
    have click events, etc. When one of the booth instances is clicked,
    the click event of the booth instance fires and the handler creates
    an instance of the ShowCompanyProfileEvent (action script class
    based on the Event class) and then dispatches it. The
    ShowCompanyProfileEvent event handler for now should just open an
    Alert box.
    I know the code works within the Booth class because when I
    register an event listener in the booth class itself and then click
    on a booth, the listener "hears" the dispatched event and opens the
    Alert box.
    The problem is that The floor plan instance has a registered
    event listener to listen for the dispatched custom event also but
    nothing happens when I click a booth instance (which like I said
    should dispatch the custom event). I deleted the addEventListener
    code in the booth class thinking that maybe it was catching it
    first but still it wouldn't work.
    Any ideas? I have reallysearched and searched to no avail. As
    I mentioned, I get no errors at all when I compile and run the
    code. I just don't get the expected results.

    LensterRAD, don't know if I got the hole idea but I guess you
    are listening to the ShowCompanyProfileEvent directly on the
    FloorPlan, something like:
    FloorPlan.addEventListener(ShowCompanyProfileEvent,
    someFunction);
    if this is the case, you'll probably need to add the BUBBLE
    parameter to the event, so it will follow the hole event
    propagation model.
    something like: dispatchEvent(ShowCompanyProfileEvent,
    true);

  • Custom Event for buttom Item Click in Collections

    I get this good example of dynamic menu with button, but I
    need example of implementation of custom event when end-user click
    a particular button and use it event in Flex application.
    If my end-user clicks on a bottom-level menu item, how do i
    catch this so i can react? When a user chooses a bottom-level item,
    i’d like to change state and display information of xml
    source file tag, like trace(event.item).
    Thank in advance.

    worked for me once I fixed the handler
    protected function itemRendererButtonClickHandler(event:Event):void
         Alert.show("button is clicked and event is listened in main application ");

  • Custom Event Bubble

    I'm new to flex and how it handles Event Bubbling.  I can make a custom event work with this code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   applicationComplete="init()" name="app">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import flash.events.Event;
                import mx.controls.Alert;
                private function init():void {
                    addEventListener("myEvent",testListener);
                    var testEvent:Event = new Event("myEvent",true);
                    dispatchEvent(testEvent);
                private function testListener(event:Event):void {
                    Alert.show("Trigger Worked");
            ]]>
        </fx:Script>
    </s:Application>
    But when I break out the code so the Event fires in a class the parent does not catch it.
    MyEvent.as file:
    package comp {
        import flash.display.MovieClip;
        import flash.events.Event;
        public class MyEvent extends MovieClip{
            public function MyEvent() {
                var testEvent:Event = new Event("myEvent",true);
                dispatchEvent(testEvent);
    TestEvents.mxml file:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   applicationComplete="init()" name="app">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import comp.MyEvent;
                import flash.events.Event;
                import mx.controls.Alert;
                private function init():void {
                    addEventListener("myEvent",testListener);
                    var tempEvent:MyEvent = new MyEvent();
                private function testListener(event:Event):void {
                    Alert.show("Trigger Worked");
            ]]>
        </fx:Script>
    </s:Application>
    I know I'm missing something simple.  Could someone please point me in the correct direction.
    Thanks,
    Sol

    Thanks for the help!!!  I got it to work using most of your code.  The only change I had to make was move the dispatchEvent out of the construtor and into it's own function.  That way the listener is definded before it fires.
    Now I noticed you added the listener to the object itself is this bubbling?  I thought if you have bubbling turned on the main app can have the listener and if a child fires an event it would bubble up.  If the listerner is not on the MyEvent class it does not work.
    Here is the new Working code if you take the : tempMyEvent off this line:
    addEventListener(MyEvent.MY_EVENT, myEventHandler);
    it does not work
    Should it?  Should the event bubble up and still be fired?
    Below is working code:
    MyEvent.as
    package comp {
        import flash.display.MovieClip;
        import flash.events.Event;
        public class MyEvent extends MovieClip{
            public static const MY_EVENT:String = 'myEvent';
            public function MyEvent() {}
            public function disEventTest():void {
                dispatchEvent(new Event(MyEvent.MY_EVENT,true));
    TestEvents.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   applicationComplete="init()" name="app">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import comp.MyEvent;
                import flash.events.Event;
                import mx.controls.Alert;
                private function init():void {
                    var tempMyEvent:MyEvent = new MyEvent();
                    tempMyEvent.addEventListener(MyEvent.MY_EVENT, myEventHandler);
                    tempMyEvent.disEventTest();
                private function myEventHandler(event:Event):void {
                    Alert.show("Trigger Worked");
            ]]>
        </fx:Script>
    </s:Application>
    Thanks again for your help this will at least get me moving forward again.
    Sol

  • Dispatching Custom Event

    Hello everybody,
    Task: I want to enter a message in input text field and
    write it in the dynamic using a custom event dispatching.
    Solution: I have 2 textfields on the stage.
    One textfield is an input text field the other is a dynamic
    text field which will server just to display text.
    on the flash in the first frame I made this code:
    // mb is the instance name of the dynamic text field already
    placed on the stage
    var messageBoard:MsgBoard = new MsgBoard(mb);
    // u1 is the input text field placed on the stage
    var user1:UserInput = new UserInput(u1);
    Also I wrote 3 very simple classes.
    1. UserInput.as // input textfield class that listens to
    input and dispatches a custom event
    2. MsgEvnt.as // custom event class the instance of which is
    dispatched
    3. MsgBoard.as // class that listens to the new event and
    once it occurs adding event message to the textfield
    Problem: Somehow it doesn't work. I actually made it work by
    making a listener the same object that dispatches the event. But I
    want to understand why it doesn't works the way I showed above. I
    browsed a lot of forums and found that all the people use to listen
    by the same object that is dispatching. I think it's like talking
    with yourself isn't it?
    Thanks everybody who will reply and I hope it will help
    someone who will read!

    your event is dispatched within UserInput scope and MsgBoard
    is not within UserInput scope so it's not going to receive that
    event. ie, a UserInput instance is not accessible to MsgBoard.
    you may have a basic misunderstanding: events that are
    dispatched are not like radio signals that are transmitted and
    anyone with a listener (radio) can hear them.
    when you dispatch an event using actionscript, it is
    dispatched by an object (or sometimes by a class) and that event
    can only be detected by the dispatching object (or class).

  • Catching an Event

    Hello!
    In the main application I am dispatching a custom event:
    var e:Event=new Event("loggedinUserDataLoaded",true);
    dispatchEvent(e);
    In the itemRenderer component of another component hosted inside the parentApplication I am trying to catch it:
    addEventListener("loggedinUserDataLoaded",confirmCatch);
    However, this isn't working.
    What am I doing wrong please?

    hi,
    This might help a bit.......
    ok - main app
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:ns1="*">
    <fx:Metadata>
    [Event("TransferReady", type="flash.events.Event")]
    </fx:Metadata>
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:Button x="133" y="127" label="Button" click="dispatchEvent(new Event('TransferReady'));"/>
    <ns1:TestComponent x="556" y="162">
    </ns1:TestComponent>
    </s:Application>
    custom component.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" creationComplete="group1_creationCompleteHandler(event)">
    <fx:Script>
    <![CDATA[
    import mx.core.FlexGlobals;
    import mx.events.FlexEvent;
    protected function group1_creationCompleteHandler(event:FlexEvent):void
    FlexGlobals.topLevelApplication.addEventListener("TransferReady",onTransferReady);
    private function onTransferReady(event:Event):void
    ta.text="hello world";
    ]]>
    </fx:Script>
    <s:TextArea id="ta" top="0" left="0" bottom="0" right="0"/>
    </s:Group>

  • Simple Custom Events in Java

    Hello All
    I am new to Java hailing from C++ and ActionScript. I need to create a custom event system for use with various design patterns I'm using in a project (starting with MVC for the overall structure).
    From what I understand, I need to use the EventObject and EventListener base classes to derive my own custom classes from, in order to do this. In ActionScript, the events system works quite differently, having an EventDispatcher class you inherit from, etc. It also specify types of events as constants. So I'm a little confused as to how to do this.
    The following example seems to explain pretty much what I need:
    [http://exampledepot.com/egs/java.util/CustEvent.html|http://exampledepot.com/egs/java.util/CustEvent.html]
    ...but adapting this is giving me a bit of a headache, maybe because I'm stuck in the ActionScript event paradigm. Am I right in assuming I could simply pass an integer parameter in the event, specifying what type it is?Or do I need to specify a different class for each event type (extending either EventObject, or an interface which extends from EventObject each time)?
    Lastly, can someone tell me whether or not a native List implementation using generics might not work just as well for the given example as the EventListenerList used above ? (I see no reason to use Swing classes when I won't be using Swing at all... it just seems unclean. My app is a socket server and needs no UI functionality.)
    Thank you in advance.
    -Nick

    NickZA wrote:
    ...but adapting this is giving me a bit of a headache, maybe because I'm stuck in the ActionScript event paradigm. Am I right in assuming I could simply pass an integer parameter in the event, specifying what type it is?Or do I need to specify a different class for each event type (extending either EventObject, or an interface which extends from EventObject each time)?Noone forces you to use EventObjects of any kind. If you like (and it's sufficient for you), then you can simply pass any value you want or even no value to the event method in the Listener interface.
    So an event that's represented by the worldIsCollapsing() method might not need any additional information.
    Lastly, can someone tell me whether or not a native List implementation using generics might not work just as well for the given example as the EventListenerList used above ? (I see no reason to use Swing classes when I won't be using Swing at all... it just seems unclean. My app is a socket server and needs no UI functionality.)Basically yes, it would work just as well. The difference is that the EventListenerList can handle Listeners of different types (i.e. you can manage your FooListeners and your BarListeners using a single object, if you used simple Lists instead, you'd need two of those).

  • Custom Events and Scheduling more than once

    Hi,
    in BO 4.1, I successfully triggered WebI Report instance generation by a "Custom Event" through scheduling.
    Now, we have the requirement that the report should not be triggered only once but always when the event is triggered.
    At first glance, this looks tricky bc. in order that the report "reacts" to the event, the report itself must be scheduled with the event (it gets an instance "pending" that "wait + reacts" to the event). So it looks like we need schedule the report always manually with "event" before it is ready to react to the event specified in the scheduling.
    Is there any user-friendly trick to make the report react upon every fired event without having to "schedule" the report manually with the event?
    (Similar to schedule daily, just that the event is the trigger, note a daytime...)
    Best Regards

    Hi Florian,
    What is the frequency set under Recurrence option for the report instance?
    Can you give an idea like after how much time the event can be triggered?
    For example, if you are expecting the event to change in an hour, you can schedule the recurrence as hourly or you can specify something like 0 hours and 15 minutes or something like that.
    In that case, once the event is fired, your report instance will be ready to trigger after 15 minutes for the next run.
    Would suggest you to sync with the BO administrator as concurrent triggering of large number of instances can give load on Job Servers.
    Hope it will help in some way.
    Regards,
    Yuvraj

  • Can you send custom events from one form to another?

    I have a compli
    cated application, where I about hundred inp
    uts organized in several input forms. Some of the forms
    require data which has been input in other forms. I have tried to
    dispatch custom events from one form to another, but it dispatches the
    whole form and I only need one or two items.
    Ha anybody else come across such a problem?
    Svend

    One way is to share data in a static singleton

  • Custom Events and Listeners between classes

    I've got a project I've been working on for weeks that I'm
    having yet another problem with. I'm trying to learn AS3 which is
    why it's taking so long but that's not important for this post.
    I wanted to create a custom event class so that I could make
    sure the event does not interfere with other "COMPLETE" events that
    are being passed between classes. In other words, I have a few
    things that need to complete prior to a function being called...
    one is some XML being loaded and another is a font loaded. So, I
    thought I would create a custom FontLoaded class that extends Event
    and make the type something like "FontLoadedEvent.LOADED". That way
    I could listen for the XML "Event.COMPLETE" and this font event
    also.
    Please tell me if I'm going down the wrong path here but I
    don't seem to be getting the dispatched event for my new custom
    event. Also, how does one detect if it's being dispatched other
    than if the eventListener is fired? Any other ways to test
    this?

    You can trace the event to see if it dispatched.
    Also, this is not a good case to create a new event. Custom
    events are used to store additional information. MouseEvent exists
    because Event doesn't have localX, localY, etc. properties. Since
    you don't seem to be throwing additional properties, you can use a
    regular event.
    trace(dispatchEvent(new Event("panelFontsLoaded"));
    addEventListener("panelFontsLoaded", onFontsLoaded);
    Static consts are used to help debug typos. The event type is
    just a string, often stored in a const.

  • Issue in using custom event from outreach

    Hi
    I have created a custom event and executed a scenario successfully for this custom event from ACC. But when I try to configure the same event from Outreach(BCC), I am able to see this custom event in the list of available events, but after selecting this event there is no option to configure attributes for this event, but I can configure attributes in ACC. My BCC version is 10.1.1
    Edited by: 1002715 on Apr 26, 2013 3:06 AM

    Dear Ankit,
    Once the pricing procedure is downloaded, please maintain the document pricing procedure at service contract header level, and maintain the customer pricing procedure at business partner sales area billing data.
    In spro, maintain the pricing procedure for the combination of sales area, document pricing procedure, customer pricing procedure.
    Please crosscheck whether the condition table is active or not.
    Regards,
    Maddy

Maybe you are looking for

  • Does anyone else have an iMac that displays a non-selected desktop image at start-up?

    I bought my system new in 2009. It's a 2.66 GHz Core 2 Duo Intel processor with 4 GB 1067 MHz DDR3 installed memory. I'm running OSx 10.6.8 Mavericks. The behavior of not displaying my chosen desktop image is new and disturbing. Although the problem

  • Driver files in oracle jdbc library

    Hi, as all of you know that a file, classes32.zip distributed with oracle client to support jdbc connectivity is so huge in physical size on disk. But, some of my colleague told me that there are just 2 or 3 classes that are actually used by java app

  • Movement type to Scrap Return Stock

    Dear Experts ,                        Please let me know the movement type which is required to Clear the return Stock from the System(ie mmbe).Also if possible please mention the T Code . Regards, Chinmay

  • Exchange 2007/2013SP1 mailbox (15GB) migration stalled.

    We have successfully migrated all our mailboxes from Exchange 2007 to Exchange 2013SP1, except one mailbox with the 15GB size, which stalled at 95%, even we tried "Resume-MoveRequest", but again the same error: Here is the error: 4/14/2014 10:37:56 A

  • Can't backup PSE 5 - recovery stalls at 66%

    I haven't backed up my catalogue in several months (I know - I'm bad...!)   I reconnected missing pics, and then it started the Recovery - and stalled at 66%.  I've read that it might look stall at 33 or 66%, and that it might take some time - but th