I have created a js object like this:
var JSONObject = {};
and a function a create an element an adds that to JSONObject
:
function addShape(JSONObject, shapeStruct)
{
var sh = "shape"+shapeStruct.id.toString();
JSONObject.sh={
"id": shapeStruct.id,
"x1": shapeStruct.x1,
"x2": shapeStruct.x2,
"y1": shapeStruct.y1,
"y2": shapeStruct.y2
};
}
this function is in a separate file.
to call it i used:
shapeId++;
singleShapeStruct = {"id":shapeId, "x1":oldX, "x2":correctedX, "y1":oldY, "y2":yCanvas};
addShape(JSONObject, singleShapeStruct);
alert(JSONObject.shape0.x1);
the alert does not give any thing.
thanks for any kinf of help