The following method is in my class. it retreives data through php. The data returned looks like this (as it appears in a flash trace):
race=Race%202%09%0D%0A%0D%0A&thisdate=2010%2D12%2D03&count=1
//method to handle returned data
private function dataLoaded(e:Event):void {
//set loaded variables into vars
var vars:URLVariables = new URLVariables(e.target.data);
var count:int = vars["count"];
var thisdate:String = vars["thisdate"];
var race:String = vars["race"];
//trace(count + ", date: " + thisdate + ", race: " + race);
//if no data is returned for the date, do nothing
if (count == 0) {
//do nothing
}
else if (count == 1) {
trace (race); // this works.. and prints out the correct value
switch (race) { // this doesn't work. switch statement always goes to default.
case "Practice":
trace("test 1");
//set date clip to correct color
var calendarday_ = days_clip.getChildByName(thisdate);
calendarday_.gotoAndStop(2);
break;
case "Race 1":
trace ("test 2");
//set date clip to correct color
var calendarday_ = days_clip.getChildByName(thisdate);
calendarday_.gotoAndStop(3);
break;
case "Race 2":
trace ("test 3");
//set date clip to correct color
var calendarday_ = days_clip.getChildByName(thisdate);
calendarday_.gotoAndStop(4);
break;
default:
trace ("fail");
break;
}
}
}
The first trace you see works. I see the data as it should be. each variable is correct.
the if else statement block that checks the count variable works. but for some reason the switch statement does NOT work. Even though the trace right before the statement shows the correct value. The switch statement always “fails”.
Don’t tell me its because my parameters have spaces in them. I edited my test DB to remove spaces from the parameters and yet it made no difference; the switch still went to default.
is this a bug? or am i being stupid?