<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    咖啡伴侶

    呆在上海
    posts - 163, comments - 156, trackbacks - 0, articles - 2

    Flex ColorLabel 實現(xiàn)

    Posted on 2008-03-28 09:58 oathleo 閱讀(495) 評論(0)  編輯  收藏 所屬分類: Flex
    ?public class ColorLabel extends Label
    ?{
    ??private var colorValue:Number = -1;
    ??public function ColorLabel()
    ??{
    ???super();
    ??}
    ??
    ??public function setColorValue(colorValue:Number):void
    ??{
    ???this.colorValue = colorValue;
    ??}
    ??
    ??override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
    ???? {
    ??????????? super.updateDisplayList(unscaledWidth, unscaledHeight);
    ??????????? if(colorValue>=0){
    ??????????? ?drawColor(colorValue);
    ??????????? }
    ???? }
    ??
    ??private function drawColor(colorValue:Number):void
    ???? {
    ???? ?? this.graphics.beginFill(colorValue);
    ????????????? this.graphics.drawRect(this.textField.x,this.textField.y,this.textWidth ,this.textHeight);
    ????????????? this.graphics.endFill();
    ???? }
    ?}
    ?
    ?
    ?*? <p>In general, components do not override the <code>validateProperties()</code>,
    ?*? <code>validateSize()</code>, or <code>validateDisplayList()</code> methods
    .?
    ?*? In the case of UIComponents, most components override the
    ?*? <code>commitProperties()</code>, <code>measure()</code>, or
    ?*? <code>updateDisplayList()</code> methods
    , which are called
    ?*? by the <code>validateProperties()</code>,
    ?*? <code>validateSize()</code>, or
    ?*? <code>validateDisplayList()</code> methods, respectively.</p>
    ?
    ?

    ?

    Implementing the commitProperties() method

    You use the commitProperties() method to coordinate modifications to component properties. Most often, you use it with properties that affect how a component appears on the screen.

    Flex schedules a call to the commitProperties() method when a call to the invalidateProperties() method occurs. The commitProperties() method executes during the next render event after a call to the invalidateProperties() method. When you use the addChild() method to add a component to a container, Flex automatically calls the invalidateProperties() method.

    Calls to the commitProperties() method occur before calls to the measure() method. This lets you set property values that the measure() method might use.

    Implementing the measure() method

    The measure() method sets the default component size, in pixels, and optionally sets the component's default minimum size.

    Flex schedules a call to the measure() method when a call to the invalidateSize() method occurs. The measure() method executes during the next render event after a call to the invalidateSize() method. When you use the addChild() method to add a component to a container, Flex automatically calls the invalidateSize() method.

    Implementing the updateDisplayList() method

    The updateDisplayList() method sizes and positions the children of your component based on all previous property and style settings, and draws any skins or graphic elements that the component uses. The parent container for the component determines the size of the component itself.

    A component does not appear on the screen until its updateDisplayList() method gets called. Flex schedules a call to the updateDisplayList() method when a call to the invalidateDisplayList() method occurs. The updateDisplayList() method executes during the next render event after a call to the invalidateDisplayList() method. When you use the addChild() method to add a component to a container, Flex automatically calls the invalidateDisplayList() method.

    Drawing graphics in your component

    Every Flex component is a subclass of the Flash Sprite class, and therefore inherits the Sprite.graphics property. The Sprite.graphics property specifies a Graphics object that you can use to add vector drawings to your component.

    For example, in the updateDisplayList() method, you can use methods of the Graphics class to draw borders, rules, and other graphical elements:

    ?

    總結(jié):

    修改屬性用commitProperties,自己畫用updateDisplayList

    主站蜘蛛池模板: 亚洲性久久久影院| 日韩免费视频在线观看| 亚洲日韩激情无码一区| 一级毛片完整版免费播放一区| 午夜免费福利在线观看| 亚洲成av人片在www鸭子| 国内外成人免费视频| 亚洲国产精品18久久久久久| 女人张腿给男人桶视频免费版| 亚洲日本va一区二区三区| 在线观看视频免费国语| 国产亚洲美女精品久久久久| 国产精品免费看香蕉| 九九免费精品视频在这里| 国外亚洲成AV人片在线观看| a级毛片100部免费观看| 久久久久久久亚洲Av无码 | 亚洲精品午夜久久久伊人| 精品久久久久久久免费人妻 | 无码人妻久久一区二区三区免费| 亚洲国产另类久久久精品| 2020因为爱你带字幕免费观看全集 | 久久精品国产亚洲av四虎| 最近中文字幕无免费| 日本v片免费一区二区三区| 精品女同一区二区三区免费播放| 亚洲国产精品成人一区| 一区二区三区无码视频免费福利| 亚洲精品国产手机| 免费羞羞视频网站| 精品无码国产污污污免费网站国产| 亚洲AV无码第一区二区三区| 97在线观免费视频观看| 美女黄频免费网站| 在线免费观看视频你懂的| 春意影院午夜爽爽爽免费| 777亚洲精品乱码久久久久久| 免费看a级黄色片| 中文字幕无码免费久久| 中文字幕乱码亚洲无线三区| 久久亚洲中文字幕精品一区 |