<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 實現

    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:

    ?

    總結:

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

    主站蜘蛛池模板: 最近中文字幕mv免费高清视频8| 在线亚洲午夜片AV大片| 女人让男人免费桶爽30分钟| 亚洲AV乱码久久精品蜜桃| 免费夜色污私人影院网站| 国产无遮挡吃胸膜奶免费看| 亚洲AV无码一区二区三区久久精品 | 国产三级在线免费观看| 3344免费播放观看视频| 亚洲精品一区二区三区四区乱码| 亚洲av无码兔费综合| 青青草国产免费久久久91| 亚洲av色香蕉一区二区三区蜜桃| 国产美女a做受大片免费| 国产精品亚洲精品日韩电影| 亚洲精品无码激情AV| 亚洲国产福利精品一区二区| 国产四虎免费精品视频| 亚洲中文字幕无码一区二区三区| 77777亚洲午夜久久多喷| 91在线视频免费91| 色九月亚洲综合网| 在线亚洲午夜理论AV大片| 一级毛片免费播放| 国产亚洲精品bv在线观看| 免费在线视频一区| 91免费国产视频| 亚洲神级电影国语版| 日韩中文无码有码免费视频| 亚洲一卡2卡4卡5卡6卡残暴在线| 免费高清在线影片一区| 国产V片在线播放免费无码| 久久亚洲精品国产精品| 午夜寂寞在线一级观看免费| 一本久久A久久免费精品不卡| 色播亚洲视频在线观看| 在线观看亚洲免费| 美女被cao网站免费看在线看| 亚洲永久网址在线观看| 亚洲精品乱码久久久久久按摩 | 亚洲精品一卡2卡3卡三卡四卡|