Extending EventDispatcher with dynamic event types

I'm currently trying to write my own class to extend the
EventDispatcher class. My goal is to create a Service class which
acts as a switchboard for incoming socket data. Incoming socket
data is parsed to create an Event which is Dispatched to the
appropriate Service object which dispatches the event to any
registered listeners.
The problem I'm having is that I'm confused about how to
handle the event types -- the string parameter which is always
supplied as the first argument to the addEventListener() function.
In all the examples I've seen, the value supplied is a class
constant like MouseEvent.CLICK or VideoEvent.READY. In the case of
my application, I want the developer to define their own Event
types without having to go and edit my class files. In other words,
I'd like to use dynamic event types with my class--maybe something
like the code I've attached.
I'm not new to Actionscript but am very new to the
EventDispatcher class. I'm wondering a bit what that first
parameter really does in a strict programming sense -- i haven't
seen it explained all that well in the piles of documentation I've
read on the Adobe site so I don't really know if I need to define
my own Event class or what and whether I have to define all those
possible event type constants/strings in advance or what.
Any help/advice would be much appreciated.

I have looked it up here:
Actionscript
3.0 Language Reference
and it just says that the first arg to 'addEventListener' is
"The type of event" with no further explanation at all.
I have read this:
Flash
Quick Starts: Programming With Actionscript 3.0: Event handling
It doesn't help much either. It tells me I need the
appropriate event object which makes me wonder DO I NEED MY OWN
CLASS? For that first ard to addEventListener, it merely says
"Substitute the appropriate constant". Given that I want to use
dynamic types (i think so anyway) that is not helpful information
either. Every single example on that page uses a class constant for
event type.
It links to
this
which says "First, the name of the specific event you want to
respond to. Once again, each event is affiliated with a specific
class, and that class will have a special value predefined for each
event--sort of like the event's own unique name, which you should
use for the first parameter." Still no useful detail about what
that arg does and the insistence on constants.
The quick start page also has a link title "Handling Events"
in Programming ActionScript 3.0 but it links to some documentation
titled "Working with XML". The only discussion of events in that 10
or so pages is because some user posted a comment.
I have read this
entire
article which is more helpful than anything in the flash docs
but still doesn't answer all my questions which (AGAIN) are:
1) What is the real function of the first argument to
addEventListener? I have not seen a clear explanation anywhere.
2) Do I need to write my own Event class?
3) What about dynamic event types that are defined at
runtime? Are there any pitfalls or risks that arise from using a
string instead of a predefined constant as the first param to
addEventListener() ?
Please stop telling me to read the documentation. I've been
reading it for days.

