我想在erase.js中移動一行我讀這個問題的一些線程,但沒有爲我工作。問題是,我可以操縱一些屬性,如標籤位置,但不是行位置。 剛纔我行的創建是:移動一個對象與Create.js
var result = {};
//Generation of the line
result.line = new createjs.Shape();
result.line.graphics.setStrokeStyle(3);
result.line.graphics.beginStroke("#000");
result.line.graphics.moveTo(o[0].__dragger.x + 24 , o[0].__dragger.y);
result.line.graphics.lineTo(o[1].__dragger.x - 24, o[1].__dragger.y);
result.line.graphics.endStroke();
//result.line.shadow = new createjs.Shadow("#000000", 5, 5, 10);
//Add the neighbours
result.neighbours = o;
//Add the label
result.label = new createjs.Text("line", "", "#000");
result.label.textAlign = "center";
result.label.y = 80;
result.label.x = 200;
//Add the dragger and extra properties
result.type = "connector";
result.__dragger = new createjs.Container();
if(id == "")
result.__dragger.id = "L" + guid();
result.__dragger.addChild(result.line, result.label);
stage.addChild(result.__dragger, result.line);
result.__dragger.on("click",function(evt) {
Shape.create("square", [], "Assignament");
});
stage.addChild(result.__dragger);
stage.update();
myShapes.push(result);
如果我執行:
myShapes[2].label.y = 200;
myShapes[2].label.x = 300;
stage.addChild(myShapes[2].__dragger);
stage.update();
的位置被更新,但如果我嘗試:
myShapes[2].line.graphics.moveTo(300,4000)
stage.addChild(myShapes[2].__dragger);
stage.update();
對象不是更新。一些想法?
你能澄清你在做什麼嗎?也許簡化示例,以便它可以在jsfiddle.net中運行? – Lanny