我在Flash Builder项目中收到错误1084。我想分享我收到错误的文件。
package com.bykd.g4m.lobby.data
{
import com.bykd.xcom.data.DataObject;
import flash.utils.Dictionary;
import com.bykd.xcom.data.Room;
import com.bykd.xcom.data.User;
import com.bykd.g4m.lobby.GameManager;
public class GameInfo extends DataObject
{
public static const INIT_STATUS:Number = 1;
public static const BET_OPTION:String = "BET";
public static const EMPTY_STATUS:Number = 0;
public static const STATUS_ELEMENT:String = "STATUS";
public static const DRAW_OPTION:String = "DRAW";
public static const WINROUNDS_OPTION:String = "WINROUNDS";
public static const CREATE_STATUS:Number = 2;
public static const GAME_ELEMENT:String = "GAME";
public static const OPTIONS_ELEMENT:String = "OPTIONS";
public static const OBJECT_ELEMENT:String = "GAMEINFO";
public static const TIME_OPTION:String = "TIME";
public static const CREATOR_ELEMENT:String = "CREATOR";
public static const READY_STATUS:Number = 3;
public static const SCORE_OPTION:String = "SCORE";
public static const OPPONENT_ELEMENT:String = "OPPONENT";
private var __id:uint;
public var gameStatus:Number;
public var gameOptions:Dictionary;
public var gameRoom:Room;
public var gameOpponent:User;
public var gameCreator:User;
public var gameJoined:Boolean;
public function GameInfo(id:uint = 0, status:Number = 0, creator:User = null)
{
super();
__id = id;
gameStatus = status;
gameCreator = creator;
gameOptions = new Dictionary();
gameJoined = false;
}
public static function parseHeader(xml:XML) : Object
{
var nodeName:String = xml.localName();
var nodeParts:Array = nodeName.split("_",2);
return {
"element":nodeParts[0],
"id":parseInt(nodeParts[1])
};
}
override public function toXML() : XML
{
return new XML("<" + (OBJECT_ELEMENT + "_" + ID) + "/>");
}
override public function toXMLData(full:Boolean = true) : XML
{
var dataXML:XML = null;
var key:* = null;
var xml:XML = toXML();
if(full)
{
if(!isNaN(gameStatus))
{
dataXML = new XML("<" + STATUS_ELEMENT + "/>");
dataXML.appendChild(gameStatus.toString());
xml.appendChild(dataXML);
}
if(gameCreator != null)
{
dataXML = new XML("<" + CREATOR_ELEMENT + "/>");
dataXML.appendChild(gameCreator.toXML());
xml.appendChild(dataXML);
}
if(gameOptions != null)
{
dataXML = new XML("<" + OPTIONS_ELEMENT + "/>");
for(key in gameOptions)
{
**dataXML.appendChild(new XML("<" + key + ">" + ({gameOptions[key]}) + "</" + key + ">"));**
}
xml.appendChild(dataXML);
}
if(gameOpponent != null)
{
dataXML = new XML("<" + OPPONENT_ELEMENT + "/>");
dataXML.appendChild(gameOpponent.toXML());
xml.appendChild(dataXML);
}
if(gameRoom != null)
{
dataXML = new XML("<" + GAME_ELEMENT + "/>");
dataXML.appendChild(gameRoom.toXML());
xml.appendChild(dataXML);
}
}
return xml;
}
public function get ID() : uint
{
return __id;
}
override public function fromXML(xml:XML) : void
{
var dataXML:XML = null;
var userXML:XML = null;
var roomXML:XML = null;
var gameManager:GameManager = null;
var node:XML = null;
var key:String = null;
var header:Object = parseHeader(xml);
if(header.element == OBJECT_ELEMENT)
{
__id = header.id;
gameManager = GameManager.getInstance();
dataXML = xml.elements(STATUS_ELEMENT)[0];
if(dataXML != null)
{
gameStatus = Number(dataXML.toString());
}
dataXML = xml.elements(CREATOR_ELEMENT)[0];
if(dataXML != null)
{
userXML = dataXML.elements(User.OBJECT_ELEMENT)[0];
if(userXML != null && User.checkID(userXML))
{
gameCreator = gameManager.userService.getUserEntity(User.parseID(userXML));
}
}
dataXML = xml.elements(OPTIONS_ELEMENT)[0];
if(dataXML != null)
{
gameOptions = new Dictionary();
for each(node in dataXML.elements())
{
key = node.localName();
gameOptions[key] = node.toString();
}
}
dataXML = xml.elements(OPPONENT_ELEMENT)[0];
if(dataXML != null && dataXML.hasOwnProperty(User.OBJECT_ELEMENT))
{
userXML = dataXML.elements(User.OBJECT_ELEMENT)[0];
if(userXML != null && User.checkID(userXML))
{
gameOpponent = gameManager.userService.getUserEntity(User.parseID(userXML));
}
}
dataXML = xml.elements(GAME_ELEMENT)[0];
if(dataXML != null && dataXML.hasOwnProperty(Room.OBJECT_ELEMENT))
{
roomXML = dataXML.elements(Room.OBJECT_ELEMENT)[0];
if(roomXML != null && Room.checkID(roomXML))
{
gameRoom = gameManager.roomService.getRoomEntity(Room.parseID(roomXML));
}
}
}
}
}
}
问题在于此行根据Flash构建器:
dataXML.appendChild(new XML("<" + key + ">" + ({gameOptions[key]}) + "</" + key + ">"));
程序说这条线上有多个标记。 这是一个语法错误。提前致谢。