Similar Messages

  • Add-on 9000005 failed with exception; Event Type: 1

    Hi Experts,
    I am woking on a project which uses DI API and creates AP Invoice by reading an excel file.
    I used all the invoice in one sap transaction.
    I read excel line by line and create one AP Invoice per line. It works when excel is having less then 500 records. But if there are more then 500 records or more then 600 records, it give following error to me
    Add-on 9000005 failed with exception; Event Type: 1
    Can anyone help me in it?
    Thanks!!
    Ritu

    Hi,
    I'm sure there is a limit to the number of rows you can add to an Invoice but I think it's probably limited on memory rather than a fixed limit on the number of rows.  This might be an out of memory error that's causing the exception.  Have you tried putting a try/catch around your code to see what the exact details are of the exception?  Also, if you are filling in any text fields on the invoice (remarks), they are limited to 30K.
    David

  • Add-on 9000035 failed with exception; Event Type: 32

    In loadscreen function i have  load the XML form but it shows the error like
    "Add-on 9000035 failed with exception; Event Type: 32"
    But  i will connect to some other db means its working .
    Share your ideas for what is the problem to load the screen in particular DB
    Thanks,
    Helen. S

    Hi,
    You may check this: Add-on 9000002 failed with exception; Event Type: 32
    Thanks,
    Gordon

  • Addon 9000000X failed with exception; Event type X

    Hi SDK experts,
    We had a problem with occurrence intermittent, something that we identified with relation on wait of response of event.
    The problem is:
    My addon need to submit XML files to some webservices. In some cases this files will be send on batches, what causes the response time to events on addon is to much large.
    In this cases, when the response time is much large, the B1 overthrow the addon.
    In compiled mode the message is not shown. This evidence was achieved on debug time.
    The error message is "Addon 90000002 failed with exception; Event type 6"
    The paleative solution was implement a thread to release the event. But threads on addons can be a problem.
    What the opinions?
    We need a solutions. Our addon is a market product for process accounting and fiscal.
    regards.
    Daniel Weissmann

    Hi,
    You may check this thread first:
    Addon Crashes
    Thanks,
    Gordon

  • Add-On [X] failed with exception; Event Type:16

    Hi,
      I'm currently trying to create a SAP B1 Add-On using C# (Framework 3.5/VS 2008).  I've done several VB.Net Add-Ons in the past but this is the first one I try to create one in C#.
      Using the SDK code examples, I've managed to create an Add-On that correctly connects to UI and DI (I can create a sub-menu, set event filters and add some usertables and userfields).  My sub-menu opens an XML based form in SAP B1.  The first time I click on the sub-menu, my form is correctly shown.  But immediately after, I get the following error in the message bar at the bottom :
      Add-On [X] failed with exception; Event Type:16, in which [X] is a number (like 90003), incrementing each time I stop the Add-On in Visual Studio and restart it.
      After this message occurs, I cannot display another instance of the window using the sub-menu.  In fact, it seems that all Add-On activity (button click, event trapping) is disabled or ineffective.  The Add-On still is running in the process tree, but no response.  Only the "X" is working on the created form to close it.
      I've run some tests on the code and I realized that this is happening on XML based forms (using the LoadBatchActions command to load the form) and the FormCreationParams class to create a simple form.  If I put the form creation line code in comments, my Add-On still runs (I can trap events on the sub-menu click) ; I can click multiple times on the menu without a problem  But as soon as I create a form, it stops responding.
    It also seems that as soon as I click on another menu to open a system form, the same error occurs. If I comment the form creation line code, again I can click as often as I want without getting this error message
      Can anyone help me on this one ?  I can post some code depending of what you may need to check this.
      Thanks !

    Sorry, I've just found the problem ; it was caused by an unhanded exception !
    Thanks !

  • Create Structure with dynamical Table-Type

    Hi experts,
    is there a possibility, to create a structure via SE11 and including there a field which referes to a dynamic table-type.
    So that I can append to this structure-field all different table-types?
    for example: ones I append MARA[] and ones AFKO[]
    Thx for help

    Hi Christian,
    There's not predefined generic type to do that, but you could create your own field type (deep structure) which would be able to keep table lines after transposition (90 degree flip) where in example it would have four columns: Table type, row id(index) field name, value. That way you could store ANY table row you need... This will not come cheap and will involve some work of course.
    You may want have a look at standard ABAP services RRTS and RTTI (see classes and structures used in attributes an parameters) - these are two services for handling data types and metadata related operations during runtime. You may want to use them for flipping your table entries to the tabular form and so on. You may also find some ideas there on how to compose your own data type for your purposes.
    Good luck!
    Marcin

  • Plotting multiple graphs on one waveform chart with dynamic data types

    I'm trying to put multiple graphs on one waveform chart and having data agreement errors. I'm wondering if it has anything to do with the fact that dynamic data is being used (I've had no problems with other datatypes in the past). Does anyone know how to correct this problem? I've attached the following .VI. There will be plenty of .VIs on the bottom that won't load, but they are not consequential for this problem.
    Thanks!
    Brian
    Solved!
    Go to Solution.
    Attachments:
    Stiffness Control V1.vi ‏119 KB

    you could use stacked plots by right clicking on the chart and clicking on the stacked plots and than on the front panek you can put a bundle function on the FP and hook your signals up
    Harold Timmis
    [email protected]
    Orlando,Fl
    *Kudos always welcome
    Attachments:
    multiplotwaveform.JPG ‏138 KB

  • Addon 90000002 failed with exception; Event type 6

    Hi,
    Ok Here's what I do to get this error.
    We did program a menu that starts a .NET modal form which stays more then 10 minutes on screen.  When closing the form and I did debug also to see where it gives the error and the form goes well until it is completely closed the the process return to SAP which return to it's normal loop in ItemEvent then sudently this message appears in red at the bottom and the add-on is kicked out.
    If we don't handle for 10 minutes, let say 9 minutes, we don't get the error so it's like SAP doesn't like a .NET modal form to handle 10 minutes or more and I don't understand why
    I don't know where to put a try catch either since there's no place where the error occurs which is nowhere that means at the end of ItemEvent in fact and there's already a Try Catch there so why the addon is kicked is a mistery to me.
    Any idea ?

    Hi,
    You may check this thread first:
    Addon Crashes
    Thanks,
    Gordon

  • Dynamic Event Registration Error

    Hi,
    I'm getting to grips with Dynamic events in LabVIEW. However, I've encountered an issue i'm not sure on. When I try to register a cluster of control refs to the Register for Events function I get an error.. See Dynamic Event Registration.vi for small vi highlighting the issue.
    Thoughts?
    Strokes 
    Attachments:
    Dyanmic Event Registration Error.vi ‏9 KB

    Steve Chandler wrote:
    You can wire a reference or an array of references to register for events. Of course you probably already know that you have to wire the output of register for events to the dynamic registration terminal of the event structure.
    Steve Chandler wrote:
    You can wire a reference or an array of references to register for events. Of course you probably already know that you have to wire the output of register for events to the dynamic registration terminal of the event structure.
    That helped me somewhat, however, I'm still experiencing problems. My events seem to be registering correctly but don't seem to generate when I trigger them. I've configured the event structure to execute should one of the controls in my cluster change value. However, the only event case that get's executed is the timeout case.
    I've attached a vi highlighting my problem named Dynamic Event Problem.vi. My real vi is much larger and contains many sub vis so hopefully what I've attached suffices..
    Attachments:
    Process Data Control Refs Edit.ctl ‏14 KB
    Dynamic Event Problem.vi ‏22 KB

  • Generate dynamic event of producer loop in multiple consumer loop

    I have one producer loop which used event case to interface with FP controls and 5 consumer loops
    If I have to use the fifth consumer loop to generate dynamic event which send to event case in produer loop. 
    I have to wire register event with dynamic event terminal in producer loop . Also I need to wire user event to consumer loop (at the bottom of screen window) which is far away from producer loop. It is hard to wire them. 
    Is there any other method to let many consumer loop to communicate with one producer loop through dynamic event (the same user event)?

    I like to use an Action Engine to hold control my Event Reference.  Then anybody can send the event commands.
    You may also want to look at the VIs I recently submitted for OpenG here.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Rtp dynamic payload type 123

    Hello,
    We have a problem about RTP dynamic payload type 123. If you know, please explain when cisco gateways are nagotiation between non-cisco media gateways. When we look at rtp packets, Wireshark tag this packets malformed. Is there a way Can we disable between gateways are nagotiation with dynamic payload type 123.
    i found only below info about rtp dynamic payload type 123 that is used for indicating Cisco CAS information.
    RTP Payload Value
    RTP Payload Definition
    123
    Indicates Cisco CAS information.
    regards,
    Omer

    What is your hardware?
    Do you have already see this doc?
    Enable RTP Signaling on AS5350 and AS5400
    In order to prevent errors caused by RTP packets of payload type “123” on Cisco AS5350 and AS5400 series platforms, RTP signal processing is disabled by default. Under some circumstances, packets of this type can cause an invalid memory address error in AS5350 and AS5400 series platforms, potentially crashing the devices.
    On these models, you can enable RTP signal processing using the voice-fastpath voice-rtp-signalling enable hidden configuration command. However, before you enable RTP signal processing, prepare the platform to handle RTP packets of payload type “123” by enabling T-CCS.
    After you prepare the platform, you can use these commands in order to enable or disable RTP signal processing.
    In order to enable RTP signal processing, use this command:
    Router(config)#voice-fastpath voice-rtp-signalling enable
    In order to disable RTP signal processing, use this command:Router(config)#no voice-fastpath voice-rtp-signalling enable

  • Xml conversion of data refs with dynamic type

    Hi Colleagues,
    I have to create an XML from a TYPE REF TO DATA, where this data is created using a dynamic internal table. By dynamic internal table i mean that the internal table is created dynamically using the class method cl_alv_table_create=>create_dynamic_table.
    Now the problem that i face is when i use the statement:
    CALL TRANSFORMATION id
          SOURCE jsag_data = im_context_b64
          RESULT XML lv_xml
          OPTIONS data_refs = 'embedded'
                  value_handling = 'move'.
    to generate the XML i get a dump of type CX_XSLT_SERIALIZATION_ERROR saying "The ABAP data cannot be serialized."
    I found a solution to avoid the dump by adding the additional option " TECHNICAL_TYPES = 'ignore' " to the  CALL TRANSFORMATION statement, like
    CALL TRANSFORMATION id
          SOURCE jsag_data = im_context_b64
          RESULT XML lv_xml
          OPTIONS data_refs = 'embedded'
                  value_handling = 'move'
                  TECHNICAL_TYPES = 'ignore'.
    But, using this addition the dynamic type ref to data part is totally ignored from the XML generation.
    If I use a specific DDIC table type to create the data, we do not face this issue and the XML is generated as desired
    Does anyone have a solution to this problem as it has become a sort of blockade for our development?
    Thanks and Cheers,
    Gaurav.

    Hello,
    I reached same problem with dynamic data references, the only solution I got is to used global DDIC types (also for table types !!) when creating data which needs to be serialized.
    The options technical_types = 'ignore' doesn't solve the problem - it just instructs the parser to skip data references without global ddic type. The options value_handling = 'move' is very helpful as XML serialization is very picky about values beeing serialized.
    Here is summary of my observations:
    - Global DDIC type has to be associated with data reference, otherwise only technical type is there and this is not supported (you can use OPTIONS TECHNICAL_TYPES = u2018IGNOREu2019 but this will just skip the data to be serialized to XML) u2026
    - The above means that if you are serializing data reference to table then you have to have also global DDIC type for the table-type !! Unfortunatelly there is no default table type available for transparent tables u2026. They are treated as structures not as table-types u2026 thus:
    - CREATE DATA lr_data TYPE <global_ddic_structure> - can be serialized
    - CREATE DATA lr_data TYPE STANDARD TABLE OF <global_ddic_structure> - cannot be serialized
    - CREATE DATA lr_data TYPE <global_ddic_table_type> - can be serialized
    - !! Unfortunatelly !! CREATE DATA lr_data TYPE <type_pool_ddic_structure/ type_pool_table_type> - also cannot be serialized u2013 this is pitty u2026 this should be supported u2026.

  • Attributes with dynamic type

    Hello all,
    I've been writing a set of libraries for a CRUD application, whereby you specify the table and column names in a model class and it will handle the Ajax stuff for you. All well and good.
    I have validation functions that use the signature:
    Func<dynamic, Dictionary<string, object>, ValidationHost, string>
    where the `dynamic` is the value to be validated - it might come from the database, the Ajax form or be explicitly defined (hence why I've made it dynamic).
    What I would like to do now is be able to define a validation function in a custom attribute in the model. Normally that wouldn't be a problem, but with that `dynamic`, not so much.
    I understand the reasons for it not working (dynamic being resolved at run time and attributes being a compile time construct), so I'm wondering if there is any way around it? More generally, I'm wondering if I've made a mistake using `dynamic` for the value
    and should have perhaps used `object`?
    Many thanks,
    Allan

    Certainly!
    In essence I have a model that describes the column names for a database table:
    public class StaffModel
    public string first_name { get; set; }
    public string last_name { get; set; }
    public string position { get; set; }
    The class properties describe the db column names, the JSON structure sent to the client for display and the HTTP variables from the form submission (Ajax). They can be named differently, but for simplicity here...
    The model and db table name are fed to a controller instance that handles the data get (i.e. reading of the db and output of data to JSON) and the create, update, delete aspects based on what is submitted:
    new Editor(db, "staff")
    .Model<StaffModel>()
    Using reflection each model property has a `Field` instance created. Each field has a value. I don't have a value class at the moment, just a `dynamic` variable which has the value dumped into it (be it from the database or form submission).
    The value is passed around and operations performed on it - for example this is a simplified numeric validation function:
    public static string Numeric(dynamic val)
    try
    Convert.ToDecimal(val);
    return null;
    catch (Exception) { }
    return "Not valid numeric data";
    I could change that to pass in an object which has its value set and get by an overloaded method with the data types I want to support, although it seems like a bit of a pain to need to use `val.Val()` to get the value rather than just having the value in
    `val` and potentially a waste of memory.
    Is that what you might suggest?
    Thanks,
    Allan

  • Description of bus.event type is displayed with incorrect sequence in query

    Dear experts,
    I have created a query in logical database PCH in order to display the description of business event types. The problem is that if the description's length is more than 1 line, the query displayes the lines not in order (e.g. line with tabseqnr 1 first, line with tabseqnr 2 second etc) . It displayes first the line with tabseqnr 2.
    Thank you in advance,
    Vana Sounta

    The first thing you should do with any used computer is to erase the hard drive and install the operating system from original media. If you didn't receive installation discs with the Mac, you'll need to order them from Apple customer service; or, if you want to install a newer OS version than the one the machine shipped with, find a retail disc. The newest version you can run is 10.5, though you might have to add memory. The disc will be hard to find and expensive. Beware of scams, especially on eBay, and above all don't buy the gray discs that came with another Mac. Trying to get a 10.3 system to work with modern websites is probably a waste of time.

  • Creating context node with dynamic type

    When we are creating context node thru wizard,  Dictionary type must be filled. I'm trying to create Context node manually.Did any one tried created Context node class with Dynamic type.

    Hi Prasad,
    I have a similar requirement.
    Can you please share with me how did you create context node with dynamic table data?
    Thanks
    Vicky

Maybe you are looking for