MontyCoder
02-12-2009, 05:55 AM
Hi all
i am having problem with dispatchEvent, i want to pass String value while dispatchEvent.
here is the code
dispatchEvent(new CustomEventClass(CustomEventClass.MY_STRING,tempSt r));
listener code
private function init():void{ this.addEventListener(CustomEventClass.MY_STRING,g otEvent);
}
private function gotEvent(evt:CustomEventClass):void{
var myStr:String = evt.myString;
Alert.show("got it "+myStr);
}
custom event class
package assets
{
import flash.events.Event;
public class CustomEventClass extends Event
{
public static const MY_STRING:String = "myString";
public var myString:String;
public function CustomEventClass(type:String,myString:String=null)
{
super(type);
this.myString = myString;
}
override public function clone():Event{
return new CustomEventClass(type,myString);
}
}
}
when i use these codes in only page of file it works fine.
But i want to open another title window.. and i want to receive that String in that Title window.
Event is dispatching from main page.. but its not listing from titile window...
in Title window page i am using same code...
can any one tell me where i am wrong..?
thanks
:)
i am having problem with dispatchEvent, i want to pass String value while dispatchEvent.
here is the code
dispatchEvent(new CustomEventClass(CustomEventClass.MY_STRING,tempSt r));
listener code
private function init():void{ this.addEventListener(CustomEventClass.MY_STRING,g otEvent);
}
private function gotEvent(evt:CustomEventClass):void{
var myStr:String = evt.myString;
Alert.show("got it "+myStr);
}
custom event class
package assets
{
import flash.events.Event;
public class CustomEventClass extends Event
{
public static const MY_STRING:String = "myString";
public var myString:String;
public function CustomEventClass(type:String,myString:String=null)
{
super(type);
this.myString = myString;
}
override public function clone():Event{
return new CustomEventClass(type,myString);
}
}
}
when i use these codes in only page of file it works fine.
But i want to open another title window.. and i want to receive that String in that Title window.
Event is dispatching from main page.. but its not listing from titile window...
in Title window page i am using same code...
can any one tell me where i am wrong..?
thanks
:)