<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 閱讀(490) 評論(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

    主站蜘蛛池模板: 黄色网页在线免费观看| 免费人成年激情视频在线观看 | 亚洲黄色网站视频| 国产va在线观看免费| 久久精品亚洲日本佐佐木明希| a级片免费在线播放| 亚洲一卡2卡三卡4卡有限公司| 少妇太爽了在线观看免费视频| 亚洲日韩图片专区第1页| 24小时日本电影免费看| 亚洲国产夜色在线观看| 嫩草影院免费观看| 老司机午夜免费视频| 自拍偷自拍亚洲精品被多人伦好爽| 国产精品偷伦视频免费观看了| 亚洲成a人片在线观看无码专区| 久99久精品免费视频热77| 97亚洲熟妇自偷自拍另类图片| 青青草a免费线观a| 亚洲av无码偷拍在线观看| JLZZJLZZ亚洲乱熟无码| 久久成人无码国产免费播放| 亚洲一级毛片在线观| 国产成人涩涩涩视频在线观看免费| 久久99精品免费一区二区| 亚洲国产香蕉碰碰人人| 无码永久免费AV网站| 特级毛片免费观看视频| 亚洲好看的理论片电影| 女人张开腿等男人桶免费视频| 一级大黄美女免费播放| 67pao强力打造67194在线午夜亚洲| 天天摸天天操免费播放小视频 | 亚洲另类自拍丝袜第1页| 情侣视频精品免费的国产| 岛国精品一区免费视频在线观看 | 国产精品亚洲一区二区三区在线观看| 亚洲国产日韩在线观频| 18禁美女黄网站色大片免费观看| 亚洲高清一区二区三区电影| 亚洲av永久无码精品秋霞电影影院|