Welcome

Welcome to my blog. I mainly blog about the basics of running Flash games over the internet, but sometimes I get distracted. Here you will find my efforts at programming turn based Flash games, plus links to all the games I have written. You are free (as in beer) to get all the code, just email me - nicolas_evans at yahoo.com (sorry you cant click on it - I dont want more spam).

Building Multiplayer Games in Flash.

The Posts

Monday, April 17, 2006

Hi. Have started work converting another program to work over the net. I had a big gotcha, I didnt convert a property to numeric when converting from a string to objects. Here is the corrected code, the Number function makes it work.
static function fnConvertStringToObjects (pString:String,bProperties:Boolean):Array {

var i:Number;
var arTemp =new Array();
var arTemp2 =new Array();
var arTempOut = new Array();

arTemp = pString.split(",");  
for (i =0;i<arTemp.length;i++) {
 if (arTemp[i] == "undefined" || arTemp[i] == "") 
  arTempOut.push("Empty");
 else if (!bProperties) {
  if (_level0[arTemp[i]])
   arTempOut.push(_level0[arTemp[i]] );
 }
 else { // parse properties (name:nRotation:bLeaky)
  arTemp2 = arTemp[i].split(":");
  trace (arTemp2)
  if (arTemp2[0] == "undefined" || arTemp2[0] == "") 
   arTempOut.push("Empty");
  else if (_level0[arTemp2[0]]) {
   arTempOut.push(_level0[arTemp2[0]] );
   _level0[arTemp2[0]].nRotation = Number(arTemp2[1]);
   _level0[arTemp2[0]].bLeaky = arTemp2[2];
  }    
 }
}
return arTempOut;
}

# posted by nicolas_evans @ 7:35 PM
Comments: Post a Comment




This page is powered by Blogger. Isn't yours?