I'm trying to create a draggable dialog, which includes an input text field and I want to prevent the dialog from dragging when the input text is selected. If I create a sprite with a hit area at the top everything works as expected, but when I add the input text field below the hit area selecting the text drags the dialog. Here's an example of the problem: import flash.display.Sprite; import flash.events.MouseEvent; import flash.text.TextField; import flash.text.TextFormat; //dialog back var rectshape:Sprite= new Sprite(); rectshape.graphics.beginFill(0xCCDDCC,.8); rectshape.graphics.drawRect(0,0,400,300); rectshape.graphics.endFill(); addChild(rectshape); rectshape.buttonMode=true; rectshape.addEventListener(MouseEvent.MOUSE_DOWN, onClick); stage.addEventListener(MouseEvent.MOUSE_UP, onUp); //hit area var hit:Sprite= new Sprite(); hit.graphics.beginFill(0,.2); hit.graphics.drawRect(0,0,400,40); hit.graphics.endFill(); rectshape.addChild(hit); //define the hit area rectshape.hitArea=hit; rectshape.x=200; rectshape.y=200; //input text var format:TextFormat=new TextFormat(); var tf:TextField=new TextField(); rectshape.addChild(tf); tf.x=20; tf.y=50; tf.width=350; tf.height=150; format.size=17; format.color=0xFFFFFF; format.align="left"; tf.multiline=true; tf.wordWrap=true; tf.selectable=true; tf.defaultTextFormat=format; tf.text="input text--Na alit et la cor susciduip enim dolenim acil ut prat nis nulputat ipit velissenit lamet, consed tionullam, quat. Equatum dunt praessit dignismodip et lortin ent acilla faci tat nonsed mod elestrud tem vel dit veliquis non hendiam, volore facidunt ipisl ullaore dit alit dionsed modipis nonsecte modion henissi."; function onClick(event:MouseEvent):void { rectshape.startDrag(false); } function onUp(event:MouseEvent):void { rectshape.stopDrag(); }
... View more