Thursday, 15 January 2015

DRAG DROP IN AS2 AS3 EXAMPLES



---------------------------------------------------------------------------------------------------
CREATE TWO MOVIE CLIPS RED AND GREEN
INSTANCE NAME: red,green
PASTE BELOW CODE INSIDE RED MOVIE CLIP ACTION SCRIPT PANEL
---------------------------------------------------------------------------------------------------

on(press){
_root.red.startDrag();
_root.textmc._visible = false;
}
on(release){
if(_root.red._droptarget == "green")
{
_root.red._x = _root.green._x + (_root.green._width - _root.red._width) / 25;
_root.red._y = _root.green._y + (_root.green._height - _root.red._height) / 25;
_root.textmc._visible = true;
}
_root.red.stopDrag();
}

------------------------------------------------------------------------------------------------------
MOVIE DRAG DROP WITH ARRAY FUNCTION IN AS2
http://www.ilike2flash.com/2008/05/drag-and-drop-jigsaw.html
http://www.ilike2flash.com/2010/03/drag-and-drop-puzzle-in-actionscript-3.html
http://www.ilike2flash.com/2009/06/drag-and-drop-in-as3.html
http://www.ilike2flash.com/2010/03/drag-and-drop-puzzle-in-actionscript-3.html

----------------------------------------------------------------------------------------------------
DRAG AND DROP AS2 WITH ARRAY
https://www.youtube.com/watch?v=zQNQcqfFJuI
https://www.youtube.com/watch?v=DpUoVSOahq0
-----------------------------------------------------------------------------------------------------
var MovieArray = [MOVIE1,MOVIE2,MOVIE3]
for (i = 0; i < MovieArray.length; i++){
MovieArrayFunction(MovieArray[i]);
}
function MovieArrayFunction(MovieArray){
MovieArray.onPress = function (){
MovieArray.startDrag();
}
MovieArray.onRelease = function (){
MovieArray.stopDrag();
}}

----------------------------------------------------------------------------------------------------
DRAG AND DROP AS3 WITH ARRAY
https://www.youtube.com/watch?v=zQNQcqfFJuI
https://www.youtube.com/watch?v=DpUoVSOahq0
-----------------------------------------------------------------------------------------------------

var MovieArray = [MOVIE1,MOVIE2,MOVIE3];
for (var i:int = 0; i < MovieArray.length; i++){
MovieArray[i].addEventListener(MouseEvent.MOUSE_DOWN, drag);
MovieArray[i].addEventListener(MouseEvent.MOUSE_UP, drop);
}
function drag(event:MouseEvent):void {
event.currentTarget.startDrag();
}
function drop(event:MouseEvent):void {
event.currentTarget.stopDrag();
}

-------------------------------------------------------------------------------------------------------------
DRAG DROP IN AS2 WITH STOP DRAG WITH TELL TARGET CODE
CREATE TWO MOVIE CLIPS ONE CIRCLE AND OTHER CIRCLE TARGET BOX
1- INSIDE THE CIRCLE MOVIE CLIP ACTION PANEL  PASTE BELOW CODE
2-  CIRCLE TARGET BOX GIVE INSTANCE NAME  circletarget
3-MAKES AUTO TEXT BOX
4- http://jnoodle.com/flashtuts/347_dragdroptargetsmx.pdf
5-   http://youtu.be/2atM8Bbdt3Q
6    DOWNLOAD SOURCE FILE
    http://bit.ly/1yvGlfj



USE OWN TEXT BOX CODE CRATE CLASSIC INPUT TEXT BOX


---------------------------------------------------------------------------------------------------------------


on(press) {
startDrag(this);
if (this._droptarget == "/circletarget") {
this._x = _root.circletarget._x;
this._y = _root.circletarget._y;
this.stopDrag();
}}
on(release) {
this.stopDrag();

this.createTextField("my_txt", 10, 30, 80, 80,50);
my_txt.multiline = true;
my_txt.wordWrap = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0xFF0000;
my_fmt.underline = true;
my_txt.text = "Japan Flag";
my_txt.setTextFormat(my_fmt);

if (this._droptarget == "/circletarget") {
this._x = _root.circletarget._x;
this._y = _root.circletarget._y;
}
else{
this._x = 96.50;
this._y = 153.50;
}}

--------------------------------------------------------------------------------------------------------------------
OR USE UPPER CODE WRITE IN THIS WAY WITH RESET BUTTON
USE OWN TEXT BOX CODE CRATE CLASSIC INPUT TEXT BOX



--------------------------------------------------------------------------------------------------------------------

on(press) {
startDrag(this);
if (this._droptarget == "/circletarget") {
this._x = _root.circletarget._x;
this._y = _root.circletarget._y;
this.stopDrag();
}}
on(release) {
this.stopDrag();

_root.HitText.text = "JAPAN"

if (this._droptarget == "/circletarget") {
this._x = _root.circletarget._x;
this._y = _root.circletarget._y;
}
else{
this._x = 96.50;
this._y = 153.50;
}}

Reset_btn.onPress=function(){
Circle._x = 96.50;
Circle._y = 153.50;
}



EmoticonEmoticon