Drag and Drop Animate CC, Html5, english

preview_player
Показать описание
Drag and DropTutorial with Animate CC.
If the Movieclip overlaps a destination Movieclip, it changes the transparency.
Рекомендации по теме
Комментарии
Автор

i'm just teaching myself adobe animate and this was very helpful. I wonder, how would I go about adding more draggables to go into the same area?

dsillustrates
Автор

can drag n drop use with mobile devices?

creatiflamultimedia
Автор

I copied the script verbatim (unless I missed something, but I rechecked everything) and even though the images show up in the browser, I can't drag the circle:


//Drag Object Creation
//Placed inside a container to hold both label and shape
var dragger = new lib.Rad();
dragger.x = dragger.y = 100;


//Destination Object Creation
var destination = new lib.Steel();
destination.x = 350;
destination.y = 150;




//DRAG
dragger.on("pressmove", function (evt) {

var p = evt.currentTarget.parent.globalToLocal(evt.stageX, evt.stageY);
evt.currentTarget.x = p.x;
evt.currentTarget.y = p.y;
stage.update(); //much smoother because it refreshes the screen...
if (intersect(evt.currentTarget, destination)) {
evt.currentTarget.alpha = 0.2;
} else {
evt.currentTarget.alpha = 1;
}
});




//Mouse UP and
dragger.on("pressup", function (evt) {
if (intersect(evt.currentTarget, destination)) {
var dB =
dragger.x = dB.x + dB.width / 2;
dragger.y = dB.y + dB.height / 2;
dragger.alpha = 1;
stage.update(evt);
}
});


function intersect(obj1, obj2) {

var objBounds1 = obj1.getTransformedBounds();
var objBounds2 = obj2.getTransformedBounds();

if {
return true;
} else {
return false;
}
}


//Adds the object into stage
stage.addChild(destination, dragger);
stage.mouseMoveOutside = true;
stage.update();

ryanstanford
Автор

Thank you very much for the help, it served me too much. Thanks for your job.

beisserdiaz
Автор

very helpful please make more tutorials

KidsEducatoinal
Автор

Hay, kommen demnächst mehr von Flash und ActionScript 3 ???

ItsMe-fjco