私はコントロールを派生シンプルなのTextInput、Ctrlキー+ SHFT + Bにその挿入のいくつかのテキストを持っている:TextInputのinsertText()を使用してバインディングを更新するにはどうすればよいですか?
package controls
{
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import spark.components.TextInput;
public class MyTextInput extends TextInput
{
private const BAM:String = "BAM!";
public function MyTextInput()
{
super();
this.addEventListener(KeyboardEvent.KEY_DOWN, interceptKey);
}
protected function interceptKey(event:KeyboardEvent):void
{
if((event.keyCode == Keyboard.B) && event.ctrlKey && event.shiftKey)
{
// Insert some text on Ctrl+Shft+B
event.preventDefault();
this.insertText(BAM);
}
}
}
}
を私はコントロールを使用する簡単なFlexアプリケーションがあります。
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:controls="controls.*"
width="230" height="120"
>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
[Bindable]
private var text:String;
]]>
</fx:Script>
<controls:MyTextInput left="10" right="10" top="10" text="@{text}"/>
<s:Label left="10" right="10" bottom="10" text="{text}"/>
</s:WindowedApplication>
ラベルフィールドをCtrl + Shft + Bを呼び出すと、期待されるテキストがTextInput派生コントロールに表示されますが、Labelでは表示されません。
Flash Builder 4.5.1。 –