Hi,
I have been trying to reposition a body inside a world to its original position , but some how i cannot seem to do this , only the movieclip seems to move not the body associated with it -
below is the code i am using - the file is here - http://www.fastswf.com/yAnIvBs (when i remove the event listener)
with event listener - http://www.fastswf.com/rpYsIt8
////////========================
stop();
var startXPos:Number = level1WorldObj.box1.x;
var startYPos:Number = level1WorldObj.box1.y;
function areaS(e:Event) {
level1WorldObj.box1.y= startYPos;
level1WorldObj.box1.x= startXPos;
level1WorldObj.box1.removeEventListener(Event.ENTER_FRAME, areaS);
}
but1.addEventListener(MouseEvent.CLICK,nClick3);
function nClick3(event:MouseEvent):void{
level1WorldObj.box1.addEventListener(Event.ENTER_FRAME, areaS);
level1WorldObj.box1.y= startYPos;
level1WorldObj.box1.x= startXPos;
}
Also a most strange behavior seems to be happening the movie clip seems to move but not the body , please see this in debugdraw - http://www.fastswf.com/-Ijkta4
Why am i unable to do it in wck and what i need to do to achieve it ...
Thanks in advance ...
Jin
I have been trying to reposition a body inside a world to its original position , but some how i cannot seem to do this , only the movieclip seems to move not the body associated with it -
below is the code i am using - the file is here - http://www.fastswf.com/yAnIvBs (when i remove the event listener)
with event listener - http://www.fastswf.com/rpYsIt8
////////========================
stop();
var startXPos:Number = level1WorldObj.box1.x;
var startYPos:Number = level1WorldObj.box1.y;
function areaS(e:Event) {
level1WorldObj.box1.y= startYPos;
level1WorldObj.box1.x= startXPos;
level1WorldObj.box1.removeEventListener(Event.ENTER_FRAME, areaS);
}
but1.addEventListener(MouseEvent.CLICK,nClick3);
function nClick3(event:MouseEvent):void{
level1WorldObj.box1.addEventListener(Event.ENTER_FRAME, areaS);
level1WorldObj.box1.y= startYPos;
level1WorldObj.box1.x= startXPos;
}
Also a most strange behavior seems to be happening the movie clip seems to move but not the body , please see this in debugdraw - http://www.fastswf.com/-Ijkta4
Why am i unable to do it in wck and what i need to do to achieve it ...
Thanks in advance ...
Jin