Create Component that Listens for Custom Event

I've read a lot of tutorials and posts in this forum but still seem to be missing something.
I want to be able to create an arbitrary number of instances of a custom class (based on Button) that each listen to a custom event dispatched in the application.  Eventually the event will carry data (including information that will let each Button determine whether it should react to the event), but for now I just want them to be able to hear the event.
What's supposed to happen is
1) Clicking the button labeled "I Make the Button" creates an instance of EventHearingButton using this.addElement.
2) Clicking the button labeled "I Send the Event" dispatches the SuperCustomEvent custom event, with the additional information "I heard that" stored in the Information string
3) The created EventHearingButton hears the event and updates its label to the value in the Information string.
What actually happens is the EventHearingButton is created OK, but nothing happens when the "I Send the Event" button is clicked.
Main.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/halo">
     <fx:Metadata>
          [Event(name="SuperCustomEvent", type="Classes.SuperCustomEvent")]
     </fx:Metadata>
     <fx:Script>
          <![CDATA[
               import Classes.EventHearingButton;
               import Classes.SuperCustomEvent;
               protected function EventDispatcherButton_clickHandler(event:MouseEvent):void
                    var NewEvent:SuperCustomEvent = new SuperCustomEvent("I heard that");
                    this.dispatchEvent(NewEvent);
               protected function button1_clickHandler(event:MouseEvent):void
                    var NewButton:EventHearingButton = new EventHearingButton();
                    NewButton.x=270;
                    NewButton.y=130;
                    this.addElement(NewButton);
          ]]>
     </fx:Script>
     <s:Button x="270" y="90" label="I Send The Event" id="EventDispatcherButton" click="EventDispatcherButton_clickHandler(event)"/>
     <s:Button x="270" y="50" label="I Make the Button" click="button1_clickHandler(event)"/>
