Global event handler for preinitialize

Is there anyway to add a global event handler on the
components preinitialize event?
What I need to do is to be able to enable / disable, and show
/ hide component dynamically based on a access list. My plan was to
have a global event handler that listens to the preinitialize
event, at that time, checks if the user has access to the component
or not. If not, I'll disable / hide the component.
What I did so far is:
in my main app.mxml file, I have:
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
preinitialize="preinit(event)"
so the preinit() function is invoked on the app's
preinitialize event.
Then I have the preinit() function (see attached code below).
However, it does work as there is no trace message printed.
I changed to use KeyBoardEvent.KEY_DOWN and that seems
working when I press any key.
I also tried to use the app.stage.addEventListener() but the
stage object is null in the preinitialize event.
Thanks in advance for your help.

Thank you for follow up on my question.
I do know these two properties. But that does not solve the
problem. Let me explain it with an example.
That's say, when the user logs in, I loads the access list.
Then the app displays a panel with some form entries. If I am able
to register a global event listener for the component
initialization events, I can check the permission and optionally
hide some components. Otherwise, I would need to programmatically
travels my component tree to evaluate each component individually
to set there visible/includeInLayout properties, which is error
prone.
The problem is that the component is visible to one user but
would be hidden to another, so it can not be set at the design
time.
The approach I am using right now is to extend the default
components to add an event listener. But I'd like to know if it is
possible to register a global event listener to be notified when
any component is created. As my first post says, I tried to use the
systemManager and listen to the PREINITIALIZE event, but that
didn't get always get invoked.

