Skip to main content
Participant
October 16, 2009
Question

Drag Drop (probably easiest question ever)

  • October 16, 2009
  • 1 reply
  • 622 views

I'm new to flash and don't have anyone to ask for help so here I am...

I am just trying to create a draggable object.  Easy right?  Sure looks like it should be simple.  But nope, never for me.  So I do this:

on (press) {
     startDrag (this);
}
on (release, releaseOutside) {
     stopDrag ();
}


then I do Test Movie and when I click and drag, the ENTIRE CANVAS drags.  The object I set the action for AND every other object on the canvas moves.
I'm creating this for a classroom and would really appreciate any help/advice I can get!  Thanks!
This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
October 16, 2009

don't use a button.  use a movieclip.

even better, give your movieclip an instance name (say mcBtn), do not attach code to objects and use:

mcBtn.onPress=function(){

this.startDrag();

}

mcBtn.onRelease=mcBtn.onReleaseOutside=function(){

this.stopDrag();

}

t1gAuthor
Participant
October 19, 2009

Well, I tried that and I am getting errors.   I know it must be that I've done something wrong so here are the errors I'm getting.

1120: Access of undefined property Exposition2. Exposition2.onPress=function(){

1120: Access of undefined property Exposition2. Exposition2.onRelease=Exposition2.onReleaseOutside=function(){

1120: Access of undefined property Exposition2. Exposition2.onRelease=Exposition2.onReleaseOutside=function(){

Help!

kglad
Community Expert
Community Expert
October 19, 2009

you have no movieclip with instance name Exposition2.  flash is case sensitive.