</s:Application>
Classes.EventHearingButton.as
package Classes
     import spark.components.Button;
     import flash.events.Event;
     import Classes.SuperCustomEvent;
     public class EventHearingButton extends Button
          public function EventHearingButton()
               super();
               this.label="I haven't heard yet";
               this.addEventListener(SuperCustomEvent.SUPERCUSTOMEVENT,SuperCustomEventHandler);
          private function SuperCustomEventHandler(event:SuperCustomEvent):void {
               this.label=event.EventInformation;
Classes.SuperCustomEvent.as
package Classes
     import flash.events.Event;
     public class SuperCustomEvent extends Event
          public var EventInformation:String;
          public static const SUPERCUSTOMEVENT:String = "SuperCustomEvent";
          public function SuperCustomEvent(Information:String)
               super(SuperCustomEvent.SUPERCUSTOMEVENT, true);
               this.EventInformation=Information;
          override public function clone():Event{
               return new SuperCustomEvent(EventInformation);

"nikos101" <[email protected]> wrote in
message
news:ga59t5$8nh$[email protected]..
>I tried something like what AMy described in a custom
component
>
> dispatchEvent(new Event("Cancelled_Form"));
>
> I then added the following Listener in my application
file;
>
> this.addEventListener("Cancelled_Form",cancelledForm);
>
> but it is never heard. Does anyone know what I have done
wrong?
Try attaching the event listener to your component rather
than the
application.
HTH;
Amy

Similar Messages

  • Dispatching & listening for custom events from custom component [Flex 4.1]

    I'm giving this a try for the first time and I'm not sure I have the recipe correct!
    I have a custom component - it contains a data grid where I want to double click a row and dispatch an event that a row has been chosen.
    I created a custom event
    package oss
        import flash.events.Event;
        public class PersonChosenEvent extends Event
            public function PersonChosenEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
                super(type, bubbles, cancelable);
            // Define static constant.
            public static const PERSON_CHOSEN:String = "personChosen";
            // Define a public variable to hold the state of the enable property.
            public var isEnabled:Boolean;
            // Override the inherited clone() method.
            override public function clone():Event {
                return new PersonChosenEvent(type);
    Then I try to dispatch the event within the component when the datagrid is doubleclicked:
    import oss.PersonChosenEvent
    dispatchEvent(new PersonChosenEvent(PersonChosenEvent.PERSON_CHOSEN, true, false));
    And in the parent application containing the component I do on creationComplete
    addEventListener(PersonChosenEvent.PERSON_CHOSEN,addPersonToList);
    The event does not seem to fire though. And if I try to evaluate the "new PersonChosenEvent(..." code it tells me "no such variable".
    What am I doing wrong?
    (It was so easy in VisualAge for Java, what have we done in the last 10 years?? )
    Martin

    I've done this kind of thing routinely, when I want to add information to the event.  I never code the "clone" method at all.
    Be sure that you are listening to the event on a parent of the dispatching component.
    You can also have the dispatching component listen for the event too, and use trace() to get a debug message.
    I doubt if it has anything to to with "bubbles" since the default is true.
    Sample code
    In a child (BorderContainer)
    dispatchEvent(new ActivationEvent(ActivationEvent.CREATION_COMPLETE,null,window));
    In the container parent (BorderContainer)
    activation.addEventListener(ActivationEvent.CREATION_COMPLETE,activationEvent);
    package components.events
        import components.containers.SemanticWindow;
        import components.triples.SemanticActivation;
        import flash.events.Event;
        public class ActivationEvent extends Event
            public static const LOADED:String = "ActivationEvent: loaded";
            public static const CREATION_COMPLETE:String = "ActivationEvent: creation complete";
            public static const RELOADED:String = "ActivationEvent: reloaded";
            public static const LEFT_SIDE:String = "ActivationEvent: left side";
            public static const RIGHT_SIDE:String = "ActivationEvent: right side";
            private var _activation:SemanticActivation;
            private var _window:SemanticWindow;
            public function ActivationEvent(type:String, activation:SemanticActivation, window:SemanticWindow)
                super(type);
                _activation = activation;
                _window = window
            public function get activation():SemanticActivation {
                return _activation;
            public function get window():SemanticWindow{
                return _window;

  • How to create many objects listening for one event

    I'm experimenting with the EventDispatcher class and I have a
    test class working. I want to use a loop to create a variety of
    movie clips that all listen for an event that gets dispatched every
    half a second. I have the event dispatching properly. My problem is
    that when creating the objects, the temporary variable I use to
    hold each created object has a life that extends beyond the loop in
    which it is instantiated. Rather than all five created objects
    changing color, only the last one changes color (see the code
    below--it lives on the first frame of an FLA file).
    This is not entirely surprising when I look at the code --
    'this' refers to the global scope and 'square' refers to the last
    created object that it pointed to. Here's the resulting trace:
    handler runing, square name is square 4
    this class name is global
    handler runing, square name is square 4
    this class name is global
    handler runing, square name is square 4
    this class name is global
    handler runing, square name is square 4
    this class name is global
    handler runing, square name is square 4
    this class name is global
    How can I modify this code so that each square object changes
    its own color?

    graphics.clear in the context of that function handler in my
    code would refer not to the squares but to the global scope,
    wouldn't it? In which case you'd be clearing all the graphics from
    your top level movie. I tried changing 'square.graphics' to just
    'graphics' in my handler and my squares just remained the original
    steady black.
    Your code doesn't use a loop and therefore isn't re-using a
    variable. You've escaped my 'logical errors' through brute force.
    (BTW, I think my code would work in AS2 if I used the old-school
    draw methods). Suppose you had to create 100 objects? Would you
    want to manually instantiate each one, typing that function over
    and over again? You'd have 500 lines of highly redundant code!
    Maybe try your example using a loop instead? I think you'll
    find it's pretty tough to sneak any vars like 'i' or 'square' from
    the global scope into the handler--the handler refers to the
    living, breathing variable rather than it's value at the time the
    handler was instantiated. Furthermore, you can't sneak any
    information about the square into your handler via the event object
    because the event object is created in a totally different place.

  • Component listening for a event

    I need to make 1 component listen for an event in another component..
    JMenuItem listens for a TreeSelectionEvent and in case something selected enables... and disables otherwise...
    addTreeSelectionListener() is not possible for a JMenuItem component...
    so how do i do that?
    the code below is not acceptable because there is a lot of JMenuItem objects and it's a bit messy and difficult to add each...
    tree.addTreeSelectionListener(blah) {
    JMenuItem.setEnabled(false);
    i want a component checking himself for a proper condition...
    in case it will require too much hardware resourses what would you suggest?

    Do you ever get to a point in programming where you think that perhaps i have choosen the wrong hobby to get infatuated about
    That code worked really well targetplanet but it had a side effect that just makes me nutts lol
      as it triggered a mouse event function in the component that was initialized in Main and just made my web site go nuts . the component that we initialized was a skin but its itemRenderer component that followed had the mouse event! perhaps i better start again with me learning perhaps i missed something
    or perhaps i should just have one component to one job instead of trying to be clever and mutitask with less components!

  • Listening for an event outside of the object...

    Hey, I spent a lot of my day trying to figure out how to
    listen for an event outside of an instantiated object of my own.
    I made my own class called
    Link. When my Link class is instantiated, a Loader object
    (var loader:Loader) is added and it loads a user-specified external
    PNG file. I want to track the Event.COMPLETE event OUTSIDE of my
    Link class, like in my FLA's Actionscript.
    So, I tried a few things without any luck, and by these you
    might get the idea of exactly what I'm trying to do:
    var link1:Link = new Link(...);
    link1.loader.addEventListener(Event.COMPLETE, handler);
    That didn't work, so I tried:
    var link1.Link = new Link(...);
    var loader = link1.getChildByName("loader") as Loader;
    loader.addEventListener(Event.COMPLETE, handler);
    ... that didn't work either. :(
    Any ideas?
    If I am taking the completely wrong approach please do let me
    know. If there's ANY way to know WHEN my loader has completed
    loading its image outside of my Link class...
    Thanks!
    ~ Andrew Merskin

    Let your Link class handle the Loader events. When
    Event.COMPLETE fires,
    just redispatch the event or dispatch a custom event.
    Example 1:
    link1.addEventListener("ALLDONELOADING", linkEventHandler);
    function linkEventHandler(event:Event)
    if(event.type == "ALLDONELOADING")
    // do something or nothing at all
    // Inside your link class you are listening for the load
    complete
    function loadCompleteHandler(event:Event)
    dispatchEvent(new Event("ALLDONELOADING")));
    Example 2:
    link1.addEventListener(Event.COMPLETE, linkEventHandler);
    function linkEventHandler(event:Event)
    if(event.type == Event.COMPLETE)
    // do something or nothing at all
    // Inside your link class you are listening for the load
    complete
    function loadCompleteHandler(event:Event)
    dispatchEvent(event);

  • Listening for keyPressed events from background?

    Is it possible to have a java program running in the background and listen for keyPressed events? I would like for the program to listen for certain keys to be pressed and when they are manipulate the mouse. From what I've looked at so far however it seems the listening component must have focus. Thanks.

    On any OS that would typically involve hooking into the OS itself.
    And then manipulating OS resources as well.
    Putting an app into the 'background' is also OS specific.
    Given that the above is all you want to do then java is not an appropriate language choice. C++ would be better.

  • Listening for click event

    I am curious, how can you have a child mxml page listen for
    an event from the parent?
    Let's say you have a button, call it 'btn1' on page1.mxml and
    you want to listen for the click event on page2.mxml. So far this
    is what I have:
    page1.mxml:
    <mx:Button id="btn1" />
    page2.mxml:
    <mx:Script>
    <![CDATA[
    private function btnListener(e:MouseEvent){
    Application.application.btn.addEventListener(MouseEvent.CLICK,
    setState(1));
    ]]>
    </mx:Script>

    "spacehog" <[email protected]> wrote in
    message
    news:glljts$g04$[email protected]..
    >I am curious, how can you have a child mxml page listen
    for an event from
    >the
    > parent?
    >
    > Let's say you have a button, call it 'btn1' on
    page1.mxml and you want to
    > listen for the click event on page2.mxml. So far this is
    what I have:
    >
    > page1.mxml:
    >
    > <mx:Button id="btn1" />
    >
    > page2.mxml:
    >
    > <mx:Script>
    > <![CDATA[
    >
    >
    > private function btnListener(e:MouseEvent){
    >
    Application.application.btn.addEventListener(MouseEvent.CLICK,
    > setState(1));
    > }
    > ]]>
    > </mx:Script>
    Check out Q3:
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf

  • Listening for an event in main from a component

    Hi
    Ok so i have a Flash Builder project 4.5 that i created in Flash Catalyst thats draws all its data from MySql and four months into the build, as this is my first web project im noticing that when the page loads up in the browser it loads everything at once! and as im hoping to reuse some of the same components for diffrent tasks i assume that if i put the data retrivail under events that happen within the web page this will hopeful control the data flow as well as showing the correct data depending on CurrentState!
    The problem that im having is that my buttons are in my Main Application and the data retrival process is in my components! so i was trying to create addEventListener(MouseEvent.CLICK events in a component that was listening for events in my Main application. i have search the internet but every one is talking about the process in the main or component but not both!
    Does anyone know what im talking about and could you please share some light please

    Do you ever get to a point in programming where you think that perhaps i have choosen the wrong hobby to get infatuated about
    That code worked really well targetplanet but it had a side effect that just makes me nutts lol
      as it triggered a mouse event function in the component that was initialized in Main and just made my web site go nuts . the component that we initialized was a skin but its itemRenderer component that followed had the mouse event! perhaps i better start again with me learning perhaps i missed something
    or perhaps i should just have one component to one job instead of trying to be clever and mutitask with less components!

  • Listen for an events for Swing objects in a separate class?

    Hi all, sorry if this is in the wrong section of the forum but since this is a problem I am having with a Swing based project I thought i'd come here for help. Essentially i have nested panels in separate classes for the sake of clarity and to follow the ideas of OO based development. I have JPanels that have buttons and other components that will trigger events. I wish for these events to effect other panels, in the Hierachy of my program:
    MainFrame(MainPanel(LeftPanel, RightPanel, CanvasPanel))
    Sorry I couldnt indent to show the hierarchy. Here LeftPanel, RightPanel and CanvasPanel are objects that are created in the MainPanel. For example i want an event to trigger a method in another class e.g. LeftPanel has a button that will call a method in CanvasPanel. I have tried creating an EventListner in the MainPanel that would determine the source and then send off a method to the relevant class, but the only listeners that respond are the ones relevant to the components of class. Can I have events that will be listened to over the complete scope of the program? or is there another way to have a component that can call a method in the class that as an object, it has been created in.
    Just as an example LeftPanel has a component to select the paint tool (its a simple drawing program) that will change a color attribute in the CanvasPanel object. Of course I realize i could have one massive Class with everything declared in it, but I'd rather learn if it is possible to do it this way!
    Thanks in advance for any help you can offer
    Lawrence
    Edited by: insertjokehere on Apr 15, 2008 12:24 PM

    Thanks for the response, ive added ActionListneres in the class where the component is, and in an external class. The Listeners work inside the class, but not in the external class
    import java.awt.event.ActionEvent;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    public class LeftPanel extends JPanel implements ActionListener {  
        /* Constructing JButtons, null until usage of the constructor */
        JButton pencilBut;
        JButton eraserBut;
        JButton textBut;
        JButton copyBut;
        JButton ssincBut;
        JButton ssdecBut;
        ActionListener a = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.print("\nNot supported yet.");
        /* The Top Panel contains the title of program */
        public LeftPanel(Dimension d){
            /* Sets up the layout for the Panel */
            BoxLayout blo = new BoxLayout(this,BoxLayout.Y_AXIS);
            this.setLayout(blo);
            /* Sets Up the Appearance of the Panel */
            this.setMinimumSize(d);
            this.setBackground(Color.RED);
            this.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
            /* Pencil Tool */
            pencilBut = new JButton("Pencil");
            pencilBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            pencilBut.setActionCommand("pencil");
            pencilBut.addActionListener(a);
            this.add(pencilBut);
            /* Eraser Tool */
            eraserBut = new JButton("Eraser");
            eraserBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            eraserBut.addActionListener(a);
            this.add(eraserBut);
            /* Text Tool */
            textBut = new JButton("Text");
            textBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            textBut.addActionListener(a);
            this.add(textBut);
            /* Copy Previous Page */
            copyBut = new JButton("Copy Page");
            copyBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            copyBut.addActionListener(a);
            this.add(copyBut);
            /* Stroke Size Increase */
            ssincBut = new JButton("Inc");
            ssincBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            ssincBut.addActionListener(a);
            this.add(ssincBut);
            /* Stroke Size Decrease */
            ssdecBut = new JButton("Dec");
            ssdecBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            ssdecBut.addActionListener(a);
            this.add(ssdecBut);
            System.out.print("\nLeftPanel Completed");
        public void actionPerformed(ActionEvent e) {
            System.out.print("\nAction Performed");
        }But this is not picked up in my external class here
    import java.awt.event.ActionEvent;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    public class MainPanel extends JPanel implements ActionListener {
        /* Creates a new the main JPanel that is used in the FlipBookFrame to contain all of the elements */
        public MainPanel(){
            /* TopPanel constraints*/
            tpcs.gridx = 1;
            tpcs.gridy = 0;
            tpcs.gridwidth = 1;
            tpcs.gridheight = 1;
            tpcs.fill = GridBagConstraints.BOTH;
            tpcs.weightx = 0.0;
            tpcs.weighty = 1.0;
            /* LeftPanel Constraints*/
            lpcs.gridx = 0;
            lpcs.gridy = 0;
            lpcs.gridwidth = 1;
            lpcs.gridheight = 3;
            lpcs.fill = GridBagConstraints.BOTH;
            lpcs.weightx = 1.0;
            lpcs.weighty = 1.0;
            /* CentrePanel Constraints*/
            cpcs.gridx = 1;
            cpcs.gridy = 1;
            cpcs.gridwidth = 1;
            cpcs.gridheight = 1;
            cpcs.fill = GridBagConstraints.NONE;
            cpcs.weightx = 0.0;
            cpcs.weighty = 0.0;
            /* RightPanel Constraints*/
            rpcs.gridx = 2;
            rpcs.gridy = 0;
            rpcs.gridwidth = 1;
            rpcs.gridheight = 3;
            rpcs.fill = GridBagConstraints.BOTH;
            rpcs.weightx = 1.0;
            rpcs.weighty = 1.0;
            /* BottomPanel Constraints*/
            bpcs.gridx = 1;
            bpcs.gridy = 2;
            bpcs.gridwidth = 1;
            bpcs.gridheight = 1;
            bpcs.fill = GridBagConstraints.BOTH;
            bpcs.weightx = 0.0;
            bpcs.weighty = 1.0;   
            this.setLayout(gblo);   //Sets the Layout of the panel to a GridBagLayout
            this.add(tp, tpcs); //Adds the TopPanel to the MainPanel using the TopPanel layout
            this.add(lp, lpcs); //Adds the LeftPanel to the MainPanel using the LeftPanel layout
            this.add(cp, cpcs); //Adds the CanvasPanel to the MainPanel using the CanvasPanel layout
            this.add(rp, rpcs); //Adds the RightPanel to the MainPanel using the RightPanel layout
            this.add(bp, bpcs); //Adds the BottomPanel to the MainPanel using the BottomPanel layout
            gblo.layoutContainer(this); //Lays Out the Container
        public PanelSizes getPanelSizes(){
            return ps;
        public void actionPerformed(ActionEvent e) {
            System.out.print("\nExternal Class finds event!");
            /*String command = e.getActionCommand();
            if (command.equals("pencil")){
                System.out.print("\nYESSSSSSSSSSSSSSSSSSSSS!");
        /* Create of objects using the PanelSizes funtions for defining the */
        PanelSizes ps = new PanelSizes();   //Creates a new PanelSizes object for sizing the panel
        CanvasPanel cp = new CanvasPanel(ps.getCentrePanelDimension()); //Creates a new Canvas Panel
        TopPanel tp = new TopPanel(ps.getHorizontalPanelDimension()); //Creates the TopPanel
        BottomPanel bp = new BottomPanel(ps.getHorizontalPanelDimension()); //Creates the BottomPanel
        LeftPanel lp = new LeftPanel(ps.getVerticalPanelDimension()); //Creates the LeftPanel
        RightPanel rp = new RightPanel(ps.getVerticalPanelDimension());   //Creates the RightPanel
        /* I have chosen to create individual constraints for each panel to allow for adding of all
         components a the end of the constructor. This will use slightly more memory but gives clarity
         in the code */
        GridBagConstraints cpcs = new GridBagConstraints();
        GridBagConstraints tpcs = new GridBagConstraints();
        GridBagConstraints bpcs = new GridBagConstraints();
        GridBagConstraints lpcs = new GridBagConstraints();   
        GridBagConstraints rpcs = new GridBagConstraints();
        GridBagLayout gblo = new GridBagLayout();
    }Any help will be greatly appreciated :-)

  • How to create new bol structure for custom ztable.

    Hi gurus,
    I am new to SAP CRM 2007. I have a requirement in which I need to create a view which will retreive data from my custom z table. But when you create a view , the wizard ask for Model nodes and, Bol entity, Bol relation etc. Kindly let me know what data I need to enter here so that I can relate to my custom table. I think I need to create a bol structure for my ztable. Kindly guide me in this regard.
    Thanks & Regards,
      Sanjay

    I would recommend to rather use an encapsulation of the ztable into BOL than just trying to work with value nodes because it heavily simplifies building of the UI and code to load, edit and save.
    In order to achieve this you would either have to build a genIL component and assign it to the BOL component set addressed in the runtime repository of the UI component to make it available on the UI layer.
    If your table is very simple and does not require relations etc. you might save some work using the approach via "Simple Objects" concept of BOL which provides a pretty generic impelmentation that requires much less code and deep understanding of the BOL/ genIL.
    Pleasse refer to the respective IMG node under
    Customer Relationship Management -> CRM Cross-Application Components -> Generic Interaction Layer/ Business Object Layer -> Component-specific Settings
    Hope this helps.
    Peter

  • How to Create DI Discount Group for Customer Group?

    Hi All,
    i'm trying to create DiscountGroups for Type Customer Group in developtmnt side in sap b1. i already succed to create  Discount Group for Type Specific BP as you can see in the code i wroe below:
    di.BusinessPartners MyBP= GetBusinessObject (BoObjectTypes.oBusinessPartners) as di.BusinessPartners;
    MyBp.DiscountGroup.DiscountPercentage=20;
    but i don't succed to find the di object that give me the option to create DiscountGroup for Customer Group ( not for specific BP).
    i will very appriciate to get any help with it...
    Regards,
    Peer Shoval

    hello, maybe you could try with DI Server, if your installation allows
    that.
    try experimenting with
    -> EnhancedDiscountGroupsService Object
    SAPbobsCOM.EnhancedDiscountGroupsService dg_service = null;
                    SAPbobsCOM.EnhancedDiscountGroup dg = null;
                    SAPbobsCOM.EnhancedDiscountGroupCollectionParams collDGParams = null;
                    dg_service = (SAPbobsCOM.EnhancedDiscountGroupsService)((SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany())
                                    .GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.EnhancedDiscountGroupsService);
                    collDGParams = dg_service.GetList();
                    dg = (SAPbobsCOM.EnhancedDiscountGroup)dg_service.GetDataInterface(SAPbobsCOM.EnhancedDiscountGroupsServiceDataInterfaces.edgsEnhancedDiscountGroup);
                    dg.Type  = SAPbobsCOM.DiscountGroupTypeEnum.dgt_AllBPs;
                    dg.ValidFrom = DateTime.Now;
                    dg.ValidTo = DateTime.MaxValue;
                    dg.ObjectCode = "dontknow";
                    dg.DiscountRelations = SAPbobsCOM.DiscountGroupRelationsEnum.dgrAverageDiscount;
                    //dg.DiscountGroupLineCollection.Add() //etc
                    SAPbobsCOM.EnhancedDiscountGroupParams dg_param = dg_service.Add(dg);
                    log.DebugFormat("Added discount group  {0} - {1} - {2}", dg_param.AbsEntry, dg_param.ObjectCode , dg_param.Type);

  • Listener for dispatched event

    Hi,
    I had a problem which the majority of got sorted out with
    help from other people but it's left me with one last part i dont
    get...
    I have a main.swf which loads into a loader an external swf
    called menu1.swf. I'm trying to get a function triggered in the
    main.swf when it recieves an event dispatched from the menu1.swf.
    The main problem i had was getting the event to dispatch from the
    loaded swf but that's now sorted. My main problem now is where to
    add the listener in the main.swf to listen out for this event.
    I've been informed it's not the loader i should be attaching
    the listener to, but rather it's contents ( the function i want to
    call is to unload the loader once the event from the contents of
    that loader has been dispatched). Now the contents is menu1.swf,
    but i didnt think you could attach a listener to a swf? I was also
    told that once the loader has completed loading, the swf is no
    longer a swf, but instead becomes content.data...
    So what am i attaching a listener to? should it be
    loader.content.data.addEventlistener(... );
    it's got me stumped?

    Hi kglad - thanks for the reply.
    Just want to point out im using the TweenMax engine to call
    the function which will dispatch the event in the loaded.swf.
    I've added the code you suggested to the loaderComplete
    function in my main.swf script like you suggested ( to guarantee
    their be some content in the loader) and got this:
    TypeError: Error #1034: Type Coercion failed: cannot convert
    flash.events::Event@4097da9 to flash.events.MouseEvent.
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at menu_1/menu_1::callUnload()[C:\Users\andrew\Desktop\New
    Folder (2)\work\menu_1.as:164]
    at Function/
    http://adobe.com/AS3/2006/builtin::apply()
    at
    gs::TweenLite/complete()[C:\Users\andrew\Desktop\flash\actionscripts\gs\TweenLite.as:416]
    at
    gs::TweenFilterLite/render()[C:\Users\andrew\Desktop\flash\actionscripts\gs\TweenFilterLi te.as:361]
    at
    gs::TweenLite$/executeAll()[C:\Users\andrew\Desktop\flash\actionscripts\gs\TweenLite.as:3 95]
    dont suppose you know what all that means do you? I've read
    that theirs a bug in the onComplete tween of the TweenMax engine -
    any chance that's what this is at all?...

  • Documentation for custom event listeners

    Hi,
    I am searching in portal 8.1 documents for using custom events, coding and registering event listeners, and using them in jsp pages. So far my search has been unsuccessful.
    Can some one let me know where i find this info?
    -thanks

    Hi J, 
    Thanks for your reply.
    I didn’t find the custom work item Web Access control Official documents, but you can refer to the information in these articles(it’s same in TFS 2013):
    http://blogs.msdn.com/b/serkani/archive/2012/06/22/work-item-custom-control-development-in-tf-web-access-2012-development.aspx
    http://blogs.msdn.com/b/serkani/archive/2012/06/22/work-item-custom-control-development-in-tf-web-access-2012-deployment.aspx
    For how to debug TFS Web Access Extensions, please refer to:
    http://www.alexandervanwynsberghe.be/debugging-tfs-web-access-customizations/.
    For the custom work item Web Access control Official documents, you can
    submit it to User Voice site at: http://visualstudio.uservoice.com/forums/121579-visual-studio. Microsoft engineers will evaluate them seriously.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Listener for custom JTable

    I need to know when a user clicks in a certain column in a JTable. This column displays checkboxes. How do i implement a listener for this and where do i put it? I've tried implementing actionlistener with an editor class, but the event never fires.

    In the future, Swing related questions should be posted in the Swing forum.
    You need to add a TableModelListener to the TableModel. It will notify you when the value of a cell is changed.

  • I need help figuring out how to creat a button listener for my panel

    import java.awt.*;
       import java.awt.event.*;
       import javax.swing.*;
       import java.util.Scanner;
        public class ExpressionCalculatorPanel extends JPanel
       // Variables to be used
          private JLabel inputLabel, resultLabel;
          private JTextField ExpressionCalculator;
          private JButton computeButton;
       //  Constructor: Sets up the main GUI components.
           public ExpressionCalculatorPanel()
             inputLabel = new JLabel ("Enter a value of x");
             resultLabel = new JLabel ("Final result = ---");
             ExpressionCalculator = new JTextField (5);
             ExpressionCalculator.addActionListener(new ButtonListener());
               // Set buttons and listeners
             computeButton = new JButton("Compute Final Result");
             computeButton.addActionListener(new ButtonListener());
               // Add to panels
             add (computeButton);
             add (inputLabel);
             add (resultLabel);
             setPreferredSize (new Dimension(300, 75));
             setBackground (Color.white);
       //  Represents an action listener for the temperature input field.
           private class ButtonListener implements ActionListener
          //  Performs the conversion when the enter key is pressed in
          //  the text field.
              public void actionPerformed (ActionEvent event)
       }

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Scanner;
    public class ExpressionCalculatorPanel extends JPanel
    // Variables to be used
    private JLabel inputLabel, resultLabel;
    private JTextField ExpressionCalculator;
    private JButton computeButton;
    // Constructor: Sets up the main GUI components.
    public ExpressionCalculatorPanel()
    inputLabel = new JLabel ("Enter a value of x");
    resultLabel = new JLabel ("Final result = ---");
    ExpressionCalculator = new JTextField (5);
    ExpressionCalculator.addActionListener(new ButtonListener());
         // Set buttons and listeners
    computeButton = new JButton("Compute Final Result");
    computeButton.addActionListener(new ButtonListener());
         // Add to panels
    add (computeButton);
    add (inputLabel);
    add (resultLabel);
    setPreferredSize (new Dimension(300, 75));
    setBackground (Color.white);
    // Represents an action listener for the temperature input field.
    private class ButtonListener implements ActionListener
    // Performs the conversion when the enter key is pressed in
    // the text field.
    public void actionPerformed (ActionEvent event)
    }

Maybe you are looking for

  • Should I set up my mac air or time capsule first?  Both seem to need each other

    I got a mac air and time capsule.  Which sould I set up first.  I have tried setting up both but I seem to get stuck as both need to be set to to work together (of course).  Any suggestions? 

  • XI in a SOA landscape  - licensing

    We are in the process of formulating a SOA strategy. We want our webservices platform to be on .NET and since SAP doesn't have webservices management tool we are also evaluating Amberpoint/Actional. SAP has not clearly spelt out how licensing will wo

  • Returning clause issue

    drop table mytest create table mytest(sid number, sname varchar2(40),source_id number, flag varchar2(1)); insert into mytest (SNAME,SOURCE_ID, FLAG) values ('kd',null,null); insert into mytest (SNAME,SOURCE_ID,FLAG) values ('kd',null,null); commit; c

  • Setting the 'save as' location

    I'm using acrobat 9 standard on windows xp pro. I use 'save as' a lot and tend to save most times to the same location. Each time I 'save as' it defaults to the location where I opened the file. Can I change a setting so that when I 'save as' it defa

  • Storing dates in oracle

    Hi all, Probably it might be a silly question, but it just made me wonder... how??? Here is my query.... It seems oracle stores dates in an internal numeric format, representing the century, year, month, day, hours, minutes and seconds. For example 0