Loading Bits components in a later frame

Everything about the SmartFoxBits UI Components for SmartFoxServer 1.x. Post your questions, suggestions and bug reports.

Moderators: Lapo, Bax

vega
Posts: 7
Joined: 01 Oct 2009, 17:03

Loading Bits components in a later frame

Postby vega » 01 Oct 2009, 17:15

Hello all,

I am developing a multiplayer game and trying out the sfbits community edition components for the login and lobby features. It works fine except for when I try to load the components in a frame other than the first one.

If I am loading the classes in the 2nd frame and load the components in the same frame (I know that they should be loaded after the classes have been loaded already but that method gives another problem which I will describe later) then the preloader works properly but the components don't show up. Instead I see only a white rectangular box where the components were supposed to be.

If I uncheck the "Export in frame #N" checkbox from the components' properties then I get the error that "The class or interface 'SFSEvent' could not be loaded." for the function onLogin

The function is the standard one in one of the examples provided with the community edition and works perfectly when I am loading everything on frame 1:

Code: Select all

function onLogin(evt:SFSEvent):Void
{
   var response:Object = evt.params.resObj
      
   if (response.success) {
      trace("logged in!");
      gotoAndStop("lobby");
   }
}


I will really appreciate it if anyone can give me some pointers as to how to solve this problem. Feel free to ask me about any details which I may have missed out on in this post.

Thanks.
User avatar
cksachdev
Posts: 55
Joined: 28 Aug 2007, 10:13
Location: Bangalore, India
Contact:

Few Details

Postby cksachdev » 01 Oct 2009, 21:00

@vega:
By your post it seems you are trying in Flash Authoring Tool. I want to know few details:
1. Which version of Flash Authoring tool you are using ? CS2/CS3/CS4
2. You are on AS2 or AS3 ?
3. Have you added smartfox flash API in your library path/classpath ?
--
Chetan Sachdev
Site: http://www.chetansachdev.com
vega
Posts: 7
Joined: 01 Oct 2009, 17:03

Re: Few Details

Postby vega » 01 Oct 2009, 22:40

Thanks for replying.

I am using Flash CS4 with AS2. Sorry for not mentioning it in the earlier post.

I have added the smartfox flash API in the classpath.

This is a code snippet from where the onLogin function is located (connector_mc is the bits component):

Code: Select all

import it.gotoandplay.smartfoxserver.*
import it.gotoandplay.smartfoxbits.events.*
import mx.utils.Delegate

connector_mc.addEventListener(SFSEvent.onLogin, Delegate.create(this, onLogin))

function onLogin(evt:SFSEvent):Void
{
   var response:Object = evt.params.resObj
      
   if (response.success) {
      trace("logged in!");
      gotoAndStop("lobby");
   }
}
User avatar
Bax
Site Admin
Posts: 4608
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 07 Oct 2009, 16:07

What does it means that you are "loading" the components in the second frame?
Paolo Bax
The SmartFoxServer Team
vega
Posts: 7
Joined: 01 Oct 2009, 17:03

Postby vega » 08 Oct 2009, 10:25

Hello bax,

I meant that I am trying to put a pre-loader for the flash file and for that purpose I set my classes to load in the second frame and put a customized preloader in the empty first frame. As it is, if I don't move anything from the first frame then everything works but the data size on that frame is more than that of any other frame and it takes a lot of time for the preloader itself to appear, which defeats the whole purpose of there being a preloader.

Now, the flash components are supposed to be loader after the classes have loaded already so I unchecked the "Export in frame 2" options from the Bits components which I am using and set them manually on the stage after frame 2. That throws the error which I mentioned in the earlier post.

If I leave that option checked then it doesn't throw an error but instead gives me two empty white rectangles where the components were supposed to be.

I will really appreciate any help in solving this issue.


Regards.
vega
Posts: 7
Joined: 01 Oct 2009, 17:03

Postby vega » 13 Oct 2009, 12:20

I guess I will have to dump the bits components altogether. The lack of response from the people on forums is a bit frustrating though.

I realize that they are not at my beck and call, and have their own things to attend to before they can spare time to help people out on the internet forums but then if there is no participation from at least a set of active users on a support forum then doesn't that defeat the whole purpose of having a forum in the first place? I almost gave up on smartfox server initially because not much help was available on the official forums and I had to figure out everything on my own through trial and error and trawling through the documentation.

Oh well..
User avatar
Bax
Site Admin
Posts: 4608
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 14 Oct 2009, 13:21

We setup a basic test application: 4 empty frames (where a preloader could be located for example) and a fifth frame containing the Connector, the LoginBox and a stop() action.
We then right-clicked both Bits in the library, selected "Linkage..." in the menu and unchecked the "Export in first frame" option.
When running the application, everything works fine.
We are using Flash CS3 and exporting for FP9.

EDIT: the same works in Flash CS4 exporting for both FP9 and FP10
Paolo Bax
The SmartFoxServer Team
vega
Posts: 7
Joined: 01 Oct 2009, 17:03

Postby vega » 16 Oct 2009, 12:39

Thanks for replying.

I tried it again and it is still giving me the error "The class or interface 'SFSEvent' could not be loaded." when I try to compile.

If it's not too much trouble, can you please share the test application fla so that I can see where I am going wrong.

Thanks.
User avatar
Bax
Site Admin
Posts: 4608
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 19 Oct 2009, 07:24

Drop us an email, and we will send the FLA file.
Paolo Bax
The SmartFoxServer Team
vega
Posts: 7
Joined: 01 Oct 2009, 17:03

Postby vega » 21 Oct 2009, 11:15

Please send the fla to:

kdevsh AT gmail DOT com

Thanks.

Return to “SmartFoxBits for SFS 1.x”

Who is online

Users browsing this forum: No registered users and 1 guest