To create a shared object from the server-side:
this.createSharedObject(this.appScope, "mySharedObjectSO", false);
where this would be your class that extends ApplicationAdapter. false means
it's transient in nature; true would mean persistent in nature.
To retreive a reference to this shared object:
ISharedObject so = this.getSharedObject(this.appScope, "mySharedObjectSO",
false);
You can now call methods on so object eg:
counterSO.setAttribute("mySharedObjectSO", 5);
this is just an arbitrary example; it will set the value of the shared
object to integer number 5. However, I have tested and red5 is able to
successfully store ints, strings and even Map Objects to the shared object.
To create a shared object from client side:
soChat = SharedObject.getRemote( "videoConferenceChat", nc.uri, false );
soChat.addEventListener( NetStatusEvent.NET_STATUS, netStatusHandler );
soChat.addEventListener( AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler );
soChat.addEventListener( SyncEvent.SYNC, sharedObjectSyncHandler );
soChat.client = this;
soChat.connect( nc );
Where nc is your NetConnection object. To create a persistent shared object
use true instead of false.
On 3/30/07, Fábio Costa <[EMAIL PROTECTED]> wrote:
I found the problem, i was attempting to connect to a existing SO, but
when
i tryed to fixed i discovered that:
When i use :getSharedObject(Scope,Name,Persistence);
If the SO exists it gives me a null.
when i use: hasSharedObject(Scope,Name);
If the so exists it returns FALSE, and if it is'nt exist it creates it and
returns true!
In the documentation the said that the hasSharedObject should return
TRUE
if it exists and FALSE if it isn't, it also says that the getSharedObject
would create the object if it did'nt exist and use it if it exists.
I am implmenting ISharedObjectService in my class.
This is some sort of bug or something like that?
>Hi , i read the jwamicha tutorial and althoug i did learn some stuffs,
like
>the services, i still could'nt make the SO as i wanted.
>It is strange because i followed everything and......The shared Object
was
>kind of created, the persistend folder and the sharedObject Folder
>appeared, the shared object that i wanted Appeared too, with all the
>propertys but without the values.
>
>But what i'm really bugged is that i still get the null, when i ask to
>return the sharedObject, and i followed the jwamicha advice of don't
>putting nothing in the appStart , i didn't even implemented the method.
>And i still get my program to don't even see the sunlight.........
>
>There is something that i was supposed to do, besides getting the scope
and
>calling the function to create an SO?
>
>
> IScope oneScope= Red5.getConnectionLocal().getScope();
>
> boolean a=createSharedObject(oneScope,nameos,true);
>If someone give me a simple example of a SO creation i would be really
>glad.
>THanks again
>Fabio-Brazil
>>Hi,
>>Please see if this will help you it is based on Joachim's tutorial with
>>some
>>code examples for shared objects:
>>
http://jwamicha.wordpress.com/2007/01/29/create-a-new-java-red5-application/
On 3/29/07, F?bio Costa <[EMAIL PROTECTED]> wrote:
>>>
>>>Hi people,i'm a newbie develloper in red5.(i started for real
yesterday),
>>>and i'm with a huge issue.
>>> I followed the joachim bauch tutorial for shared objects and read
the
>>>documentation. But in my program it returns neither false nor true,
just
>>>null.
>>>I simplified my code to just create the damn sharedObject.
>>>
>>>JAVA CODE:
>>>
>>>public boolean Test(String nameos){
>>>
>>> IScope oneScope= Red5.getConnectionLocal().getScope();
>>>
>>> boolean a=createSharedObject(oneScope,nameos,true);
>>>
>>> return a;
>>> }
>>>
>>>and the AS Code:
>>>
>>>nc.call("Test",new ShowOutput,"anything");
>>>...
>>>
>>>
>>>function ShowOutput(){
>>> this.onResult = function(clientObj) {
>>> var theThing=clientObj;
>>>
>>>
>>> trace (theThing);
>>>
>>> }
>>>
>>>PS: also i would really like to know if there is some material for
>>>streaming
>>>LIVE pre-recorded FLV, with FMS2 i used to send the stream to the
>>>server-side,.asc, make it play and it would cause the publishing of the
>>>stream
>>>
>>>Thanks in Advance F?bio-Brazil
_________________________________________________________________
Verifique já a segurança do seu PC com o Verificador de Segurança do
Windows
Live OneCare! http://onecare.live.com/site/pt-br/default.htm
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org
--
C is forever.
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org