Page 1 of 1

smartfox swf refference

Posted: 25 Apr 2010, 02:46
by Eralmidia
Hi

I'm trying to split up my game into several parts, and thus need to refference the smartfox object created in the login swf to the game swf. I found a few vague post about this on the forum, but can't get it to work.

I create a Loader object with and INIT event handler (have also tried COMPLETE without any success). I then try to pass the SmartFoxClient by typing e.currentTarget.content.smartfox = smartfox, where e is the Event object and smartfox is the SmartFoxClient object. It was said in a thread here, that this should work, but I keep getting the 1056 Flash error: "Cannot create property smartfox".

Posted: 25 Apr 2010, 14:44
by Lapo
I am not sure if understand what you are doing but probably it would be easier if the loaded SWF would call a method on the parent SWF to get the reference.
This way you should also have less coordination issues... when the loaded SWF is ready and initialized it will call the method, grab the reference and use it.

Posted: 25 Apr 2010, 15:14
by Eralmidia
Thanks for the reply Lapo. I'm not quite sure how to do that I'm afraid. Since I cant pass the parent reference into the document class of the loaded swf, how do I call a function in the parent in order to pass the SmartFoxClient reference back to the child/loaded swf?

Posted: 25 Apr 2010, 15:20
by Lapo

Posted: 25 Apr 2010, 16:40
by Eralmidia
Yeah, this is basicly what I've been trying to do. It keeps telling me that I cant create the property or call the function. But it's ok, I'll just have to keep everything in one swf :/