Ok this is weird. I create a custom flex component that has custom
events. I initialize the component in actionscript (and throw it to
good ol PopUp Manager for popup effect) and then try to use
addEventListener to register the custom event as i would with any
other flash/flex object created with actionscript. Problem is I keep
getting this error - "1119: Access of possibly undefined property
LOGIN through a reference with static type Class." Events are
registered and work fine if i initialize the component with mxml but
then i can't make it a popup (or maybe i can but it seems simpler in
as). Is this a bug or am i the bug?
// Creating a custom event in a flex component as such:
<mx:Metadata>
[Event(name="loginComplete", type="flash.events.Event")]
</mx:Metadata>
private componentFunction():void
{
var login:Login = new Login();
login.username = usernameInput.text;
login.password = passwordInput.text;
var event:LoginEvent = new LoginEvent("login", login);
dispatchEvent(event);
}
//Application function - onCreationComplete function...
private function onCreationComplete = function():void
{
loginWizard = new LoginWizard();
loginWizard.addEventListener(LoginEvent.LOGIN, doLogin);
}
//.. and event handler
private function doLogin(event:LoginEvent):void
{
trace(event.type);
}
// LoginEvent
package ts.events
{
import flash.events.Event;
import ts.dto.Login;
public class LoginEvent extends Event
{
public var data:Login;
public function LoginEvent(type:String,
data:Login):void
{
super(type);
this.data = data
}
override public function clone():Event
{
return new LoginEvent(type, data);
}
}
}
// Login data transfer
package ts.dto
{
public class Login
{
public var username:String;
public var password:String;
public function Login()
{
}
}
}