Flashkiddy
April 14th, 2008, 05:39 AM
It's monday morning and somehow my brain won't comprehend why this error is happening...... could anyone take a look and shed some light on this please?
TypeError: Error #2007: Parameter type must be non-null.
at flash.events::EventDispatcher/addEventListener()
at pages::MyProfile/initListeners()
at pages::MyProfile()
here is my code
ActionScript Code:
package business.types
{
import flash.events.Event;
/**
* @author Erik
*/
public class ServerConnectionEvent extends Event
{
public static const AUTHENTICATION_BY_ACCOUNT_COMPLETE : String = "authentication_by_account_complete";
public static const AUTHENTICATION_BY_ACCOUNT_FAIL : String = "authentication_by_account_fail";
public static const AUTHENTICATION_BY_COOKIE_COMPLETE : String = "authentication_by_cookie_complete";
public static const AUTHENTICATION_BY_COOKIE_FAIL : String = "authentication_by_cookie_fail";
public static const LOGOUT_COMPLETE : String = "logout_complete";
public static const LOGOUT_FAIL : String = "logout_fail";
public static const REGISTRATION_COMPLETE : String = "registration_complete";
public static const REGISTRATION_FAIL : String = "registration_fail";
public static const PROFILE_RETRIEVE_COMPLETE : String = "profile_retrieve_complete";
public static const PROFILE_RETRIEVE_FAIL : String = "profile_retrieve_fail";
public var isSuccess : Boolean;
public var data : Object;
public function ServerConnectionEvent ( type : String, isSuccess : Boolean = true, data : Object = null )
{
super( type );
this.isSuccess = isSuccess;
this.data = data;
}
}
}
This is the other class, which is using this custom Event:
ActionScript Code:
private function onGetProfileComplete ( lObj : Object ) : void
{
trace( "business.ServerConnection.onGetProfileComplete(" + [ lObj ] + ")" );
dispatchEvent( new ServerConnectionEvent( ServerConnectionEvent.PROFILE_RETRIEVE_COMPLETE, true , lObj ) );
}
And this is the method where the error is thrown:
ActionScript Code:
private function initListeners () : void
{
trace( "pages.MyProfile.initListeners(" + [] + ")" );
ServerConnection.getInstance( ).addEventListener( ServerConnectionEvent.PROFILE_RETRIEVE_COMPLETE , onProfileDownloadComplete );
ServerConnection.getInstance( ).addEventListener( ServerConnectionEvent.PROFILE_RETRIEVE_FAIL , onProfileDownloadFail );
}
private function onProfileDownloadComplete ( pEvt : ServerConnectionEvent ) : void
{
trace( "pages.MyProfile.onProfileDownloadComplete(" + [ pEvt ] + ")" );
var lData : Object = pEvt.data;
}
private function onProfileDownloadFail ( pEvt : ServerConnectionEvent ) : void
{
trace( "pages.MyProfile.onProfileDownloadFail(" + [] + ")" );
}
TypeError: Error #2007: Parameter type must be non-null.
at flash.events::EventDispatcher/addEventListener()
at pages::MyProfile/initListeners()
at pages::MyProfile()
here is my code
ActionScript Code:
package business.types
{
import flash.events.Event;
/**
* @author Erik
*/
public class ServerConnectionEvent extends Event
{
public static const AUTHENTICATION_BY_ACCOUNT_COMPLETE : String = "authentication_by_account_complete";
public static const AUTHENTICATION_BY_ACCOUNT_FAIL : String = "authentication_by_account_fail";
public static const AUTHENTICATION_BY_COOKIE_COMPLETE : String = "authentication_by_cookie_complete";
public static const AUTHENTICATION_BY_COOKIE_FAIL : String = "authentication_by_cookie_fail";
public static const LOGOUT_COMPLETE : String = "logout_complete";
public static const LOGOUT_FAIL : String = "logout_fail";
public static const REGISTRATION_COMPLETE : String = "registration_complete";
public static const REGISTRATION_FAIL : String = "registration_fail";
public static const PROFILE_RETRIEVE_COMPLETE : String = "profile_retrieve_complete";
public static const PROFILE_RETRIEVE_FAIL : String = "profile_retrieve_fail";
public var isSuccess : Boolean;
public var data : Object;
public function ServerConnectionEvent ( type : String, isSuccess : Boolean = true, data : Object = null )
{
super( type );
this.isSuccess = isSuccess;
this.data = data;
}
}
}
This is the other class, which is using this custom Event:
ActionScript Code:
private function onGetProfileComplete ( lObj : Object ) : void
{
trace( "business.ServerConnection.onGetProfileComplete(" + [ lObj ] + ")" );
dispatchEvent( new ServerConnectionEvent( ServerConnectionEvent.PROFILE_RETRIEVE_COMPLETE, true , lObj ) );
}
And this is the method where the error is thrown:
ActionScript Code:
private function initListeners () : void
{
trace( "pages.MyProfile.initListeners(" + [] + ")" );
ServerConnection.getInstance( ).addEventListener( ServerConnectionEvent.PROFILE_RETRIEVE_COMPLETE , onProfileDownloadComplete );
ServerConnection.getInstance( ).addEventListener( ServerConnectionEvent.PROFILE_RETRIEVE_FAIL , onProfileDownloadFail );
}
private function onProfileDownloadComplete ( pEvt : ServerConnectionEvent ) : void
{
trace( "pages.MyProfile.onProfileDownloadComplete(" + [ pEvt ] + ")" );
var lData : Object = pEvt.data;
}
private function onProfileDownloadFail ( pEvt : ServerConnectionEvent ) : void
{
trace( "pages.MyProfile.onProfileDownloadFail(" + [] + ")" );
}