how to drag/drop image from other image in one container
Dear masters,
I beg enlightenment, I was made toys. where if the "process button" I click he will draw according to the size of the input that I entered. now the problem is how can I create a new image and can be dragged drop but without deleting the old image and the new image does not in front of the old image. so as if we make more than one picture and each can be dragged drop, but from one button "process"?
what happened today, I can made picture a lot but when in drag drop, all the pictures move together. I want only picture which I Click can move, but another not.
here my code :
import flash.display.MovieClip; import flash.events.MouseEvent; import flash.events.Event; var mc:MovieClip = new MovieClip(); mc.buttonMode = true; var randomColours:int = Math.floor(Math.random() * 0xFFFFFF); process_btn.addEventListener(MouseEvent.CLICK, process); mc.addEventListener(MouseEvent.MOUSE_DOWN, item_onMouseDown); mc.addEventListener(MouseEvent.MOUSE_UP, item_onMouseUp); function item_onMouseDown(event:MouseEvent):void { mc.startDrag(); } function item_onMouseUp(event:MouseEvent):void { mc.stopDrag(); } function process(event:MouseEvent):void { panjang = Number(panjang_txt.text); lebar = Number(lebar_txt.text); mc.graphics.lineStyle(4, 0x000000, .5); mc.graphics.beginFill(randomColours, .2); mc.graphics.drawRect(0, 0,(panjang/10)/1.3, lebar/10); mc.graphics.endFill(); mc.x = 20; mc.y = 150; addChild(mc); } |
regards,
Prabowo
