FLEX 3 Custom Event Listener with Popup window

Create the custom Event.

In this case I will need to pass an object along with the event.
Save the actionscript as ParseFixClickEvent.as
package modules.FIXParser.Events
{
import flash.events.Event;
 
public class ParseFixClickEvent extends Event
{
public var params:Object;
public static const PARSE:String = “parseEvent”;
public function ParseFixClickEvent(params:Object, type:String )
{
super(type);
this.params = params;
}
public override function clone():Event {      
     return new ParseFixClickEvent(params,type);
    }
public override function toString():String
  {
   return formatToString(”ParseFixClickEvent”,”type”);
  }
}
}
 
 
In my case I have a datagrid, where if I click an item in column 3, I fire an event that creates a popup window.
Here it is:
 
private function itemClickEvent( event:ListEvent ):void
{
            //loglink.visible = “true”;
            //details.visible = “true”;
            if (event.columnIndex == 2) {
            logdir = event.itemRenderer.data.rmi_ip;
            logserver = event.itemRenderer.data.Cluster_Name;
            var parseWindow:ParseFixForm = ParseFixForm(PopUpManager.createPopUp(this, ParseFixForm, true));       
        parseWindow.addEventListener(modules.FIXParser.Events.ParseFixClickEvent.PARSE,doParse);
        parseWindow.mylogdir = logdir;
        parseWindow.myserver = logserver;
        parseWindow.target = event.itemRenderer.data.CounterpartyCompID;
        parseWindow.sender = event.itemRenderer.data.CompID;
        CurrentDestination = event.itemRenderer.data.DestinationName;
       
}
 
When the event is fired from the popup, doParse is called.
 
public function doParse(e:ParseFixClickEvent):void {
var Parser:FIXParser = new FIXParser;
Parser.FixParameters = e.params;
Parser.label = CurrentDestination;
TN.addChild(Parser);
TN.selectedIndex = TN.numChildren - 1;
}

About the Author

Greg

Leave a Reply

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <code> <em> <strong>


Warning: stristr() [function.stristr]: Empty delimiter in /home/thegard5/public_html/gregjessup/wp-content/plugins/wassup/wassup.php on line 2093