Thursday, January 10, 2013

Object Drag & Drop in flash

Object Drag & Drop in flash

Using flash action script 2.0 you and drag and drop object in the stage first download a suitable image i used bellow picture

  Next open flash action script 2.0 document import image into stage modify the the document larger than the image imported.then insert new layer draw rectangle over the image. (1/4th of the image) select rectangle then covert to movie clip symbol name as MC_shape and give instance name also as MC_shape.Make other new 3 layers and draw 3 rectangles to cover the image next convert to movie clips give name and instance name as mc_shape1,mc_shape2&mc_shape3 


Stage look like as bellow

Next insert new layer name as actions right click 1st frame of actions layer go to actions plane write the bellow scripts

MC_shape.onPress = function(){
MC_shape.startDrag();
}
MC_shape.onRelease = function(){
MC_shape.stopDrag();
}
MC_shape1.onPress = function(){
MC_shape1.startDrag();
}
MC_shape1.onRelease = function(){
MC_shape1.stopDrag();
}
MC_shape2.onPress = function(){
MC_shape2.startDrag();
}
MC_shape2.onRelease = function(){
MC_shape2.stopDrag();
}
MC_shape3.onPress = function(){
MC_shape3.startDrag();
}
MC_shape3.onRelease = function(){
MC_shape3.stopDrag();
}
Then go control test movie


No comments:

Post a Comment