0

Adobe Photoshop パネル (Flex 3 を使用) には、次のような数値入力を受け取るテキスト フィールドがいくつかあります。

<mx:TextInput x="90" y="10" width="50" height="20" restrict="0-9" id="myInput"/>

ユーザーが数字以外を入力できないようにしてrestrict="0-9"いますが、範囲を1〜100に制限したいと思います。

AS3 で変更イベント ハンドラーを使用して自分で実装する必要がありますか、それとも Flex がもたらすより良い解決策はありますか?

私はこれを試しました:

<fx:Declarations>
    <mx:NumberValidator source="{myInput}" property="text" integerError="Enter Integer value"
            minValue="1" maxValue="100" domain="int" 
            trigger="{myInput}" triggerEvent="change"
            invalid="myInput='50';"/>
</fx:Declarations>

しかし、私は得るError: Could not resolve <fx:Declarations> to a component implementation.

4

1 に答える 1

2

TextInput の代わりにNumericStepperを使用できます。次に、最小値最大値を設定できます。

<s:NumericStepper id="ns" minimum="1" maximum="100" />

更新: Flex 3 で。同様のプロパティで MX Numeric Stepper を使用できます。

<mx:NumericStepper id="ns" minimum="1" maximum="100" stepSize="1"/>
于 2013-07-30T18:46:09.120 に答える