Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
brmcc #1
How to doubleClick-enable a TextField?
The code below works, but after setting stage.focus in the doubleClick handler
the TextField is in some sort of drag state as can be seen by moving the mouse
left and right after the double click (after the mouse button is released). Any
advice anyone? Alternate approaches?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="initApp()">
<mx:Script>
<![CDATA[
import flash.text.*;
public function initApp():void
{
createTextField(10,10,"Hello");
createTextField(100,10,"Goodbye");
}
private function createTextField(x:int, y:int, s:String) : TextField
{
var tf:TextField = new TextField();
tf.type = TextFieldType.INPUT;
tf.width = 80;
tf.height = 40;
tf.border = true;
tf.text = s;
tf.x = x;
tf.y = y;
tf.doubleClickEnabled = true;
canvas.addChild(tf);
this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
tf.addEventListener(MouseEvent.DOUBLE_CLICK, mouseDouble);
return tf;
}
private function mouseDown(event:MouseEvent):void
{
// take away the focus on a single click -- there may be a
// better way to do this but it seems to work.
stage.focus = null; // undo focus
}
private function mouseDouble(event:MouseEvent):void
{
var tf:TextField = event.target as TextField;
stage.focus = tf; // works, but tf is in some sort of drag state
}
]]>
</mx:Script>
<mx:UIComponent id="canvas" width="200" height="100"/>
</mx:Application>
brmcc Guest
-
DoubleClick DividedBox divider event?
Any simple way to trap a double click event on a divided box divider? -
DoubleClick Event on ListBox
I have created a user control that has a list box webcontrol. Unfortunately, The listbox control does not have the doubleclick event in it, and for... -
doubleclick row vs. ButtonColumns' click event
Does anyone know how I can tell if user has double-clicked on a DataGrid row or has actually clicked on any ButtonColumn in that row. I do not need... -
Textfield.html = true vs TextField.setTextFormat
H I need to use html textfield to control when the text must change the line (br tag). The problem is that I can't use setTextFormat if I use html... -
Disabling movie play with doubleclick
Hi, In my application I use QT to load and display a movie using the standard movie toolbox. I want to allow the user to play movies only with...



Reply With Quote

