1

ランタイムで生成されたビットマップデータがあり、フレックス スキン クラスに scaleninegrid を適用したいと考えています。次のようにしました。

  <fx:Script>
    <![CDATA[
        import mx.events.FlexEvent;

        [Embed(source="progressBarTrack.png")]
        private var host:Class;

        [Bindable]
        private var texture:BitmapData

        protected function skin1_preinitializeHandler(event:FlexEvent):void
        {
            //here is just an example,my bitmapdata will be retrieved by an other way.
                          texture = Bitmap(new host()).bitmapData;
        }

    ]]>
</fx:Script>
<s:Graphic scaleGridBottom="11" scaleGridLeft="14" scaleGridRight="40" scaleGridTop="10">
    <s:Rect width="300" height="22">
        <s:fill>
            <s:BitmapFill source="{texture}"/>
        </s:fill>
    </s:Rect>
</s:Graphic>

ただし、幅と高さを設定しても機能しませんでした。ソース画像を埋め込もうとしても機能しましたが、ビットマップデータが実行時に生成されるため、@embed のようにスケールを設定できません.... .,scaleGridLeft.....

ソースコードをハックして、それをサポートする独自のグラフィック要素を作成する前に、いくつかのヒントを得たいと思います。

どうもありがとう!!!

4

1 に答える 1

0

bytearray.org のScaleBitmap クラスを見てください。BitmapData を拡張して実行時に scale9 ビットマップをレンダリングするオープン ソース クラスです。

于 2015-10-12T06:18:58.153 に答える