Similar Messages

  • Unable to get automatic event handling for OK button.

    Hello,
    I have created a form using creatobject. This form contains an edit control and Search, Cancel buttons. I have set the Search buttons UID to "1" so it can handle the Enter key hit event. Instead its caption changes to Update when i start typing in the edit control and it does not respond to the Enter key hit. Cancel happens when Esc is hit.
    My code looks like this -
    Dim oCreationParams As SAPbouiCOM.FormCreationParams
            oCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
            oCreationParams.UniqueID = "MySearchForm"
            oCreationParams.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable
                    Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.AddEx(oCreationParams)
    oForm.Visible = True
    '// set the form properties
            oForm.Title = "Search Form"
            oForm.Left = 300
            oForm.ClientWidth = 500
            oForm.Top = 100
            oForm.ClientHeight = 240
            '// Adding Items to the form
            '// and setting their properties
            '// Adding an Ok button
            '// We get automatic event handling for
            '// the Ok and Cancel Buttons by setting
            '// their UIDs to 1 and 2 respectively
            oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 5
            oItem.Width = 65
            oItem.Top = oForm.ClientHeight - 30
            oItem.Height = 19
            oButton = oItem.Specific
            oButton.Caption = "Search"
            '// Adding a Cancel button
            oItem = oForm.Items.Add("2", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 75
            oItem.Width = 65
            oItem.Top = oForm.ClientHeight - 30
            oItem.Height = 19
            oButton = oItem.Specific
            oButton.Caption = "Cancel"
    oItem = oForm.Items.Add("NUM", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 105
            oItem.Width = 140
            oItem.Top = 20
            oItem.Height = 16
            Dim oEditText As SAPbouiCOM.EditText = oItem.Specific
    What changes do i have to make to get the enter key to work?
    Thanks for your help.
    Regards,
    Sheetal

    Hello Felipe,
    Thanks for pointing me to the correct direction.
    So on refering to the documentation i tried out a few things. But I am still missing something here.
    I made the following changes to my code -
    oForm.AutoManaged = True
    oForm.SupportedModes = 1 ' afm_Ok
    oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 5
            oItem.Width = 65
            oItem.Top = oForm.ClientHeight - 30
            oItem.Height = 19
    oItem.SetAutoManagedAttribute(SAPbouiCOM.BoAutoManagedAttr.ama_Visible, 1, SAPbouiCOM.BoModeVisualBehavior.mvb_Default)
            oButton = oItem.Specific
            oButton.Caption = "OK"
    AND
    oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE
    oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 5
            oItem.Width = 65
            oItem.Top = oForm.ClientHeight - 30
            oItem.Height = 19
    oItem.AffectsFormMode = False
    I get the same behaviour OK button changes to update and enter key does not work.
    Could you please tell me find what is it that i am doing wrong?
    Regards,
    Sheetal

  • EmailRecieved Event handler for incoming email in Sharepoint 2013

    Hi,
    I am developing custom event handler to enable incoming email for custom document library.  i have couple of questions.
    1. Once i attached the event handler, i could see incoming email settings for the custom document library, but it displays only 2 options as below :
                  1.   Allow this document library to recieve email
                                 Yes       No
                    2. E-mail address
    All other properties are not displaying. Is this normal behaviour on custom event handler for custom document library or any issue anywhere?
    2. So i have given other properties using powershell as below:
    $list = $web.lists["invoice Documents"]
    $list.EmailAlias ="TestDocument"
    $list.EnableAssignToEmail = $true
    $list.rootFolder.Properties["vti_emailusesecurity"] = 1
    $list.rootFolder.Properties["vti_emailsaveattachments"] = 1
    $list.rootFolder.Properties["vti_emailattachmentfolders"] = "root"
    $list.rootFolder.Properties["vti_emailoverwrite"] = 0
    $list.rootFolder.Properties["vti_emailsavemeetings"] = 0
    $list.rootFolder.Properties["vti_emailsaveoriginal"] = 0
    $List.RootFolder.Update();
    $list.Update();
    here i have given vti_emailusesecurity as 1, so it should allow incoming email for the user who has permission for the list.
    But any user from the domain is sending mail to this list, the Emailrecieved event handler is triggered. I am expecting that this event handler should not be triggered and expecting access denied error in the ULS Log. But that is not happening, and emailrecived
    is triggered and email is delivering to this address successfully.
    Can you please anyone help if experience on this?
    Thanks
    Sathya

    http://www.coretekservices.com/2012/01/26/sharepoint-content-organizer-%25e2%2580%2593-emailing-your-drop-off-library-and-getting-it-to-work
    Central Administration > Monitoring > Review Job Definitions (under Timer Jobs) > Content Organizer Processing
    Also check below:
    http://tutorial.programming4.us/windows_server/SharePoint-2010---Content-Organizer-as-a-Document-Routing-Tool.aspx
    If this helped you resolve your issue, please mark it Answered

  • How to add event handling for a menu?

    hi,
    I have created a menu and few mneu items.
    for eachmenu itme , i did event handling and it is workign fine.
    it was like this
    menuItem = new JMenuItem("Exit",KeyEvent.VK_X);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));
    menuItem.addActionListener(this);
    menu.add(menuItem);
         public void actionPerformed(ActionEvent e)
    JMenuItem source = (JMenuItem)(e.getSource());
    String s = "Action event detected. Event source: " + source.getText();
    System.out.println(s);     
    public void itemStateChanged(ItemEvent e)
    JMenuItem source = (JMenuItem)(e.getSource());
    String s = "Item event detected. Event source: " + source.getText();
    System.out.println(s);
    now int he second menu i don't have any menu item and i want to do the event handling for the menu itself. any ideas how to do it. following is the code for the menu
    //Build the second menu.
    menu2 = new JMenu("Options");
    menu2.setMnemonic(KeyEvent.VK_O);
    menuBar.add(menu2);
    menu2.addActionListener(this);     //this does nto work

    You were on the right track. However, selecting a menu is different from selecting a menu item. MenuItem chucks an ActionEvent and Menu will send an ItemEvent.
    If you pile all action output to one actionPerformed method then be careful of your assumptions on what the source type will be. If by any chance the Menu has sent an ActinoEvent then your code will have caused a ClassCastException.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MenuTest implements ActionListener, ItemListener {
        JMenuItem menuItem;
        JMenu menu1, menu2;
        JMenuBar menubar;
        JFrame frame;
        public MenuTest() {
            frame = new JFrame("MenuTest");
            frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
            menubar = new JMenuBar();
            frame.setJMenuBar(menubar);
            menu1 = new JMenu("File");
            menu1.setMnemonic(KeyEvent.VK_F);
            menuItem = new JMenuItem("Exit",KeyEvent.VK_X);
            menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));
            menuItem.addActionListener(this);
            menu1.addItemListener(this);
            menu1.add(menuItem);
            menubar.add(menu1);
            //Build the second menu.
            menu2 = new JMenu("Options");
            menu2.setMnemonic(KeyEvent.VK_O);
            menu2.addActionListener(this); //this does not work
            menu2.addItemListener(this); // use this instead
            menubar.add(menu2);
            JPanel panel = new JPanel();
            panel.setPreferredSize(new Dimension(100,100));
            frame.getContentPane().add(panel);
            frame.pack();
            frame.show();
        public void actionPerformed(ActionEvent e)
            String s = "Action event detected. Event source: " + e.getSource();
            System.out.println(s);
        public void itemStateChanged(ItemEvent e)
            String s = "Item event detected. Event source: " + e.getSource();
            System.out.println(s);
        public static void main(String[] args) {
            new MenuTest();
    }

  • Event handler for STDIN input?

    Hi,
    This question will probably require a bit of context - I'm attempting to re-implement in java an application that's currently written in perl. The application is a server helper app that rewriters urls; it receives a request ID and a URL on stdin, does the necessary munging (which can require an external SOAP query), then returns the resulting rewritten URL.
    Since the results can be asynchronous due to the need for external queries to build the result, this is currently a multithreaded perl app implemented using perl's POE framework to register an event handler for stdin. That handler fires each time a line of input is received, then feeds the query to a thread pool manager (POE::Component::Pool::Thread, which is conceptually similar to the Executor frameworks). The thread returns the result as a callback registered to another function in the main thread, which then populates the query/result to a cache then outputs the result (with the original query ID) on stdout. Since stdin input and the result callbacks are event-driven, there's no while(true) main loop or other blocking mechanism in the main thread. Unfortunately, it's perl-ness is causing problems due to perl's threading implementation (three words: "copy on init"), so we need to reimplement in a language with a more robust threading implementation (preferably one with copy-on-write for shared objects). So, Java it is.
    So far everything's been good - Executor, Callables, and Futures work as I hoped they would for proper thread management, and the internal worker thread logic (XML processing, SOAP, regular expressions, etc) is proving rather simple to adapt. However, the main roadblock I'm hitting is that so far, I have not found a way to register any sort of event handler for STDIN input (or more specifically, InputStreamReader/BufferedStreamReader events). This could be due to search engine pollution - everything I see when I search for documentation on event listeners appears to be GUI-specific (buttons, menus, text areas/forms, etc). I'm just looking for a way to handle a line of STDIN, not a text area on a form.
    Any pointers in the right direction will be much appreciated!

    rekoil wrote:
    Maybe I need to rethink the design here...
    The main reason I used a callback in the original perl is that there's a large cache structure that gets checked before the thread dispatch, and only cache misses get pushed to a thread for processing. Callbacks from the threads will then add its results to the cache. Thanks to perl's thread model, when I attempted to make the cache a shared structure - in perl, you have to explicitly mark as "shared" variables that you want visible to all threads - the structure wound up getting copied to every thread, and this gave the app an unacceptable memory footprint. So the solution was to use a callback in the main thread to update the cache.
    I'm now thinking that if Java's thread model is a bit saner (i.e. a shared object doesn't get copied into every thread), then I could just have each thread update the cache, print its output to STDOUT directly, and avoid the need for the callback. I can then make my input loop simply a while() loop, waiting for the next input to dispatch. Sound sane?Yes I think so.
    There is some of this I still don't entirely understand. Your loop sounds better now but it sounds to me like the process is this.
    1) read from in
    2) call some stuff on the basis of what came in
    3) do work
    4) workers produce things
    5) things written back out
    6) read back in??
    If you're just going in/out then great. If you are going in/out/in then maybe some sort of PipedInput/Output Streams? It may well be that I got lost in your explanation in which case never mind.

  • Global Event Listeners for all Views in a ViewNavigatorApplication

    Hello,
    As the subject states, I have a ViewNavigatorApplication and I am trying to set up a "global" event listener for all views. Which I am able to do, however I am having problems...
    In my first view, I assign this listener:
    NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys);
    And I also have this function:
    public function handleKeys(event:KeyboardEvent):void {
         if (event.keyCode == Keyboard.MENU) {
                        trace("menu pressed");
                        navigator.pushView(MainMenuView);
    This works fine from the first view. But when I switch views, I get an exception on pushView (navigator is null). I think I understand why, so what is the best practice for something like this? How can I get access to the spark component navigator from that function when called from a different view? Or is there a better way to go about this?
    Thank you!

    Try putting the code in the main mxml:
    <?xml version="1.0" encoding="utf-8"?>
    <s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        firstView="home"
        applicationComplete="init()" >
        <fx:Script>
            <![CDATA[
                private function init():void {
                    this.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys);
                private function handleKeys(event:KeyboardEvent):void {

  • Override event handler for document events in LiveCycle

    I would like to have an email notification when a user opens a policy-protected DRM pdf. Is there a way to override the event handler for Document Open events?
    Or perhaps there is a way to access the event database- where can I find this information?

    Thank you so much for your reply. I have created an external authorization and am following the steps outlined here: http://help.adobe.com/en_US/livecycle/9.0/programLC/help/index.htm?content=001479.html
    I have deployed my jar and restarted JBoss. However, now when I try to create a new policy using my external authorization, I do not see an option to add it on the create new policy page. I see only sections for Users and Groups, General Settings, Advanced Settings, and Unchangeable Advanced Settings. Could you please tell me how to add the external authorization?
    Also, in the component.xml file, I followed the sample and kept this line: <component-id>com.adobe.livecycle.samples.externalauthorization</component-id>
    Should that be changed? If so, to what?
    Thanks.

  • Event Handling for Graphic Shapes

    Hi guys,
    I have a problem on the implementation of a piece of software that i'm making, to be more specific i implement a GUI. In this GUI i draw rectangles, lines and that kind of things.
    The problem is that i want when clicking on a rectangle, an event to take place such as the drawing of something else, or a message, etc.
    How am i to achieve that? I've tried many things but didn't succeeded it unfortunately. How am i going to "give" life to my rectangles by adding event handling for them? What code should i write?
    Note: My class extends JPanel & i'm using paint(Graphics g) for drawing the shapes
    Thanks,
    John.

    Try this:
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.util.*;
    public class Shapes extends JFrame
         DPanel pan = new DPanel();
    public Shapes()
         addWindowListener(new WindowAdapter()
              public void windowClosing(WindowEvent ev)
                   dispose();
                   System.exit(0);
         setBounds(10,10,400,350); 
         setContentPane(pan);
         setVisible(true);
    public class DPanel extends JPanel implements MouseListener
         Vector shapes = new Vector();
         Shape  cs;
    public DPanel()
         addMouseListener(this);
         shapes.add(new Rectangle(20,20,100,40));
         shapes.add(new Rectangle(40,80,130,60));
         shapes.add(new Line2D.Double(20,150,200,180));
    public void paintComponent(Graphics g)
         super.paintComponent(g);
         Graphics2D g2 = (Graphics2D)g;
         for (int j=0; j < shapes.size(); j++)
              g2.draw((Shape)shapes.get(j));
         g.setColor(Color.red);
         if (cs != null) g2.draw(cs);
    public void mouseClicked(MouseEvent m) {}
    public void mouseEntered(MouseEvent m) {}
    public void mouseExited(MouseEvent m)  {}
    public void mouseReleased(MouseEvent m){}
    public void mousePressed(MouseEvent m)
         for (int j=0; j < shapes.size(); j++)
              Shape s = (Shape)shapes.get(j);
              Rectangle r = new Rectangle(m.getX()-1,m.getY()-1,2,2);
              if (s.intersects(r))
                   cs = s;
                   repaint();
    public static void main (String[] args) 
          new Shapes();
    }Noah

  • An event handler for several subclasses.

    I've been trying to write an event handler that is parameterized by a window
    being passed to it. The event handler is intended to handle the exception event
    that occurs when the window completes. I have had problems trying to write this.
    The scenario is as follows.
    I have a task that listens to events that respresent requests for a window being
    opened. On receiving these, it starts the window, also as an asynchronous task.
    The windows that may be opened (say window classes B, C, and D) are all
    subclasses of window class A. The event handler that I register for (after
    instantiating the window) takes a window of class A as parameter. It responds to
    the exception events for the Display() method of window passed in.
    Now the problems I have encountered are as follows :
    To allow the event handler to respond to the exception event of a window of
    class A, class A has the exception event defined for it. To allow me to start a
    window of class B where completion = event, I also have to define the same
    exception event. This hides the return and exception for class A. The
    implications of this in the event handler is that the event cannot be trapped
    unless I cast the parameter passed in into class B on the ' when return_event '
    line. This makes the event handler specific to class B.
    (This situation is also presumable caused by the fact that each subclasses
    overrides the Display method of window class A, and the exception event is
    defined for the Display method.)
    An alternative approach I tried was using interfaces. I defined the exception
    event as an event on an interface. This was defined with the same parameters as
    the exception events of classes B, C, and D would have (ie. the exception
    event had two parameters - one of type GenericException, and one of ErrorMgr). I
    then made classes B, C, and D implement the interface. The event handler
    parameter would be the interface rather than class A. However class B would not
    compile as the GenericException parameter for the event in the interface uses
    the input mechanism, but the GenericException parameter for the exception event
    in the display event of classes B, C, and D uses copy input. I have ben unable
    to find a way to change the mechanism for event parameters.
    Has anybody got any ideas as to how I may be able to achieve the goals of an
    event handler that can respond the exception event of a number of subclasses.
    Thanks
    Steve Elvin
    Systems Developer
    Frontline Ltd.
    UK.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Steve,
    Try this. Have a method in your super class A , say StubDisplay
    which processes the event loop.
    Also make this method return Exception and/or completion events you
    desire.
    Instead of overriding Display() in your sublclasses, override this
    StubDisplay method.
    You need not have to redefine the exception/completion events in
    your sublclasses B,C ..because they naturally inherit from the super class
    A.
    Using interfaces may not be a good idea in this case because, you
    will be forced to implement them in your subclasses even if you dont
    need them in some specific cases.
    Good luck!
    Ajith Kallambella M.
    Forte Systems Engineer,
    Internationational Business Corporation.
    From: [email protected][SMTP:[email protected]]
    Reply To: [email protected]
    Sent: Wednesday, May 13, 1998 4:42 AM
    To: [email protected]
    Subject: An event handler for several subclasses.
    I've been trying to write an event handler that is parameterized by a
    window
    being passed to it. The event handler is intended to handle the exception
    event
    that occurs when the window completes. I have had problems trying to write
    this.
    The scenario is as follows.
    I have a task that listens to events that respresent requests for a window
    being
    opened. On receiving these, it starts the window, also as an asynchronous
    task.
    The windows that may be opened (say window classes B, C, and D) are all
    subclasses of window class A. The event handler that I register for (after
    instantiating the window) takes a window of class A as parameter. It
    responds to
    the exception events for the Display() method of window passed in.
    Now the problems I have encountered are as follows :
    To allow the event handler to respond to the exception event of a window
    of
    class A, class A has the exception event defined for it. To allow me to
    start a
    window of class B where completion = event, I also have to define the same
    exception event. This hides the return and exception for class A. The
    implications of this in the event handler is that the event cannot be
    trapped
    unless I cast the parameter passed in into class B on the ' when
    return_event '
    line. This makes the event handler specific to class B.
    (This situation is also presumable caused by the fact that each subclasses
    overrides the Display method of window class A, and the exception event is
    defined for the Display method.)
    An alternative approach I tried was using interfaces. I defined the
    exception
    event as an event on an interface. This was defined with the same
    parameters as
    the exception events of classes B, C, and D would have (ie. the
    exception
    event had two parameters - one of type GenericException, and one of
    ErrorMgr). I
    then made classes B, C, and D implement the interface. The event handler
    parameter would be the interface rather than class A. However class B
    would not
    compile as the GenericException parameter for the event in the interface
    uses
    the input mechanism, but the GenericException parameter for the exception
    event
    in the display event of classes B, C, and D uses copy input. I have ben
    unable
    to find a way to change the mechanism for event parameters.
    Has anybody got any ideas as to how I may be able to achieve the goals of
    an
    event handler that can respond the exception event of a number of
    subclasses.
    Thanks
    Steve Elvin
    Systems Developer
    Frontline Ltd.
    UK.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Event handling for textfields

    I would like to make ONE event-handler for users who
    - presses Return/Enter from a field or
    - uses the mouse to jump to another field or
    - uses the tab-key to jump to another field.
    Can this be handled by using only one event-handler, ex. focusLost ?
    I appreciate your answer.
    Have a nice day.

    I used a single FocusListener with 3 different TextFields to select all the text in a TextField whenever the TextField gained focus, plus updated the other 2 TextFields based on the contents of the third when the third lost focus. Is that like what you are looking for?

  • Sleutel Bind, fancy key events handler for standalone window managers

    I began using Openbox in my laptop a while ago, and I was amazed by the speed, customization and simplicity it provides. After I started customizing my desktop I noticed that some of the special keys (TouchpadToggle, Volume, PrintScreen, etc) didn't worked at all. There are some applications for the Volume keys to work, but not for keys like touchpad-toggle and print-screen. Of course, there's a workaround for each case using simple scripts, but I wanted something a little more fancy, so I made:
    Sleutel Bind
    It's made in C and provides key events handling for:
    XF86TouchpadToggle
    Print (prtsc key)
    It makes use of libnotify to display states ( touchpad enabled/disabled, screenshot taken, etc) and imlib2 (a very popular library, probably already installed in your system) to grab the screenshots. Almost all other keys are covered already by another application, but if needed, more key events will be added in the future.
    Feel free to post your thoughts about Sleutel Bind, it's my first contribution to the community.
    How to use
    Once installed just run the command as a normal user.
    If using openbox, place the following command in the "~/.config/openbox/autostart" file:
    sleutelb &
    Links
    AUR
    github
    Last edited by DanielRS (2013-03-01 21:58:35)

    mgmillani wrote:
    I believe it must have been a bug and it was fixed, since print screen now works as expected. I'm using xmonad version 0.11-9, with ghc version 7.8.3.
    davama wrote:
    Note: for my print key to be recognized by xev i had to hold the ctrl key. that way it was not registered by xmonad. Also for xev command i use
    xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
    Nice, that seems to be useful. Thanks!
    @LQYMGT
    Do you still have issues with the latest version? Otherwise I will mark this thread as solved.
    well, still do not work... But I do not want to try it any more...So you can mark.

  • How to use common event handler for selected movie clips?

    I have a 50-state map in a flash movie. Each state is a movie
    clip.
    Goal: when mouse moves over a state or is clicked in a state,
    the state will be highlighted in a bright color and a small box
    will pop up near the state and display some information about the
    state.
    Question: I know I can add mouse event handler for each state
    movie clip. But this is simply not good since this has to be done
    50 times and codes thus scattered different places. Ideally, I only
    want to have one script that determines where the mouse position is
    when events trigged and then do right things (highlight the state
    and display info. in a pop-up). How can this be implemented?
    Thanks!

    There are a number of ways. Which way is best depends on how
    you have things set up so far.
    E.g. If they have an enumerable naming convention:
    e.g. each clip is like state_0 , state_1 etc.
    Then you can loop through them and assign them all to the
    same mouse event handler via the loop. You would need properties
    other than the name of the clip to identify the state. E.g. each
    clip could contain its own data or the index could be a pointer to
    the state data (objects with state name and info properties) in a
    separate array.
    //state clips named
    for (var i=0;i<50;i++) {
    this["state_"+i].stateindex=i;
    this["state_"+i].onPress= statePressHandler;
    var stateData:Array = [{name:"StateName,info:"this state
    Info"}, name:"StateName,info:"this state Info"}, etc...]
    function statePressHandler() {
    trace(this);
    trace(stateData[this.stateindex].name+"="+stateData[this.stateindex].info);
    Other ways are possible too but the best approach depends on
    how you have named the clips and whether you're creating them with
    code or whether they're already on stage from authoring (my guess).
    If they're already on stage and they're called "Alaska" etc, then I
    would be inclined to put them all inside a container clip that
    contains nothing else other than states. It would avoid the need
    for an array of clip names or for checking some other specific
    property of each clip to determine if its a 'state' clip and not
    something else in a for..in loop.

  • Event Handling for messages

    I would like to know how to handle events for messages i maintained in zmesg01.
    messages are follow:    when gv_spfli is initial
                                 "No such flight available.
                                when  gv_scarr is initial.
                                  "Flight name not available          with help of raise event ?
    pls suggest.
    *       CLASS lcl_mytestclass DEFINITION
    class lcl_mytestclass definition.
    public section.
       data: gt_spfli type table of spfli initial size 20,
               gt_scarr type table of scarr initial size 20.
       methods: get_data.
       events: data_not_found.
    endclass.                    "lcl_mytestclass DEFINITION
    *       CLASS lcl_mytestclass IMPLEMENTATION
    class lcl_mytestclass implementation.
    method: get_data.
       select * from spfli into table gt_spfli.
       if ( sy-subrc <> 0 ).
         raise event data_not_found.
         endif.
    select * from scarr into gt_scarr
    for all entries in gt_flight where  carrname = gt_spfli-carrname.
    if sy-subrc  <> 0.
    " How to call event for flight_name_not_found ?"
    raise event flight_name_not_found.
      endmethod.                    "get_data
      endclass.                    "lcl_mytestclass IMPLEMENTATION
    *       CLASS handler DEFINITION
    class handler definition.
    public section.
       methods handle_event
               for event data_not_found of lcl_mytestclass.
    endclass.                    "handler DEFINITION
    *       CLASS handler IMPLEMENTATION
    class handler implementation.
    method handle_event.
       write: / 'Data not found'.
    endmethod.                    "handle_excess
    endclass.                    "handler IMPLEMENTATION
    data: oref type ref to lcl_mytestclass,
         h1   type ref to handler.
    start-of-selection.
    create object: oref, h1.
    set handler h1->handle_event for all instances.
    call method oref->get_data.
    Thanks in advance.
    Anee.

    Hello Anee
    Events are not used for this kind of message handling.
    If you want to collect all messages then use a message handler (see sample report ZUS_SDN_ABAP_OO_MSG_HANDLING ).
    Alternatively, you may define an exception class and raise a class-based exception which contains the detailed error message.
    The following sample report is based on the more elaborate Wiki posting
    [Message Handling - Finding the Needle in the Haystack|https://wiki.sdn.sap.com/wiki/display/profile/2007/07/09/MessageHandling-FindingtheNeedleintheHaystack]
    *& Report  ZUS_SDN_ABAP_OO_MSG_HANDLING
    *& Thread: Event Handling for messages
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1052131"></a>
    REPORT  zus_sdn_abap_oo_msg_handling.
    TYPE-POOLS: abap.
    *       CLASS lcl_mytestclass DEFINITION
    CLASS lcl_mytestclass DEFINITION.
      PUBLIC SECTION.
        DATA: gt_spfli TYPE TABLE OF spfli INITIAL SIZE 20,
                gt_scarr TYPE TABLE OF scarr INITIAL SIZE 20.
        METHODS: constructor.
        METHODS: get_data
                       IMPORTING
                     value(id_carrid) TYPE s_carr_id.
        METHODS: has_messages
                   RETURNING value(rd_result)  TYPE abap_bool.
        METHODS: display_messages.
        EVENTS: data_not_found.
      PROTECTED SECTION.
        DATA: mo_msglist    TYPE REF TO if_reca_message_list.
    ENDCLASS.                    "lcl_mytestclass DEFINITION
    *       CLASS lcl_mytestclass IMPLEMENTATION
    CLASS lcl_mytestclass IMPLEMENTATION.
      METHOD constructor.
        me->mo_msglist = cf_reca_message_list=>create( ).
      ENDMETHOD.                    "constructor
      METHOD has_messages.
        IF ( me->mo_msglist->is_empty( ) = abap_false ).
          rd_result = abap_true.
        ENDIF.
      ENDMETHOD.                    "has_messages
      METHOD display_messages.
    * define local data
        DATA:
          ld_handle           TYPE balloghndl,
          lt_log_handles      TYPE bal_t_logh,
          ls_profile          TYPE bal_s_prof.
        " Get log handle of collected message list
        ld_handle = me->mo_msglist->get_handle( ).
        APPEND ld_handle TO lt_log_handles.
    *   get a display profile which describes how to display messages
        CALL FUNCTION 'BAL_DSP_PROFILE_DETLEVEL_GET'
          IMPORTING
            e_s_display_profile = ls_profile.  " tree & ALV List
    *   set report to allow saving of variants
        ls_profile-disvariant-report = sy-repid.
    *     when you use also other ALV lists in your report,
    *     please specify a handle to distinguish between the display
    *     variants of these different lists, e.g:
        ls_profile-disvariant-handle = 'LOG'.
        CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
          EXPORTING
            i_s_display_profile          = ls_profile
            i_t_log_handle               = lt_log_handles
    *       I_T_MSG_HANDLE               =
    *       I_S_LOG_FILTER               =
    *       I_S_MSG_FILTER               =
    *       I_T_LOG_CONTEXT_FILTER       =
    *       I_T_MSG_CONTEXT_FILTER       =
    *       I_AMODAL                     = ' '
    *     IMPORTING
    *       E_S_EXIT_COMMAND             =
          EXCEPTIONS
            profile_inconsistent         = 1
            internal_error               = 2
            no_data_available            = 3
            no_authority                 = 4
            OTHERS                       = 5.
        IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDMETHOD.                    "display_messages
      METHOD: get_data.
        SELECT * FROM spfli INTO TABLE gt_spfli
          WHERE ( carrid = id_carrid ).
        IF ( sy-subrc NE 0 ).
    **      RAISE EVENT data_not_found.
          IF 1 = 2. MESSAGE e154(bc_datamodel_service). ENDIF.
    *   Flight not found (table SFLIGHT)
          CALL METHOD me->mo_msglist->add
            EXPORTING
    *          is_message   =
              id_msgty     = 'E'
              id_msgid     = 'BC_DATAMODEL_SERVICE'
              id_msgno     = '154'
    *          id_msgv1     =
    *          id_msgv2     =
    *          id_msgv3     =
    *          id_msgv4     =
              id_detlevel  = '1'
    *        IMPORTING
    *          es_message   =
        ENDIF.
        IF ( gt_spfli IS INITIAL ).
        ELSE.
          SELECT * FROM scarr INTO TABLE gt_scarr
          FOR ALL ENTRIES IN gt_spfli
            WHERE  carrid = gt_spfli-carrid.
        ENDIF.
        IF ( gt_scarr is initial ).
          " How to call event for flight_name_not_found ?"
    **        RAISE EVENT flight_name_not_found.
          IF 1 = 2. MESSAGE e159(bc_datamodel_service) WITH '&all'. ENDIF.
    *   Airline & not found
          CALL METHOD me->mo_msglist->add
      EXPORTING
    *          is_message   =
        id_msgty     = 'E'
        id_msgid     = 'BC_DATAMODEL_SERVICE'
        id_msgno     = '159'
        id_msgv1     = '&all'
    *          id_msgv2     =
    *          id_msgv3     =
    *          id_msgv4     =
        id_detlevel  = '2'
    *        IMPORTING
    *          es_message   =
        ENDIF.
      ENDMETHOD.                    "get_data
    ENDCLASS.                    "lcl_mytestclass IMPLEMENTATION
    *       CLASS handler DEFINITION
    CLASS handler DEFINITION.
      PUBLIC SECTION.
        METHODS handle_event
                FOR EVENT data_not_found OF lcl_mytestclass.
    ENDCLASS.                    "handler DEFINITION
    *       CLASS handler IMPLEMENTATION
    CLASS handler IMPLEMENTATION.
      METHOD handle_event.
        WRITE: / 'Data not found'.
      ENDMETHOD.                    "handle_excess
    ENDCLASS.                    "handler IMPLEMENTATION
    DATA: oref TYPE REF TO lcl_mytestclass,
         h1   TYPE REF TO handler.
    PARAMETER:
      p_carrid    TYPE s_carr_id DEFAULT 'AA'.
    START-OF-SELECTION.
    START-OF-SELECTION.
      CREATE OBJECT: oref, h1.
    **  SET HANDLER h1->handle_event FOR ALL INSTANCES.
      CALL METHOD oref->get_data( p_carrid ).
      IF ( oref->has_messages( ) = abap_true ).
        oref->display_messages( ).
      ENDIF.
    END-OF-SELECTION.
    Regards
      Uwe

  • How to find event handler for save button in salesorders

    Hi,
    I want perform event based on save button in salesorders.Can you tell me how to find the event handler for
    save button.
    Regards,
    Brahmaji

    Brahma,
    you can find the component, view details by doing an F2.
    open the component, the view will be mostly an overview page i.e., the name ends OP etc.,
    But your method name will be mostly EH_ONSAVE, you need to find exact view.
    F2 does not come up properly for overview pages, you have to look into UI config tool preview and make sure sometimes.
    Regards,
    Masood Imrani S.

  • How do I create an Event Handler for an Execute SQL Task in SSIS if its result set is empty

    So the precedence on my entire package executing is based on my first SELECT of my Table and an updatable column. If that SELECT results in an empty result set, how do I create an Event Handler to handle an empty result set?
    A Newbie to SSIS.
    I appreciate your review and am hopeful for a reply.
    PSULionRP

    Depends upon what you want to do in the eventhandler. this is what you can do
    Store the result set from the Select to a user variable.
    Pass this user variable to a Script task.
    In the Script task do whatever you want to do including failing the package this can be done by failing the script task, which in turns fails the package. something like
    Dts.TaskResult = Dts.Results.Failure
    Abhinav http://bishtabhinav.wordpress.com/

Maybe you are looking for

  • External HD issue Error code -36

    I am unable to copy or move files to and from my lacie porsch external hd. I get the following message. The Finder cannot complete the operation because some date in "grab-drop image.jpg" could not be read or written. (Error code -36). any ideas? I h

  • LocationServices on iPhone..when do you know your location is "good enough"

    Hi. I've been having some weird issues with location services and maybe I'm just not understanding it completely. I need to grab the user's location with the best accuracy possible so I gather updates for about 10 seconds and take the update with the

  • Computer freeze when updating from OS 9.2 to 10.2

    Hi, I have a grey/blue ibook 366Mhz purchased the summer of 2000. I'm trying to update to OS 10.2. So far, I've updated from 9.06 to 9.2.1 to 9.2.2 (the required sequence), updated the firmware to 4.1.7, and installed third party RAM. I bought the in

  • How to create HD Video for Web

    After watching HD movie trailers on the Apple Web site I was wondering if anyone has information on how I can create 480P Video clips of my own work for my website? At the moment, I use compressor and the settings for Large DSL. It's good, but I'd li

  • Re: Log NC Button inactive

    Hello Experts, At the time of logging a primary NC, I see that the "Log NC" button is not active. The help suggests to click on this after selecting primary NC Group and the NC code: Is it by design or I am missing some thing here? Would appreciate a