Results 1 to 4 of 4
  1.    #1  
    Does anyone have a sample for Mojo.Drag doesn't look like it's made it into the SDK samples yet.

    I'm not talking about screenMovement...
  2. #2  
    in the setup function:

    Code:
    this.dragStartHandler = this.dragStart.bindAsEventListener(this);
    this.draggingHandler = this.dragging.bindAsEventListener(this);
    this.dragEndHandler = this.dragEnd.bindAsEventListener(this);
    Element.observe(this.trackingArea, Mojo.Event.dragStart, this.dragStartHandler);
    then you have start drag, dragging and end drag as 3 separate functions:

    Code:
    GameAssistant.prototype.dragStart = function(event) {
    
    	this.startX = Event.pointerX(event.down);
    	this.startY = Event.pointerY(event.down);
    
    //observe dragging and dragEnd inside dragStart
    
    	Element.observe(this.trackingArea, Mojo.Event.dragging, this.draggingHandler);
    	Element.observe(this.trackingArea, Mojo.Event.dragEnd, this.dragEndHandler);
    	Event.stop(event);
    
    }
    then dragging:

    Code:
    GameAssistant.prototype.dragging = function(event) {
    	this.newX = Event.pointerX(event.move);
    	this.newY = Event.pointerY(event.move);
        Event.stop(event);
    }
    and then dragEnd:

    Code:
    GameAssistant.prototype.dragEnd = function(event) {
    	Element.stopObserving(this.trackingArea, Mojo.Event.dragging, this.draggingHandler);
    	Element.stopObserving(this.trackingArea, Mojo.Event.dragEnd, this.dragEndHandler);
    	Event.stop(event);
    }
    take note that if you just want the first coordinate when you start dragging, you need event.down, and as you are dragging you update using event.move. let me know if you have any questions.
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  3. #3  
    nm... i'm probably showing the screen movement you are referring to. are you looking for something like dragging an icon to a different location?
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  4.    #4  
    Yes, dragging an element into a container...

    Mojo.Drag.SetupDropContainer
    and
    Mojo.Drag.startDragging

Posting Permissions