Jump to content


Drag & Drop with Resizing?


  • You cannot reply to this topic
4 replies to this topic

#1 Teun

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 16 February 2007 - 03:07 PM

Hi,

I am just a beginner in Flash, but I found a great way to make some Drag & Drop thing.
I want the user to be able to pick an image, and they can place it somewhere else to create a monster.

I use this code:
on(press) {
startDrag(this,false);
}

on(release) {
stopDrag();
}


on(press) {
startDrag(this,false);
}

on(release) {
stopDrag();
}

But I want the user to be able to drag a tiny little thumbnail of the part, and they will drag the normal sized part and place it on the rest of the "monster"

Anybody know how I can make this? Thanks.

Teun ^_^

#2 Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 16 February 2007 - 05:52 PM

So you want a tool, that rests in the corner of the pieces, that when you click and drag it, it resizes?

#3 Teun

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 17 February 2007 - 04:16 AM

No, I just want to have a thumbnail of an image, and when they drag it, it will be a bigger version of the thumbnail. :rolleyes:

#4 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 18 February 2007 - 09:40 PM

There are a number of ways you could try and do this...if I understand what you are going for correctly.

IMO, the best way would be to have a dummy movieclip that starts the drag (like an invisible button) and it just uses the larger image as the target for the startDrag() method.

thmb.onPress = function():Void {
	startDrag(this._parent.bigImg, true);
}

Assuming thmb is the thumbnail and bigImg is the larger image you would like to drag.

thmb and bigImg would have to be in the same movieclip, or on the main timeline for that code to work. You'll need to play around with the release and showing/hiding of the larger thumbnail, but that there is the basics.

Tip for drag and drops: use onReleaseOutside = onRelease = function(){}; rather than onRelease = function(){}; If you leave out the onReleaseOutside and someone drags the mouse cursor outside of the flash window and releases, the dragged item will be stuck to the cursor when you mouse back over the flash movie and it will be difficult to impossible to get it off again.

#5 Teun

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 19 February 2007 - 08:31 AM

Thanks much! I'll try that! :(





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users