Modifying the RedBox examples

Post your questions and bug-reports about the audio/video streaming add-on based on Red5 Media Server.

Moderators: Lapo, Bax

User avatar
JarochoCity
Posts: 181
Joined: 01 Dec 2005, 01:22
Location: Mexico
Contact:

Modifying the RedBox examples

Postby JarochoCity » 01 May 2009, 17:22

How can I modify the RedBox examples?

is there a .FLA ? or how can i modify it?

I want the .FLA without the SmartFoxBits
User avatar
Bax
Site Admin
Posts: 4385
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 02 May 2009, 09:46

Are you talking about AS2 or AS3 examples?
AS3 examples can be found in the latest SmartFoxServer download package, and are distributed as Flex Builder project source files.
AS2 examples can be downloaded from this link: the package contains the FLA files. These examples have been built using the SmartFoxBits. The RedBox requires the Connector only, which you can use even if you don't want to use the other Bits.
Paolo Bax
The SmartFoxServer Team
User avatar
JarochoCity
Posts: 181
Joined: 01 Dec 2005, 01:22
Location: Mexico
Contact:

Withouth SmatfoxBits

Postby JarochoCity » 02 May 2009, 14:29

Yeah, I'm talking about the AS2

But I don't want to use the smartfox bits, how can use those examples, using just the connector as you said, but not using the other smartfoxbits.

This is my code, but nothing happens:

Code: Select all

import it.gotoandplay.smartfoxserver.*
import it.gotoandplay.smartfoxbits.events.*

stop()

var zone:String = "SmartChatAV"
var myUserName:String = "Jack"
var SFSEvent:SmartFoxClient = connector_mc.connection

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

function onConnectionHandler(evt:SFSEvent):Void
{
   trace("Response");
   if (evt.params.success)
   {
      trace("Great, successfully connected!")       
     
      // Log into the "simpleChat" zone without using the LoginBox component
      smartFox.login(zone, myUserName)
   }
}

function onLogin(evt:SFSEvent):Void
{
   var response:Object = evt.params.resObj
   
   if (response.success)
      gotoAndStop("chat")
}


It doesn't trace anything, it only trace this:


Code: Select all

[Sending]: <msg t='sys'><body action='verChk' r='0'><ver v='153' /></body></msg>

[Received]: <cross-domain-policy><allow-access-from domain="*" to-ports="9339" /></cross-domain-policy>
[Received]: <msg t="sys"><body action="apiOK" r="0" /></msg>


I can see it doesn't call the onConnectionHandler function, because I don't see the "Response" trace.

I want this using AS2.
User avatar
Bax
Site Admin
Posts: 4385
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 02 May 2009, 22:34

It seems the Connector isn't trying to connect... is the autoConnect parameter set to true?
Paolo Bax
The SmartFoxServer Team
User avatar
JarochoCity
Posts: 181
Joined: 01 Dec 2005, 01:22
Location: Mexico
Contact:

yeah

Postby JarochoCity » 02 May 2009, 22:36

yeah, its set to true.

and i can see it connects, because it goes green and it says CONNECTED, but it doesnt handle the "SFSEvent.onConnection" function.
User avatar
Bax
Site Admin
Posts: 4385
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 02 May 2009, 22:49

Maybe you are receiving the event before the event listener is received. Try turning off the autoConnect, and call the Connector.connect method after adding your listeners.
Paolo Bax
The SmartFoxServer Team
User avatar
JarochoCity
Posts: 181
Joined: 01 Dec 2005, 01:22
Location: Mexico
Contact:

tried before

Postby JarochoCity » 03 May 2009, 00:48

I have also tried that, and once again, nothing happened.

So what should i do?
User avatar
Bax
Site Admin
Posts: 4385
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 04 May 2009, 06:51

Send us your fla, so we can give it a look.
Paolo Bax
The SmartFoxServer Team
User avatar
JarochoCity
Posts: 181
Joined: 01 Dec 2005, 01:22
Location: Mexico
Contact:

hey

Postby JarochoCity » 05 May 2009, 16:35

hey, ive send you the file through PM!
User avatar
Bax
Site Admin
Posts: 4385
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 06 May 2009, 06:35

You called the Connector instance on the stage mc_connector, but in the code you add listeners to connector_mc.
Paolo Bax
The SmartFoxServer Team
User avatar
JarochoCity
Posts: 181
Joined: 01 Dec 2005, 01:22
Location: Mexico
Contact:

another problem

Postby JarochoCity » 06 May 2009, 19:23

Now it shows me this:

Code: Select all

SmartFoxClient.myUserId and/or SmartFoxClient.myUserName properties not set: in case of custom login they must be set manually to the actual server values


What can I do?
User avatar
Bax
Site Admin
Posts: 4385
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 06 May 2009, 20:58

When using a regular login, the client will handle the login response via the onLogin event handler. Behind the scenes the client API will assign the SmartFoxClient.myUserName and SmartFoxClient.myUserId properties.

When using a custom login the response is sent back to the client via the extension and it is handled in the onExtensionResponse handler. In this case the myUserName and myUserId properties ARE NOT populated auto-magically, so you will need to do it manually.

In your custom login response from server to client also send the username and smartfoxserver id, and assign those properties manually.
Paolo Bax
The SmartFoxServer Team
User avatar
JarochoCity
Posts: 181
Joined: 01 Dec 2005, 01:22
Location: Mexico
Contact:

hey

Postby JarochoCity » 07 May 2009, 00:20

I have stablished the user and id, with the custom login and nothing happens :S

Still getting the same error.

I stablished the id and username this way on the onExtensionResponse:

Code: Select all

 _global.myName = resObj.name
            smartfox.myUserName = _global.myName;
            smartfox.myUserId = resObj.id;
            trace(smartfox.myUserId);
                gotoAndStop("chat")


And its working because I trace it.

But if that is not the way to set the user and id, how can I do it?
User avatar
Bax
Site Admin
Posts: 4385
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 07 May 2009, 05:54

The error you get is thrown if those properties are not set when the AVCastManager instance is created. So make sure you do not create it before the onExtensionResponse handler is called.
In case you already do this, can you please send via PM a fully working example? I can't compile the fla file you sent previously, due to missing classes.
Paolo Bax
The SmartFoxServer Team
User avatar
JarochoCity
Posts: 181
Joined: 01 Dec 2005, 01:22
Location: Mexico
Contact:

hey

Postby JarochoCity » 07 May 2009, 14:24

PM sent, thank you!

Return to “RedBox”

Who is online

Users browsing this forum: No registered users and 1 guest