Trying to implement a draggable table in my game that will be used for item purchases. Having said that I am looking for tutorials on how to do just that within the starling object. On starling as far as I could see startDrag() is not available, not sure how to implement this in my code.
Ok I managed to make the items moveable but I want to be able to mask the object and only move the items inside the mask. This is what I have so far:
The container has Nothing special going on here
store = new Store();
store.x = 176;
store.y = 226;
addChild(store);
store.mask = maskObject;
The draggable movie clip
var pos = 0;
var spacing = 20;
var initCounter = 0;
trace(xml.nodes);
var elements = xml.elements;
for(element in elements){
var item:StoreItem = new StoreItem(element.node.name.innerData,element.node.image.innerData,element.node.description.innerData,element.node.amount.innerData,element.node.ammo.innerData,element.node.weapon_max_level.innerData);
var yPos = (item.height*initCounter)+spacing;
item.y = yPos;
addChild(item);
initCounter++;
}
this.addEventListener(TouchEvent.TOUCH, onStoreTouch);
}
this.addEventListener(TouchEvent.TOUCH, onTouch);
public function onStoreTouch(e:TouchEvent){
var t:Touch = e.getTouch(Starling.current.stage);
switch(t.phase){
case "moved":
//moved finger/mouse
var touches:Vector<Touch> = e.getTouches(this, TouchPhase.MOVED);
trace(touches);
// one finger touching -> move
var delta:Point = touches[0].getMovement(this);
y += delta.y;
}
}
Now when I drag the clip it is dragging the mask along with the items inside the mask. I only want to drag the items inside