smartfox swf refference

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Post Reply
Eralmidia
Posts: 9
Joined: 25 Apr 2010, 02:34

smartfox swf refference

Post 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".
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post 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.
Lapo
--
gotoAndPlay()
...addicted to flash games
Eralmidia
Posts: 9
Joined: 25 Apr 2010, 02:34

Post 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?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Lapo
--
gotoAndPlay()
...addicted to flash games
Eralmidia
Posts: 9
Joined: 25 Apr 2010, 02:34

Post 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 :/
Post Reply