i have a weird problem... i try to build a button that onClick doing something(i dont use in regular event because i need to transfer a data with the event). i built a UIButon class and create an instance of him in the parent class. i create a custom Event class:
package ;
import openfl.events.Event;
/**
* ...
* @author Michael
*/
class ChangeWinEvent extends Event
{
public static inline var CHANGE_WINDOW:String = "changeWindow";
public var _winToClose:String;
public function new(name:String, winToClose:String, bubbles:Bool=false, cancelable:Bool=false)
{
super(type, bubbles, cancelable);
_winToClose = winToClose;
}
}
and i dispatch CHANGE_WINDOW event like this:
dispatchEvent(new ChangeWinEvent(ChangeWinEvent.CHANGE_WINDOW,"LoginWin"));
and listen to this event in parent class:
_loginBtn.addEventListener(ChangeWinEvent.CHANGE_WINDOW, handleChangeWindows);
thank you helpers! michael