簡體   English   中英

在Flex中更改進度欄顏色

[英]Change progress bar color in flex

在以下代碼中如何將進度條顏色更改為綠色

<?xml version="1.0" encoding="utf-8"?>
 <mx:Application 
xmlns:mx="http://www.adobe.com/2006/mxml" 
layout="absolute" 
width="100"
height="100"
creationComplete="init()">

<mx:Script>
    <![CDATA[
        import mx.controls.Alert;
        import flash.net.NetStream;

        private var myMic:Microphone;
        private var nc:NetConnection;


        private function init():void {
            initMic("0x19D319");


            myMic = Microphone.getMicrophone();
            myMic.setSilenceLevel(0);
            myMic.rate = 44;
            myMic.gain = 100;
            //myMic.setUseEchoSuppression(true);
            Security.showSettings(SecurityPanel.MICROPHONE);
            micLevel.visible = true;
            myMic.setLoopBack(true);


            addEventListener(Event.ENTER_FRAME, showMicLevel);
            if (myMic != null) 
            {
                micLevel.setProgress(myMic.activityLevel, 100);

            }


        }


        private function showMicLevel(event:Event):void{
            micLevel.setStyle("barColor", 0xf4b60f);

            switch (recordingState){
                case "idle" :

                    micLevel.setProgress(myMic.activityLevel, 100);
                    break;
                case "idle" :
                    Alert.show("2");
                    micLevel.setProgress(myMic.activityLevel, 100);
                    break;
                case "playing" :
                    micLevel.setProgress(ns.time, myDuration);
                    break;

            }
        }
        private function initMic(myColor:String):void{
            micLevel.setStyle("barColor", myColor);
        }

    ]]>
</mx:Script>

<mx:ProgressBar x="0" y="36" mode="manual" id="micLevel" label="" labelPlacement="bottom" width="100" fontSize="10" fontWeight="normal"/>


 </mx:Application>

您具有以下屬性來控制進度條的外觀

barColor="undefined"
barSkin="ProgressBarSkin"
borderColor="0xAAB3B3"
color="0x0B333C"
disabledColor="0xAAB3B3"

有關更多詳細信息,請參閱文檔

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:ProgressBar indeterminate="true" width="100%" 
        label="Ankur Sharma" bottom="10" barColor="#FF0000" trackHeight="15"/>

    <mx:ProgressBar indeterminate="true" width="100%" fontWeight="normal" 
        trackHeight="20" barColor="#333333" verticalGap="0" label="caseable.com"/>

</mx:Application>

嗨,檢查此進度條工作,可能您對此很在意

ANKUR

barColor樣式屬性必須設置為包含ProgressBar的容器 從文檔:

此樣式對其他組件沒有影響,但是可以在容器上設置以控制在其中找到的所有進度條的外觀。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM