PDA

View Full Version : TypeError: Error #2007: Parameter type must be non-null.



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(" + [] + ")" );
}

Flashkiddy
April 14th, 2008, 05:48 AM
OK, i suck , sorry for posting this, but i solved the problem already.

SOLUTION:
I am using a RUNTIME SHARED LIBRARY (RSL) and all my FLA files use the same 'business' class. Since the FLA file with all the RSL items hadn't been updated, i guess there was a conflict in the Flash player memory about which version of the 'business' class to use.

After recompiling all FLA files, everything is working just fine.

I can't wait to start programming a CS3 FLA-batch-publisher now.....

amjo
February 3rd, 2010, 06:03 AM
OK, i suck , sorry for posting this, but i solved the problem already.

SOLUTION:
I am using a RUNTIME SHARED LIBRARY (RSL) and all my FLA files use the same 'business' class. Since the FLA file with all the RSL items hadn't been updated, i guess there was a conflict in the Flash player memory about which version of the 'business' class to use.

After recompiling all FLA files, everything is working just fine.

I can't wait to start programming a CS3 FLA-batch-publisher now.....

ok, i do know that it has been a long time this problem is solved, however, i have the following similar error:


TypeError: Error #2007: Parameter type must be non-null.
at flash.events::EventDispatcher/addEventListener()
at mx.resources::ResourceManagerImpl$iinit()
at mx.resources::ResourceManager$/getInstance()
at mx.managers::SystemManager/::initialize()
at mx.managers::SystemManager/::initHandler()

now, i know we're discussing about the same error, however due to endless researching n going around in circles, it turns out that Error #2007 has tons of forms....

i would paste my code here, but let's face it, i really don't know which part of the code to paste (EventDispatcher's code? ResourceManagerImp's code?... and so on)...

please, i would love that someone would reply and help out... even if you don't have a solution, i'd be greatful if i got some directions to certain sites so that i'd take the research from there!...

thank you,
amjo

AJ-D
February 3rd, 2010, 08:49 AM
That output says EventDispatcher.addEventListener is getting passed a null value for the type (first) argument in the ResourceManagerImpl constructor. I believe it should be receiving FlexEvent.NEW_CHILD_APPLICATION, but can't say any more without more info or code.

amjo
February 3rd, 2010, 10:12 AM
hey, thanks for the quick reply... well, to start off, the ResourceManagerImpl constructor has the following code:


public function ResourceManagerImpl()
{
super();

var info:Object = SystemManagerGlobals.info;
if (info)
processInfo(info);

if (SystemManagerGlobals.topLevelSystemManagers.lengt h)
SystemManagerGlobals.topLevelSystemManagers[0].
addEventListener(FlexEvent.NEW_CHILD_APPLICATION, newChildApplicationHandler);
}

meaning, it is already receiving FlexEvent.NEW_CHILD_APPLICATION... however, i also believe it has something to do with the following code, found within ResourceManager.as:


public static function getInstance():IResourceManager
{
if (!instance)
{
if (!Singleton.getClass("mx.resources::IResourceManager"))
// install ResourceManagerImpl if not registered already
Singleton.registerClass("mx.resources::IResourceManager",
Class(getDefinitionByName("mx.resources::ResourceManagerImpl")));


try
{
instance = IResourceManager(
Singleton.getInstance("mx.resources::IResourceManager"));
}
catch(e:Error)
{
instance = new ResourceManagerImpl();
}
}

return instance;
}

for further reference i'd like to attach SystemManager.as...

Thank you for your time, and thanks in advance
Amjo

AJ-D
February 3rd, 2010, 10:31 AM
Well, I don't see any obvious problems after a quick scan through. What happens if you trace FlexEvent.NEW_CHILD_APPLICATION just before addEventListener is called? It isn't listed as an accessible part of the Flex framework (for v.3, anyway). Is there any reason you're interfering with the core framework classes?

amjo
February 3rd, 2010, 11:03 AM
actually they're not hte core files of the system... it's a funny story, though... many wouldn't reveal the situation if they were in the same situation tht i am in... i'll hand it to you anyway!

i saw this application: http://www.bbc.co.uk/bbcthree/tvlistings/

and i want to learn how it's done, since i've got a 90% same assignment for a radio website...

so i simply take it, decompile it with a licensed Sothingk SWF Decompiler, and WHAM! hit a wall!... i always use this decompiler, never failed me like so.. weird...

anyway, long story short, once exported to .fla i try to export it from there, and i get compilation errors... and after two days of trying to fix them, i hit this output error, with no compiling errors...

frank enough?!... what do you think are my options?

AJ-D
February 3rd, 2010, 11:15 AM
Actually, they are the core framework files. I believe the Flex framework isn't included in Flash Player, so is compiled into the SWF bytecode. I've never tried to compile a decompiled SWF, so don't know if they'll generally run or not. I'm not surprised it won't though.

I'd say your best option is to write the thing yourself, rather than adapting a decompiled SWF; it'll probably be quicker than figuring out why it's not working. It's not like it looks overly complicated and, technically, I think that using the code from that would be illegal.

If you're reading the code trying to figure out how they did something, ignore anything in the fl and mx packages - these are all core/framework bits.