0

TextInputSkinから拡張するクラスRoundedTextInputSkinを作成しました

    package skins
{

    import assets.TextInput_389X35;

    import spark.skins.mobile.TextInputSkin;

    public class RoundedTextInputSkin extends TextInputSkin
    {

        public function RoundedTextInputSkin()
        {
            super();
            borderClass =  TextInput_389X35;
            layoutBorderSize = 5;
        } 
    }
}

これで、このスキンをskinClassとしてtextInputコントロールに指定しました。roundedTextInputを表示できましたが、textinputに入力されたテキストが表示されません。誰かが私のコードの何が悪かったのか教えてもらえますか?

これが私のfxgファイルです

    <?xml version="1.0" encoding="utf-8" ?>
<Graphic version="2.0" ai:appVersion="16.0.0.682" ATE:version="1.0.0" flm:version="1.0.0" d:using="" xmlns="http://ns.adobe.com/fxg/2008" xmlns:ATE="http://ns.adobe.com/ate/2009" xmlns:ai="http://ns.adobe.com/ai/2009" xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:flm="http://ns.adobe.com/flame/2008">
      <Group x="3" y="1.35449" ai:seqID="1" flm:knockout="false">
        <Rect x="0.5" y="0.5" width="389" height="35" radiusX="16.9997" radiusY="16.9997" ai:seqID="2">
          <fill>
            <LinearGradient x="194.5" y="0.38916" scaleX="34.2022" rotation="90">
              <GradientEntry ratio="0" color="#B0B0B0"/>
              <GradientEntry ratio="1" color="#E0E0E0"/>
            </LinearGradient>
          </fill>
        </Rect>
        <Rect x="0.5" y="0.5" width="389" height="35" radiusX="16.9997" radiusY="16.9997" ai:seqID="3"/>
      </Group>
</Graphic>
4

1 に答える 1

0

FXGファイルが表示したスキンクラスとどのように関連しているかは明確ではありません。ただし、提供したFXGはコードで参照されているTextInput_389X35であると想定します。カスタム境界線は他のすべての要素の上にあると思います。それらを見えなくします。TextSkinBaseのcreateChildren()メソッドごと。border要素は他のすべての上に配置されます。

override protected function createChildren():void
{
 super.createChildren();
 if (!textDisplay)
 {
     textDisplay = StyleableTextField(createInFontContext(StyleableTextField));
     textDisplay.styleName = this;
     textDisplay.editable = true;
     textDisplay.useTightTextBounds = false;
     addChild(textDisplay);
 }

 if (!border)
 {
   border = new borderClass();
   addChild(border);
 }
}

デフォルトのBorderFXG要素は、パスを使用して境界線を作成し、「塗りつぶし」が境界線になるようにします。長方形を使用すると、他のすべての上に大きな正方形を配置することになります。

于 2013-02-21T14:46:56.690 に答える