Home > FLEX > FLEX 3 Custom Event Listener with Popup window

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;
}

Greg FLEX

  1. Jason
    September 24th, 2008 at 14:10 | #1

    is it possible if you can email me the fnished code don’t quite understand this, thank you.

  1. No trackbacks yet.