parse & decode with SkinValue variable
I've got a problem. I'm making a game and I want my player to change skin when he's entering in the map "monde".
I've got 2 versions of fla files. One for a PC version, and one for android version.
In my “PC version” the code with skinValue is working and it’s not in my “Air for Android version”.
In my PC version I’ve got a player class named player.as :
public function Player(stageRef:Stage, walkRate:Number, targetBuffer:Number){
gotoAndStop(“default”+skinValue);
….
public function startWalking;
gotoAndStop(“walk”+skinValue);
....
public function stopWalking(e:Event):void{
removeEventListener(Event.ENTER_FRAME, walk);
gotoAndStop("default"+skinValue);
In my Engine class (where the game is controled) Engine.as :
var isMap:Boolean = thisBack == “monde”;
if (isMap) {
player.skinValue = “car”;
}
else {
player.skinValue = “”;
}
}
My player'got extra frames for that named "walkcar" and "defaultcar". and it’s WORKING GREAT !
But in my AIR version I’ve got this error :
Error #2109: Frame label defaultnull not found in scene defaultnull.
at flash.display::MovieClip/gotoAndStop()
at com.laserdragonuniversity.alpaca::Player()
at com.laserdragonuniversity.alpaca::Engine/createBackground()
at com.laserdragonuniversity.alpaca::Engine/configLoaded()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
I search what could be the problem and it seems that JSON is causing this error.
In my PC version I've got, in my engine.as file :
private function linesLoaded(e:Event):void{
linesData = JSON.decode(speechLoader.data);
...
private function configLoaded(e:Event):void{
configData = JSON.decode(configLoader.data);
I have to change "decode" by "parse" for my android version and it seems that it's the problem for my Skinvalue ! When it's "parse"..it won't work !
Any idea why ?
Thx !
