[Red5] SimpleBallDemo in AS3 ?
Yann JAMAR
yann.jamar at paquetbtp.fr
Tue Dec 16 00:49:25 PST 2008
Thank you for all , i have written a new portion of code , it can be usefull if someone has the same problem...
Here my code and this time it works thanks to you :)
import flash.net.NetConnection;
import flash.events.NetStatusEvent;
import flash.net.SharedObject;
import flash.events.SyncEvent;
import flash.net.ObjectEncoding;
import flash.events.AsyncErrorEvent;
function netStatusHandler(e:NetStatusEvent):void{
switch (e.info.code) {
case "NetConnection.Connect.Success" : /// check if connection is ok
initRemote();
break;
}
}
function initRemote():void{
so= SharedObject.getRemote("simpleChatDemo", nc.uri, false); //instanciate share object
so.addEventListener(SyncEvent.SYNC, newMovement);
so.connect(nc);
this.addEventListener(Event.ENTER_FRAME, updatePosition); //enter frame tu update new position in simple ball demo
}
function newMovement(e : SyncEvent):void{
trace("newMovement");
trace(so.data.mousePosition); ///yes there is an object !!
}
var nc:NetConnection = new NetConnection(); ///
nc.client = this;
nc.connect("rtmp://localhost/oflaDemo"); //connection to so
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); //listener on connection
var so:SharedObject;
function updatePosition(e:Object):void{
so.setProperty("mousePosition",{x: 100, y: 300}); /// new position is set in simple ball demo , yessss
}
----- Original Message -----
From: Andy Shaules
To: red5 at osflash.org
Sent: Monday, December 15, 2008 10:35 PM
Subject: Re: [Red5] SimpleBallDemo in AS3 ?
Hello,
#1 No shared objects can be made until you get a netstatus event, "NetConnection.Connect.Success" at which time you create and connect to the SO.
#2 No setting properties on shared objects until the first 'SyncEvent' which occures after first connection to SO.
There is no way to execute all this code in a single function successfully unless by some small chance you have a PentiumII 450 cpu where all status events will fire from server before subsequent lines of code. And even then its only a small chance that it will work.
----- Original Message -----
From: Dominick Accattato
To: red5 at osflash.org
Sent: Monday, December 15, 2008 1:03 PM
Subject: Re: [Red5] SimpleBallDemo in AS3 ?
try:
so.setProperty("mousePosition", {x:10, y:30});
On Mon, Dec 15, 2008 at 3:59 PM, Yann JAMAR <yann.jamar at paquetbtp.fr> wrote:
Thank you for your answer but it doesn't seem to work ...
(i am a beginner with as3)
here is my code :
I just want to communicate wih simpleBalldemo, so when we have new position i want to set the logo always in the same position (x=0 ; y= 0 ) when there is a drag in SimpleBallDemo.
import flash.net.NetConnection;
import flash.events.NetStatusEvent;
import flash.net.SharedObject;
import flash.events.SyncEvent;
import flash.net.ObjectEncoding;
import flash.events.AsyncErrorEvent;
//NetConnection.defaultObjectEncoding = ObjectEncoding.AMF0;
//SharedObject.defaultObjectEncoding = ObjectEncoding.AMF0;
// create basic netConnection object
var nc:NetConnection = new NetConnection();
nc.client = this;
// connect to the local Red5 server
nc.connect("rtmp://localhost/oflaDemo");
// create StoredObject - pass the name of the shared object, the netConnection URI ("rtmp://localhost/oflaDemo"), and whether or not it's persistant
var so:SharedObject = SharedObject.getRemote("simpleChatDemo", nc.uri, false);
// setup the onSync events. We need to know when someone has added something to the chat
so.addEventListener(SyncEvent.SYNC, newMovement);
// connect to the SO using the netConnection reference
so.connect(nc);
// this method is called when the data on the Shared Object is updated
function newMovement(e : SyncEvent):void{
trace("newMovement");//
//i can read but i can't write ....
so.data.mousePosition = {x: 0, y: 0};//always x=0 ,y=0 when we drag the logo in SimpleBallDemo ,this doesn't work ...
}
Best regards ,
Yann.
----- Original Message ----- From: "Iuri Diniz" <iuridiniz at gmail.com>
To: <red5 at osflash.org>
Sent: Monday, December 15, 2008 6:44 PM
Subject: Re: [Red5] SimpleBallDemo in AS3 ?
Your error message is not in English, maybe french?
Please try:
declare a new void method on the calling object
public function onBWDone():void{
}
and before nc.connect do:
nc.client = this
On Mon, Dec 15, 2008 at 12:06 PM, Yann JAMAR <yann.jamar at paquetbtp.fr> wrote:
Hi all ,
Did someone managed to port SimpleBallDemo in As3.
( I've got this error :
Error #2044: AsyncErrorEvent non pris en charge : text=Error #2095:
flash.net.NetConnection n'a pas été en mesure d'appeler l'élément de rappel
onBWDone. error=ReferenceError: Error #1069: La propriété onBWDone est
introuvable sur flash.net.NetConnection et il n'existe pas de valeur par
défaut.)
)
Best regards.
Yann.
----- Original Message ----- From: "ddprasad" <ddprasad at gmail.com>
To: <Red5 at osflash.org>
Sent: Monday, December 15, 2008 2:33 PM
Subject: [Red5] RTMPT/HTTP Same Port 80
For quite a few days I have been working with Red5 Server. Congrats to its
developers.
However I have a doubt, I faced this problem few hours ago.
red5.properties file (windows)
# HTTP
http.host=0.0.0.0
http.port=80 // Check This
https.port=443
.......
# RTMPT
rtmpt.host=0.0.0.0
rtmpt.port=80 // Check This
rtmpt.ping_interval=5000
rtmpt.max_inactivity=60000
And it works fine on windows (jetty & http server works okay, also on
internet)
However on linux (jetty starts, http server doesnt start)
CAN ANY PERSON COME FORWARD AND HELP WHAT IS WRONG.
Thanx
--
View this message in context:
http://www.nabble.com/RTMPT-HTTP-Same-Port-80-tp21014037p21014037.html
Sent from the Red5 - English mailing list archive at Nabble.com.
_______________________________________________
Red5 mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
_______________________________________________
Red5 mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
--
Iuri Diniz
http://iuridiniz.com [Sou um agitador, não um advogado]
http://blog.igdium.com [Linux on Limbo]
_______________________________________________
Red5 mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
_______________________________________________
Red5 mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
--
Dominick Accattato, CTO
Infrared5 Inc.
www.infrared5.com
----------------------------------------------------------------------------
_______________________________________________
Red5 mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
------------------------------------------------------------------------------
_______________________________________________
Red5 mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/red5_osflash.org/attachments/20081216/dacbd4dd/attachment.html>
More information about the Red5
mailing list