How to Access Custom Event using AS3?

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

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

Similar Messages

  • How to protect custom applications using oracle access manager?

    Can someone brief me on how to protect custom applications using oracle access manager?

    Is the Custom application a Web Application running on certified platform? If its Web Application then its no different you have to configure the access policies with http(s) as resource type.
    If its not a web application you can write Custom access Gate and then implement. You would configure the policies similar to Web application (you can define your ouwn resource type if you like) and in the custom web gate you will use Access server SDK API to validate the access rules.
    Thanks
    Ram

  • Custom event in as3

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

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

  • How to define custom event and how to trigger the defined event

    hi,guys
    hurry issue....................hope get help.
    I am using oracle weblogic 10gr3 portal.and we choiced java portlet.as of now,we got some question about custom Event.hope you can give some idea....
    thank you so much.
    question detail:
    1.for java portlet ,how to define custom event.
    2.how to trigger this event.
    3 about the data,may be sometime need to transit Biz data.
    auctully,I just want to implements between two portlets communicate.
    for example:
    existing portletA,portletB.
    portletA is a list,like:
    A AA <button>
    after I click this buttom,then portletB will be effect,it means they are interact with each other.
    does anybody hit this issue before,if you solved pls share me .
    thank you for you help....

    Hello,
    Please note that everything below applies to JSR168 portlets ONLY- JSR286 portlets and other portlet types handle events a little differently.
    From inside your JSR168 portlet you can send an event during processAction or when receiving another event by using the PortletBackingContext object, such as:
    import javax.portlet.ActionResponse;
    import javax.portlet.ActionRequest;
    import javax.servlet.http.HttpServletRequest;
    import com.bea.netuix.servlets.controls.portlet.backing.PortletBackingContext;
    public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
    HttpServletRequest httpRequest = (HttpServletRequest) actionRequest.getAttribute("javax.servlet.request");
    PortletBackingContext portletBackingContext = PortletBackingContext.getPortletBackingContext(httpRequest);
    portletBackingContext.fireCustomEvent("customEvent", "This is a custom event");
    To receive an event, in your .portlet file you just need to put in a "handleCustomEvent" tag specifying which method to call when the event is received, such as:
    <?xml version="1.0" encoding="UTF-8"?>
    <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0"
    xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0 portal-support-1_0_0.xsd">
    <netuix:javaPortlet title="Listening Portlet" definitionLabel="yourPortletName">
    <netuix:handleCustomEvent event="customEvent" eventLabel="customEvent" filterable="true" description="custom event handler">
    <netuix:invokeJavaPortletMethod method="processCustomEvent"/>
    </netuix:handleCustomEvent>
    </netuix:javaPortlet>
    </portal:root>
    Then, in your receiving portlet the method "processCustomEvent" would receive the event, such as:
    public void processCustomEvent(ActionRequest actionRequest, ActionResponse actionResponse, Event event)
    The event payload can be any Serializable object you want, but for forward-compatibility with JSR286 it would be ideal if it had a valid JAXB binding.
    Kevin

  • How to access Image Metadata with AS3?

    An image, like a jpeg, has a bunch of metadata stored in it.
    The "IPTC Core" metadata usually includes the photographers name,
    address, title, description, etc.
    Is there any way to access this information using AS3 so
    that, say, captions for images in a flash gallery could be
    generated automatically?

    As far as I know this is not possible with AS3 directly, but
    if you are interested you could check out the as3corelib at
    http://code.google.com/p/as3corelib/
    They have some pretty nifty JPEG things going on there
    (although I do not know if this includes metadata - but I hope
    so).

  • How to access xml file using c

    how to access xml file using c. are there any libraries regarding xml fastinfoset in c? Please let me know about any resources if u know? thanks!!!
    samitha

    There are different methods to access XML data which have pro's and cons. Let us know more about what you want to do and we can help you.

  • How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way

    How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way

    Hi,
    Thanks for the suggestion. I've been playing around with some of the classes of the java.net package and java.io
    Using the URL class i can get the content of the data from a STATIC page and output that response to file so that is does not display to the client broswer.
    But this only works if the URL i give points to a static html page.
    So the problem i'm getting is if i'm righting in arguments in the URL, this means that server needs to process the arguments i give and its sends back a dynamic result. Because its dynamic the URL class can not handle this and throws me an exception everytime :(
    Have u ever tried to do some things like this?
    Rahul

  • How to access Acrobat Plugin using GetInterface?

    Hi
    I'm trying to access a C++ plug-in written for Adobe Acrobat from a C# program. Following is my code, which I found elsewhere in this forum (LINK).
    Type acroApp;
    acroApp = Type.GetTypeFromProgID("AcroExch.App");
    object oAcroObject = Activator.CreateInstance(acroApp);
    object[] param = new object[1];
    param[0] = "MyPlugin";
    object pluginRef = oAcroObject.GetType().InvokeMember("GetInterface",BindingFlags.Invoke Method, null, oAcroObject, param);
    Here, MyPlugin is the name of the plugin (without extension) which I've placed in the Acrobat plug-ins folder. But this way, InvokeMember returns a NULL object instead of the expected interface of my plugin.
    What am I doing wrong? Any help would be greatly appreciated.

    You don't do it that way.
    You need to use standard "inter application communication" methods such as (but not limited to): COM, DDE, shared memory, shared files, named pipes, etc.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Wed, 1 Feb 2012 20:20:23 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: How to access Acrobat Plugin using GetInterface?
    How to access Acrobat Plugin using GetInterface?
    created by Sachintha81<http://forums.adobe.com/people/Sachintha81> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4180327#4180327

  • How to access the mysql using ordinary command line in Azure Website?

    Hi
    I deploying Django project on Azure. I created project and MySQL db according this method: https://pytools.codeplex.com/wikipage?title=PollsDjangoSql . I can create tables using django command "syncdb" in Visual Studio. I see
    db structure in SQL Explorer. All works. But now I need to get access directly to mysql.  For example with a view to set encoding of some column, or set permissions, change user password, etc.
    I found about many different tools and methods in Microsoft portal. But the purpose of these tools, how to install it and how to use it is a very entangled (After several attempts to find out what's what two weeks later I found on my computer
    three dozen programs with unknown purpose. I doubt that I need to install so many tools to just add the user in mysql).
    How to access the mysql using ordinary command line (or the same simple tool) in my case?

    Hi pvgdrk,
    To get access directly to a mysql database, you can use the commandline tool(open a cmd window-->type mysql the commadline ) or the
    GUI MySQL workbench.
    Since this is a question about MySQL, I would suggest you post your question in a dedicated MySQL forum. You will get more prompt response.
    If you have any feedback on our support, please click
    here.
    Eric Zhang
    TechNet Community Support

  • How to access remote database using applet

    hi all,
    I want to know how to access remote database using applet,
    Please help me anybody.
    Regards
    Jesu

    If the database is on a public server, you probably can't access it directly (security wise). You can make your applet talk to a server-side application, which makes the database calls on behalf of the applet. But even in an intranet environment this setup is often preferable, because you don't need to distribute a JDBC driver to all your clients.

  • How to queue custom events with out using af:calientListener.- onKeyUp.

    Hi,
    I have a custom component ( extending richinput text).
    defined a new attribute called "onkeyup" and added necessary logic in Renderer. Some thing like
    write.writeAttribute("onkeyup" , "handleEvent()");
    I rendered the java script code too ..... in my custom renderer. ( I neigther want to write java script in metaContainer of document tag nor wants to use resource tag..)
    and the handleEvent code is something like this.
    function handleEvent()
    In this method i want to write the code which pushes my custom event to the queue.
    some thing like this..
    component = event.getSource();
    AdfCustomEvent.queue(component, "customEvent",{payload:component.getSubmittedValue()}, true);
    event.cancel();
    Usually if use a clientListener then it will call the method {  handleEvent(event)  } passing event parameter so that we can get the source of that event.
    But as i dont want to use the clientEventListener.... as of now... i can't get the component because i don have the event object with my method.
    So could any one please letme know , how can i queue my custom event in to my customcomponent... with out using ClientListeners.
    Edited by: mchepuri on Nov 9, 2009 10:04 AM

    Hi,
    AFAIK, you cannot queue an event to the serverListener without a clientListener.
    -Arun

  • How to dispatch custom events from an item renderer used for Datagrid Column

    Hi,
    I am using an Item Renderer for a Data Grid Column and in that mxml, I am dispatching a custom event with data.
    But the main mxml which has the DataGrid is not able to resolve the event. How can I solve this?
    Thanks

    Hi,
    This is the constructor for Event.
    public function Event(type:String, bubbles:Boolean  = false, cancelable:Boolean  = false)
    When you created your custom event after extending from Event, for the parent container receives the event, the bubbles property must be set to true.
    Please check if you have done so. That should solve the problem. Let me know if it doesn't.
    Nishad

  • How to access Custom controller

    Hi all,
    How can i access custom controller objects in my other controllers.Can i call custom controller objects from component controller .

    Hi,
    I hope you mean the Custom Controller the same way we understand as defined here
    [http://wiki.sdn.sap.com/wiki/display/WDABAP/Introductiontocontrollers|http://wiki.sdn.sap.com/wiki/display/WDABAP/Introductiontocontrollers]
    To access custom controller from the component controller you have to do the following.
    1. Component controller->properties->use insert button to select the custom controller.
    2. Use the code generator (CTRL+F7) -second tab(general)->method call in used controller->select your custom controller->method.
    This will generate code like this
    DATA lo_zzsbn_cust_cc1 TYPE REF TO ig_zzsbn_cust_cc1 .
    lo_zzsbn_cust_cc1 =   wd_this->get_zzsbn_cust_cc1_ctr( ).
      lo_zzsbn_cust_cc1->test(

  • How to access custom property for attribute and control in .vm file?

    Hi,
    I have created custom properties in OPM for attribute and apply also that properties to attribute.
    But if how to access that value in .vm file?
    I accessed using
    $attribute.getProperty("ScreenProp", "default value")
    but it's not working but same is worked for screen custom property

    $control.getProperties().get("PropertyName") works for custom properties on a control
    If you output $control and $control.getProperties() to the html you can lookup the API for the used classes.
    I can't give an example of the html because it's stripped in this forum
    Edited by: Peter van de Riet on 20-mei-2011 14:18

  • How to access custom properties in .vm file

    Hi,
    I have created custom property for screen using File -> Project Properties.
    This property apply to one of my screen.
    If I want to access the value of the custom property in .vm.
    How to access that value. I tried using screen.getTest() but it doesn't return anything for me.

    Hi Peter,
    I followed the steps.
    1)created custom property
    2)assign that custom property using right click on screen and assign some value
    eg. custom property name - Test
    and value as "abc"
    i need abc in vm file.following my vm file
    it's not working
    <input type="text" id="a1" name="a1" value="${screen.getProperties().get("Test")}" tabindex="6" size="30" >
    #set ( $value = $screen.getProperties().get("Test") )
    <input type="text" id="a1" name="a1" value="$value" tabindex="6" size="30" >
    #if( ${control.isVisible()})
         #if( ${control.getButtonClass().equals("submit")} )
              <input class="btn" type="button" value="Back" tabindex="#tabIndex()" onclick="javascript:back()">
         #end
         #if( ${screen.getProperties().get("Test").equals("mahesh")} )
         <input class="submit" id="submit" name="submit" type="submit" value="Submit" alt="Submit" tabindex="12">
         #else
    <input class="${control.getButtonClass()}" id="${control.getEncodedID()}" name="${control.getId()}" type="submit" value="${control.getText()}" alt="${control.getText()}" tabindex="#tabIndex()">
         #end
    #end
    #if( ${control.getButtonClass().equals("submit")} )
    </div>
    #end
    Edited by: 848231 on May 18, 2011 3:00 AM

Maybe you are looking for

  • Can one export a schema from a 64 bit Oracle DB into a 32 bit Oracle DB?

    Hello: I need to copy a schema from one DB to another. The source DB runs 64 bit version of Oracle DB but the target DB runs 32 bit version of Oracle DB. Can the schema in 64 bit DB instance be exported and imported into a 32 bit DB instance with exp

  • Image size for ibooks author

    Hi I am making a book using iBooks author. It will be image heavy. (40-50 images) I have a few question on images. 1. I do not want the file to be huge or take an age to download so an Apple rep informed me that the images should ideally be no more t

  • List of configuration files copied to non-global zone

    I understand that when a non-global zone is installed, the zone installation process uses "pristine" copies of quite a few configurable files (/etc/profile, /etc/syslog.conf, etc..) instead of the files which are configured in the global zone. Does a

  • UTF8 as system default character set

    Hi, I'm new to OSX and I moved to a new company few days ago. We work with Tiger workstations and servers, several Linux internet servers and Windows Laptops. One of the problems I have is to find a way to set UTF8 as the default character set for th

  • Cant see software component in list of components for proxy generation

    Hi all, I am tring to implement ABAP proxy. The problem i am facing is that i cannot see my software component in the list of software components when i use SPROXY tcode. All other software components existing in the integration builder are seen. Onl