Skip to main content
Inspiring
March 25, 2021
Answered

Drag and drop basics

  • March 25, 2021
  • 1 reply
  • 1609 views

Adding some basic drag and drop to a project resulted in a blank movie when I tested it. So I created a new project with just one object (ball) and applied this drag and drop Actionscript to it. Still getting a empty canvas when I test it. I'm sure I'm missing something basic, but I am not seeing it if anyone else can please. 

 

ball.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);

function fl_ClickToDrag(event:MouseEvent):void
{
ball.startDrag();
}

stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);

function fl_ReleaseToDrop(event:MouseEvent):void
{
ball.stopDrag();
}

 

This topic has been closed for replies.
Correct answer kglad

Thanks kglad. 

 

I tried this code but, again, get a blank screen. Is there something that should prepend this drag and drop code? Adobe documentation for using these external codes is really lacking imo.


nothing else is needed except an on stage symbol with instance name ball (which i assume you have/had).

 

oops, the closing curly bracket wasn't included in my original post.  it's fixed now.

1 reply

kglad
Community Expert
Community Expert
March 26, 2021

is this an as3 project (and not a canvas project)?  ie, you're NOT testing by opening a browser window.

 

if yes, are there any actionscript errors and is there anything in frame 1 of the main timeline?

Inspiring
March 26, 2021

It is a canvas project. No errors except this warning:

WARNINGS:
Frame numbers in EaselJS start at 0 instead of 1. For example, this affects gotoAndStop and gotoAndPlay calls. (2)

 

I have two layers. On frame 1 of the first is the actionscript provided before, and on the second layer is the ball object. That's it. 

 

kglad
Community Expert
Community Expert
March 26, 2021

if it's a canvas project all the errors will be in your browser's developer console.  and there will be lots of them because you're using actionscript instead of javascript/createjs.