« API from Breeze | Inicio | AudioVideoStreamer with Flashcom. First Approach »

A little game in Flashcom

It's true, that the most amazing feature of Flashcom is his poweful video and audio streaming, but , i think that the real power of flashcom is in sharedobjects. Here you are a really simple app to show the power of SO and syncro between conected users.

It is a simple "3 on line". Of course, it can be really improved, but it is just a test

//Initial values·········································· //I use 6 mc's, they are circles with two frames, one frame is a red circle //("rojo") and the other frame is a black circle ( "negro" ) circulo1={mc:circulo1_mc, x:40, y:235, color:"rojo" };//first circle circulo2={mc:circulo2_mc, x:20, y:194, color:"rojo" };//second circle circulo3={mc:circulo3_mc, x:40, y:152, color:"rojo" }; circulo4={mc:circulo4_mc, x:20, y:110, color:"negro"}; circulo5={mc:circulo5_mc, x:40, y:69, color: "negro" }; circulo6={mc:circulo6_mc, x:20, y:27, color: "negro" }; //array var circulos=[circulo1,circulo2,circulo3,circulo4,circulo5,circulo6]; //Zone flashcom········································· function initSO(nc){ //We build a non persistent SO my_so=SharedObject.getRemote("tresraya_so",nc.uri,false); my_so.onSync=function(lista){ for ( var prop in my_so.data){ debug("propiedad:valor - > "+prop+" : "+my_so.data[prop]); } var indexe=my_so.data.props[0]; var xPos=my_so.data.props[1]; var yPos=my_so.data.props[2]; circulos[indexe].mc._x=xPos; circulos[indexe].mc._y=yPos; } my_so.connect(nc); } //Conexión al servidor Flash Communication Server nc=new NetConnection(); nc.onStatus=function(info){ if(info=="NetConnection.Connect.Success");{ debug("estoy conectado"); initSO(this); } } nc.connect("rtmp:/tresenraya"); //functins·····························3 //trace function debug(texto){ trace(texto); } /* *Metodo: estadoIncial *Desc: establish the initial values and colors * *params: No params. */ estadoInicial=function(){ for (var i=0;i

A simple code, but it works and it can be used to show the power of So. You can improve it, i.e. makin the SO persistent on the Server, so you can "save match".