PDA

View Full Version : MovieClip(parent).addEventListener isn't allowed?



DesignerMichael
August 24th, 2008, 10:19 AM
I am trying to add an event listener to a parent object from a child object, is this not possible???


MovieClip(parent).smartFox.addEventListener(SFSEve nt.onConnection,onConnection);


That works fine when placed on the parent object...



smartFox.addEventListener(SFSEvent.onConnection,on Connection);


Not sure what to do here... I even tried the uza.utils* global class.

senocular
August 24th, 2008, 10:27 AM
maybe parent isn't valid yet? Whats the error

DesignerMichael
August 24th, 2008, 10:39 AM
The standard null object refrence.

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at battleTanksGame$iinit()
at battleTanks/::onJoinRoom()


I got around it now anyway... The reason my global wasn't working becaust it was placed before the initialization of the client.

smartFox=new SmartFoxClient(true);
global.smartFox = smartFox;

This works...
global.smartFox.addEventListener(SFSEvent.onUserVa riablesUpdate, onUserVariablesUpdate);