javascript - Move an object with Create.js -


i'm trying move line in erase.js read thread issue, nothing works me. problem that, can manipulate properties label position, not line position. creation of line is:

var result = {};                 //generation of 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 neighbours                 result.neighbours = o;                  //add label                 result.label = new createjs.text("line", "", "#000");                 result.label.textalign = "center";                 result.label.y = 80;                 result.label.x = 200;                  //add dragger , 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); 

if execute:

myshapes[2].label.y = 200; myshapes[2].label.x = 300; stage.addchild(myshapes[2].__dragger); stage.update(); 

the position updated, if try with:

myshapes[2].line.graphics.moveto(300,4000) stage.addchild(myshapes[2].__dragger); stage.update(); 

the object not updated. idea??

i not sure understand doing, here thought:

you can't move line using graphics.moveto -- instruction position drawing api subsequent path instructions. if line.graphics.lineto(300,4000), draw line last graphic instruction coordinate (within shape's coordinate system).

to move shape, must set x , y position of shape instance (in case myshapes[2].line)

if post more info, can try , assist more.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -