Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 09-25-2007, 12:10 PM   #1
dgstarr
Registered User
 
Join Date: Sep 2007
Posts: 1
Default TypeError: Error #2007: Parameter listener must be non-null.

I am new to ActionScript and have decided that if I am going to learn it, I am going to learn the latest version. I have created an EventListener that calls a function - simple enough. However, I need to pass a value to the function and whenever I do that, I get the following error:

TypeError: Error #2007: Parameter listener must be non-null.
at flash.events::EventDispatcher/addEventListener()
at site_fla::MainTimeline/site_fla::frame1()

If I trace the value, it exists and is getting passed so I'm not sure what this error means. All I know is that when I remove the value and pass nothing, the error goes away.

Somebody please help me! I've got a client breathing down my neck for a site that, at the moment, I cannot complete!!!
dgstarr is offline   Reply With Quote
Old 09-25-2007, 02:14 PM   #2
Tiemen Glastra
Registered User
 
Join Date: Sep 2007
Posts: 51
Send a message via Skype™ to Tiemen Glastra
Default

It would help a great deal if you post the code itself, so people can easily identify what's wrong. My guess is, judging by the error code, that you are passing a parameter as listener function that is not actually a function. Like

ActionScript Code:
// here, clickHandler() should be just clickHandler, or else you get  the same error... the handler does not return any value. my_btn.addEventListener( MouseEvent.MOUSE_DOWN, clickHandler() ); var clickHandler: Function = function( event: MouseEvent ): void {     trace( 'Click event received from', event.currentTarget ); }

Hope that helps...
Tiemen Glastra is offline   Reply With Quote
Old 04-14-2008, 08:36 AM   #3
flashkiddy
Registered User
 
Join Date: Apr 2008
Posts: 2
Default same error...

I also get the same error.... :

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

Last edited by flashkiddy; 04-14-2008 at 08:40 AM.
flashkiddy is offline   Reply With Quote
Old 04-14-2008, 08:49 AM   #4
flashkiddy
Registered User
 
Join Date: Apr 2008
Posts: 2
Default Solved

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.....
flashkiddy is offline   Reply With Quote
Old 12-21-2008, 05:22 PM   #5
tomcoombs
Registered User
 
Join Date: Dec 2008
Posts: 1
Default I had a different problem/solution

I got this

Error #2007: Parameter listener must be non-null

and I discovered my problem was that I'd put brackets after my function name ...

myTween.addEventListener(TweenEvent.MOTION_FINISH, whenTweenEnds());

should have been

myTween.addEventListener(TweenEvent.MOTION_FINISH, whenTweenEnds);
tomcoombs is offline   Reply With Quote
Old 12-23-2008, 02:40 PM   #6
MSFX
Interactive Development
 
MSFX's Avatar
 
Join Date: Feb 2008
Location: Herefordshire, United Kingdom
Posts: 484
Default

when you pass a function only pass its name, not including the brackets!
__________________
PLEASE place your code within [code] tags
Stock Flash
MSFX is offline   Reply With Quote
Old 02-03-2010, 12:23 PM   #7
amjo
Registered User
 
Join Date: Feb 2010
Posts: 1
Default

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

Code:
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
amjo is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DepthManager MichaelxxOA ActionScript 2.0 4 01-26-2008 09:47 PM
This makes <undefined> sense to me matteosistisette ActionScript 2.0 21 12-19-2006 11:25 PM
That dreaded null byte again apesaga Server-Side Scripting 0 12-16-2004 11:14 AM
checking for null on input box quinu ActionScript 1.0 (and below) 4 09-25-2003 11:58 AM
Event handling with Listeners - learning from Java robertpenner ActionScript 1.0 (and below) 2 08-08-2001 11:36 PM


All times are GMT. The time now is 02:30 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.