Drag & Drop Using Adobe Flash : The First Method: startDrag

The First Method: startDrag
Here is an overview of what we want to achieve :
 
1. When a displayObject is clicked, started having the object move around with the mouse with a corresponding offset position.

2. When the user lets go of the mouse button, stop dragging the object.

When you convert the above logic to code, you will see that it's actually very simple. Create a movieclip in flash, and instance name is something. I'm going to draw Circle and name mine circle_mc.


import flash.events.MouseEvent;
circle_mc.addEventListener(MouseEvent.MOUSE_DOWN,downf);
circle_mc.addEventListener(MouseEvent.MOUSE_UP,upf);
function downf(e:MouseEvent)
{ circle_mc.startDrag(); }
function upf(e:MouseEvent)
{ circle_mc.stopDrag(); }



The above code is in fact very simple, when clicked, startDrag, when release, stopDrag.

Source : www.entheosweb.com

0 komentar:

Posting Komentar

Free Flash TemplatesRiad In FezFree joomla templatesAgence Web MarocMusic Videos OnlineFree Website templateswww.seodesign.usFree Wordpress Themeswww.freethemes4all.comFree Blog TemplatesLast NewsFree CMS TemplatesFree CSS TemplatesSoccer Videos OnlineFree Wordpress ThemesFree CSS Templates Dreamweaver