Fire Custom Event in as3

Hello All,
I have an variable of type boolean , and I want to fire event when I change the value of this variable , how can I do that in AS3
Thanks in Advance

Thank you for your help
I have tried this solution but it doesn't work with me
may be I have so explain my proplem in more details
I have two XML files , the first file has some configration options I want to load for my Project , and I want to make sure that I have load them before loading the second file that will have the data
I have define the loader and handle the onComplete event and parse the first file and make some operations and when I call the function that will load the second file after the last operation of the handler of the first file it load it more than once
and If I call it after the calleng of the first file haldler it call it once but it doesn't execute the operations
Thanks in Advance

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

  • Custom event in as3

    Custom event example in as3
    Hi,
    Event listener model in cs3 looks nice it is not same as we
    were heaving earlier in as2 or till flash 8.
    Here is an example of using and making your own custom event
    in as3.
    This example allow user to load n number of XML file when XML
    file is loaded then dispatch an event "XMLLoaded" which can be
    listen by any other class any where.
    There are two class
    1. CustEvent
    2. DEvt
    Here are the definition of both class
    CustEvent.as
    * Author - Sanjeev Rajput
    * Date - 16-July-07
    * class is used to load any XML file and dispatch an event
    when XML is loaded
    package eventDispatch{
    import flash.events.Event;
    public class CustEvent extends Event {
    public static const XMLLoaded:String = "XMLLoaded";// Event
    Name
    public var XMLData:XML // loaded XML data
    public var XMLRef:String // XML file name
    public function CustEvent(type:String,
    param:String,param1:XML) {
    this.XMLData= param1;
    this.XMLRef=param;
    super(type);
    DEvt.as
    * Author - Sanjeev Rajput
    * Date - 16-July-07
    * class is used to load any XML file and dispatch an event
    when XML is loaded
    package eventDispatch{
    import flash.events.EventDispatcher;
    import flash.net.URLLoader;
    import flash.events.Event;
    import flash.net.URLRequest;
    public class DEvt extends EventDispatcher {
    private var xmlLdr:URLLoader;
    private var urlr:URLRequest;
    private var xmlpath_str:String;
    public var XMLData:XML;
    private var counter:int=0;
    private var xmlRequestArr:Array
    public function DEvt():void {
    this.xmlRequestArr=new Array()
    public function loadXML(fileRef:String,xmlRef:String):void {
    this.xmlpath_str=fileRef;
    this.xmlRequestArr.push(xmlRef)
    this.xmlLdr = new URLLoader();
    this.urlr=new URLRequest(this.xmlpath_str);
    this.xmlLdr.addEventListener(Event.COMPLETE,
    completeHandler);
    this.xmlLdr.load(this.urlr);
    private function completeHandler(evt:Event) {
    this.XMLData=new XML(evt.target.data);
    this.dispatchEvent(new
    CustEvent(CustEvent.XMLLoaded,this.xmlRequestArr[this.counter],this.XMLData));
    this.counter++
    evtDispatchExample.fla
    Inside this fla on very first frame I have following code
    import eventDispatch.*;
    var DEvt_obj:Evt=new DEvt();
    DEvt_obj.loadXML("xml.xml",'xml0 File');
    DEvt_obj.loadXML("xml1.xml",'xml1 File');
    DEvt_obj.loadXML("xml2.xml",'xml2 File');//----and so on---
    DEvt_obj.addEventListener(CustEvent.XMLLoaded,XMLL oaded);
    function XMLLoaded(evt:CustEvent) {
    //--- here we can check which XML file is loaded----
    if(evt.XMLRef=='xml0'){
    //--- do necessary task when this file loaded
    //---XML data can be found in evt.XMLData
    trace(evt.XMLData) //-- property of CustEvent class
    if(evt.XMLRef=='xml1'){
    //--- do necessary task when this file loaded
    //---XML data can be found in evt.XMLData
    trace(evt.XMLData) //-- property of CustEvent class
    //---- and so on for n number of XML file----
    }

    Have you tested this online with varyious file sizes? Seems
    to me there that
    there is no guarantee as to when a loader will complete its
    task. If the
    second request completed before the first, how would you
    dispatch the
    correct information?

  • Dispatching Custom Events Help

    Hello Everyone,
    I am just learning how to handle custom events, and after spending couple of days tring to understand the process, I am unable to get it going. What I am trying to do is to write a Two Button (component/swf). So when I need to utilize this component in other projects, I can simply load the the swf and be able to fire the buttons.
    I have two button objects on the stage, and I would like these two button object to fire custom events when the parent component is loaded as swf in other projects. Perhaps, I am going all wrong about what I am tring to accomplish here, I would highly appreciate your help.
    After some research, I concluded that I will need to employ Custom Event(s) going for my component. I spent hours on google and have not been able to get it working.
    Here is my code:
    ============================
    CustomEvent Class
    ============================
    package com.custom.apps
        import flash.events.Event;
        public class CustomEvent extends Event
            public static const CUSTOM:String = "custom";
            public var arg:*;
            public function CustomEvent(type:String, customArg:*=null, bubbles:Boolean=false, cancelable:Boolean=false)
                super(type, bubbles, cancelable);
                this.arg = customArg;
            public override function clone():Event
                return new CustomEvent(type, arg, bubbles, cancelable);
            public override function toString():String
                return formatToString("CustomEvent", "type", "arg",    "bubbles", "cancelable", "eventPhase");
    ============================
    DISPATCHING THE EVENTS
    ============================
    import com.custom.apps.*;
    btn.addEventListener(MouseEvent.CLICK, clickHandler);
    function clickHandler(e:MouseEvent):void
        dispatchEvent(new Event(CustomEvent.CUSTOM, customHandler));
        //trace("FIRED");
    function customHandler(e:CustomEvent):void
        trace(e.target);
        trace('hello');

    Kalisto,
    I appreciate your help. Do I have this right? So I can build a navigation component with two links:
    LINK1 | LINK2
    then I load this navigation component/swf into another project and when I click on either of the links, it will dispatch a CUSTOM EVENT and when the event is dispatched, lets say I have a  function (sayHello) listening for that particular event and when the CUSTOM EVENT is dispatched when one of the navigation component's link is clicked the (sayHello()) function would fire itself.
    Can this be done? Am I on the right track?
    I have been at it for couple of days now, I am able to dispatch the event but don't know how to have a function listen for the events. I would highly appreciate it if you can have look at my code.
    Thanks a lot

  • 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.

  • Mac OS / classpath / custom event problem

    I'm having a bit of trouble with a particular classpath
    anomaly, and I have a feeling that it might be a Mac thing.
    Not sure if anyone else can reproduce this, but I managed to
    make a custom event and a class that extends the EventDispatcher
    once. Since then, Flash has refused to admit that any class
    associated with a custom event exists - mostly producing the error
    1046. Even after you take out any references to the event
    dispatcher or a custom event, the class is ignored.
    All my classes are kept in a single 'Packages' folder with
    sub folders that I include in the import statement (I've
    triple-checked the classpath settings, the import statements, and
    the classes themselves - I have probably a hundred or so other
    classes that are fine, and all referenced in the same way, some
    that extend EventDispatcher, some that don't.
    I come across this a few times now - once I was able to fix
    it by putting the .as file in the same folder as my first custom
    event, but this no longer works.
    I'm running Mac OS X 4.11 on two computers - both have the
    same trouble.
    I've tried copying the classes to other folders and changing
    the package/import path accordingly - no go.
    Even stranger, if you copy and paste to a new .as file, and a
    different package folder, the problem persists in that Flash claims
    the revised Package statement (to reflect the new location) does
    not reflect the position of the file - when it clearly does.
    I haven't had this problem with any other home-grown class -
    only those that reference a custom event.
    It sounds like it should be pilot error, and I've spent a
    long time trying to spot a silly mistake. But as this problem has
    recurred a few times now, I'm beginning to think it isn't me.
    Anybody else experience similar classpath problems with AS3
    on a Mac? Anybody have any suggestions?

    I am also a newbie and my answer could be wrong.
    But from the looks of it, You are Unable to load performance pack.
    The solution is "Please ensure that libmuxer library is in :'.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
    I hope BEA or someone can tell you the file name of libmuxer. And make sure it is in the Folder where the script is searching/looking.
    Good luck.
    fred

  • 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;
    }

  • Custom Event

    I need to communicate between two different controllers associate with different sections of FXML.
    I create a custom even and implemented an event handler in one of my controllers.
    I can not seem to figure out how to fire the custom event from my other controller. So far the documentation I have found doesn't fill in the blank about firing an event from a controller or even any other class than one that already has .fireEvent as a member.
    Am I using the wrong design pattern here or is there an easy solution to fire an event?
    pseudo
    public class myEvent extends Event {
         private static final long serialVersionUID = 1261846397820142663L;
         public static final EventType<myEvent >MY_EVENT = new EventType<myEvent >(ANY, "MY_EVENT");
         public myEvent (EventType<? extends Event> arg0) {
              super(arg0);
              // TODO Auto-generated constructor stub
         public myEvent () {
              this(MY_EVENT);
    public class myClass implements EventHandler<myEvent> {
         @Override
         public void handle(TimelineDropEvent arg0) {
              // TODO Auto-generated method stub
              System.out.println("MyEvent");
    public class myOtherClass {
    //TODO what do I do here to fire an event
    }Obviously both of my sample classes also implement Initializable since they are controllers.
    In my event do I absolutely need serialVersionUID or is there another way to avoid the warning associated with removing it?

    Sorry for the delay. I had to create a Google Code project to host the example:
    http://code.google.com/p/sjmb/
    The source code for the message bus API is here:
    http://code.google.com/p/sjmb/source/browse/#svn%2Ftrunk%2Fsjmb%2Fsrc%2Fcom%2Foracle%2Fsjmb
    It essentially allows callers to subscribe to "message topics", which are simply Java types. Any time an instance of a given type is sent, subscribed listeners are notified. Any Java type can be used including enums, which provide a nice, type-safe way to define messages.
    An example demonstrating how to use the API is here:
    http://code.google.com/p/sjmb/source/browse/#svn%2Ftrunk%2Fsjmb%2Ftest%2Fcom%2Foracle%2Fsjmb%2Ftest
    The main application window presents a tab pane containing 3 identical tabs. Each tab's controller subscribes to a message of type com.oracle.sjmb.test.Message. Entering text in the text field and pressing the "Send Message" button sends a new message, causing the other two tabs to update the contents of their own text fields to match.
    The example application consists of the following files:
    Message.java - the message class
    MessageBusTest.java - the main JavaFX application class
    message_bus_test.fxml - FXML document containing the main scene
    tab.fxml - FXML document containing tab pane content
    TabController.java - tab content controller
    Javadoc and binaries are available here:
    http://code.google.com/p/sjmb/downloads/list
    Please note that this is an example only and is not an official part of any Oracle product. Let me know if you have any questions.
    Greg

  • Eventhandlers of children of application can not receive custom event dispatched by application

    Hello dear Adobe community,
    hope you can help me with this issue.
    When the application dispatches a custom event, the child uicomponent can only receive the event by using Application.application.addEventListener or systemManager.addEventListener. Simply adding a listener, without application or systemmanager, does not allow the event to be received by the child component.
    I want to be able to use the addEventListener and removeEventListener without SystemManager or Application.application, or could you provide a better workaround? How can I use the addEventListener, do I need to overwrite EventDispatcher, which I wouldnt like to do?
    Just to clarifiy, if i remove the systemManager in front of addEventListener(CustomEventOne.EventOne,sysManHandleCE,false) it will not add it and will not fire. 
    The code below is an example for this problem that the event is not getting fired in the right moment. The mainapplication got only a button with the customEventOne that gets dispatched.
    public
    class MyCanvas extends Canvas{
    public function MyCanvas()
    super();
    width=300;
    height=300;
    addEventListener(FlexEvent.CREATION_COMPLETE,handleCC,false,0,true);
    private function handleCC(event:FlexEvent):void
    removeEventListener(FlexEvent.CREATION_COMPLETE,handleCC);
    addEventListener(CustomEventOne.EventOne,handleCE,false,0,true);
    addEventListener(Event.REMOVED_FROM_STAGE,handleEvt,false,0,true);
    systemManager.addeventListener(CustomEventOne.eventOne,sysManHandleCE,false,0,true);
    private function handleEvt(event:Event):void
    trace("In removed from stage handler");
    systemManager.removeEventListener(CustomEventOne.EventOne,sysManHandleCE);
    trace(hasEventListener(FlexEvent.CREATION_COMPLETE));
    trace(hasEventListener(CustomEventOne.EventOne));
    trace(hasEventListener(Event.REMOVED_FROM_STAGE));
    private function handleCE(event:CustomEventOne):void
    trace("I got it");
    private function sysManHandleCE(event:CustomEventOne):void
    trace("I got it");
    public class CustomEventOne extends Event
    public static const EventOne:String = "EventOne";
    public function CustomEventOne(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
    super(type, bubbles, cancelable);
    override public functionclone():Event
    return newCustomEventOne(type,bubbles,cancelable);
    Thank you in advance,
    Michael

    I think you need to look at event propogation. The object that dispatches an event will be sitting on the display tree. The event propagates up the tree to the roots. Your canvas should be attached to the application, but even then it sits lower in the tree branches than the event dispatcher, so it won't see the event being dispatched because the event is not propagated to the children of the object that dispatches it but to the parent of the object that dispatches it.
    So, your canvas is a child of the application, but dispatching the event from the application means that the canvas doesn't see it because events are notified up the tree using the parent link, not the child links.
    You may wish to investigate how the display list and event propagation works and then the MVC pattern.
    Paul

  • Creating custom event listener ?

    Hello,
    Is there anyone that have a link to a tutorial or have some information on what is needed to be able to create a custom event listener on a component ?
    I am creating an interactive JSF chart library (JSFlot) and I would like to have events such as ChartDraggedEvent and ChartClickedEvent. I can create the events fine (and I can even queue them fine throught the standard action and actionListener interfaces), but I would like for the component to have attributes like chartDraggedListener and chartClickedListener, so that I can fire off the appropriate event to the appropriate listener.
    Any help would be very much appreciated!

    Well, that is what I am doing. The Renderer:
    if (event != null && event.equalsIgnoreCase("drag")) {
                        String componentValue = request.getParameter("componentValue");
                        //Cut out logic irrelevant for this example
                        FlotChartDraggedEvent dragEvent = new FlotChartDraggedEvent(component, dragValue);
                        dragEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
                        dragEvent.queue();
                   } else if (event != null && event.equalsIgnoreCase("click")) {
                        //Cut out logic irrelevant for this example                    
                        FlotChartClickedEvent clickEvent = new FlotChartClickedEvent(component, clickedPoint, clickIndexInt, clickSeriesIndexInt, clickSeriesLabel);
                        clickEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
                        clickEvent.queue();
                   }The problem though, is that both of these events gets delivered to the actionListener attribute of my component. What I assume is missing is functionality to register a custom listener for each event, and some code in the Tag-class and TLD to supply these listeners, and its these issues that I am unsure how is done. I may be missing something very basic here though :)

  • Interactive Form for HCM Processes & Forms: Custom Event not firing ?

    ECC6
    EP7
    Adobe Reader: 8.1.2
    I am currently developing several Adobe interactive forms as part of an HCM Processes and Forms process. I have started to try to utilize custom form events. Following the documentation, I defined a custom event on the backend...lets say "USER_EVENT_S1". I assigned it a field group of fields and gave it the operation for "check". On the form side, I defined a pushbutton and changed it's "mousedown" FormCalc code to:
    //Set ISR_EVENT for BAdI processing in backend
    $record.CONTROL_PARAM.ISR_EVENT = "USER_EVENT_S1"
    I then activated the form and went to test it. When clicking the button tied to this event, it does absolutly nothing. I have external breakpoints set on the backend to my custom service that should fire for those fields that are part of the field group. The breakpoints trigger correctly as the form itself loads and hits the "initialize" and "F4 value help" methods. However, it is not doing anything when I press the assigned button to trigger my own user event.
    Any help ?!?!? I see only one implementation from SAP in their standard content and their own user event is not even implemented in the form! (form scenario S_HRPA_DE_REHIRE_1). That's not very reassuring or helpful. haha

    I figured it out this morning. It seems I was using the wrong (older?) button control.
    The one that did NOT work had the following for the "click" event....
    //Trigger call to backend for BAdI user command processing
    app.eval("event.target.SAPSubmit();");
    However, the one that DOES work has this:
    //Trigger call to backend for BAdI user command processing
    ContainerFoundation_JS.SendMessageToContainer(event.target, "submit", "", "", "", "");
    Both are called an "ISR_FormEventButton" however, I guess mine was from an older "library". Anyways...works great now! Back to development....
    (points to the reply for trying to help at least! Thanks!)

  • 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 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

  • Custom event never reaching Listening function

    Hi all, I have been having a problem usign a custom event... I attached it to the the main class using "addEventListener" and fire it off with "dispatchEvent" in another class. I checked that it was attached to the main class using "hasEventListener" and it returned true, also "dispatchEvent" returns true... but it ever reaches the function that I attaced it to... is there any thing I am missing?
    Thanks a lot

    i assume by main class you mean document class.
    1.  is the listener function in your document class?
    2.  is the even listener added before the event is dispatched?
    if no to either (or both), you need to fix that.
    if yes and yes, you don't have a correct reference to your document class.

  • Post a custom event with jsp portlet

    I have a portal page which contains a jsp portlet and a couple of other portlets.
    The jsp has several links and when the links are clicked and the page is redrawn on the portal, I want the jsp portlet to fire events to which the other portlets in the page can react to.
    To achieve this, I have attached a backing file to a jsp portlet and have a custom event being fired (from the handlePostBack method) when certain conditions are met. The problem is that the handlePostBack method is not called in the jsp portlet lifecycle (only init(), preRender() and destroy() are called). I realize it may be because the urls dont have the _nfpb parameter set. I did try adding that to the link url - but no luck.
    Will someone point me as to what is wrong with the setup described above.
    ram.

    Kevin,
    How would I use postbackURL tag on a url which already has the "?" appended - for example if my url is "/somedomain/something.portal?cmd=4", the postbackUrl tag converts it as "/somedomain/something.portal?cmd=4?_nfpb=true&_page_Label=..."
    Shouldnt it have the intelligence to sense that the url already contains "?" and hence it should use '&' to append further parameters.
    Also if I strip out my "?cmd=4" from the url and just provide the bare url so that it is now free to add the "?_nfpb=true" to the url, how do I instruct the tag to later append my cmd=4 parameter to the query string? I see an attribute called "parameters" but how do I provide a name value pair? Or should I simply provide the string "cmd=4" as attribute value?
    As of now I am contructing the url object and the jsp looks a bit unwieldy though it works :)
    Thanks,
    Ram.

Maybe you are looking for

  • Ichat video - waiting for response

    Everytime I try to start a video chat on iChat, the partner I am trying to chat with will recieve my request, accept it, but iChat continues to say "waiting for a response". We can wait for 10 minutes and it still never connects. I don't have any fir

  • C2D not as bright as CD

    I Got a c2d as a replacement for my old CD. Anyone else notice a difference in the display brightness of the C2D as opposed to the CD

  • ALV LIST - Amounts alignment

    Hi Experts, I worked on a development for showing G/L Balance sheet details. Screen shot as show below. We want to display the amounts of 'BALANCE SHEET TALLY' in proper format. The corresponding amounts should come under the respective Header. Like

  • Partial clearing of pacman cache

    Is there a way of partially clearing the cache of old packages. I'll explain, every now and then I have to downgrade a package, due to some sort of issue, (usually wine or ati packages). Down grading to the previous version is usually good enough, bu

  • Adobe upgrade error : The upgrade patch cannot be installed..."

    Hi, I work in an office and while I was trying to patch up some computers that have Adobe 7.0 Pro (others have 8.0 Pro), I received the following message "The upgrade patch cannot be installed by windows installer service because the program to be up