Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex 将gif图像插入自定义flex进度条_Apache Flex_Progress Bar - Fatal编程技术网

Apache flex 将gif图像插入自定义flex进度条

Apache flex 将gif图像插入自定义flex进度条,apache-flex,progress-bar,Apache Flex,Progress Bar,我通过扩展flex的progressBar创建了一个自定义progressBar。我想使用flex的图像在自定义progressBar中插入一个gif图像,但什么也没有发生 我需要实现任何flex接口吗?请给我一些建议 多谢各位 package com { import mx.controls.Image; import mx.controls.Label; import mx.controls.ProgressBar; import mx.core.mx_in

我通过扩展flex的progressBar创建了一个自定义progressBar。我想使用flex的图像在自定义progressBar中插入一个gif图像,但什么也没有发生

我需要实现任何flex接口吗?请给我一些建议

多谢各位

package com
{

    import mx.controls.Image;
    import mx.controls.Label;
    import mx.controls.ProgressBar;
    import mx.core.mx_internal;

    use namespace mx_internal;


    public class CustomProgressBar extends ProgressBar
    {
        [Embed("resource/images/running_animated_gif.gif")]
        [Bindable]
        public var runningGif:Class;

        public function CustomProgressBar()
        {
            super();
        }

        override protected function createChildren():void
        {
            super.createChildren();

            var gifImage:Image = new Image();
            gifImage.source = runningGif
            addChild(gifImage);
        }

    }
}

ProgressBar具有蒙皮属性。可以对其应用自定义蒙皮组件。 下面的示例可以帮助您将皮肤添加到自定义progressbar类中

类名:-CustomProgressBar.as

package
{
    import mx.controls.ProgressBar;

    public class CustomProgressBar extends ProgressBar

    {
        public function CustomProgressBar()
        {
            super();
            this.setStyle("trackSkin", CustomProgressBarTrackSkin);
        }
    }
}
在skinclass中,您可以添加将显示在进度条上的图像。 CustomProgressBarTrackSkin.mxml

<?xml version="1.0" encoding="utf-8"?>
<s:SparkSkin name="CustomProgressBarSkin"
             xmlns:fx="http://ns.adobe.com/mxml/2009"
             xmlns:s="library://ns.adobe.com/flex/spark" >

    <fx:Script>
        <![CDATA[
            override protected function initializationComplete():void {
                useChromeColor = true;
                super.initializationComplete();
            }
        ]]>
    </fx:Script>

    <!-- layer 1: fill -->
    <s:Rect left="2" right="2" top="2" bottom="2" >
        <s:fill>
            <s:BitmapFill source="@Embed('resource/images/running_animated_gif.gif')" fillMode="repeat" />
        </s:fill>
    </s:Rect>

    <!-- layer 2: border -->
    <s:Rect left="2" right="2" top="2" bottom="2" >
        <s:stroke>
            <s:LinearGradientStroke rotation="90">
                <s:GradientEntry color="0xFFFFFF" alpha="0.9" />
                <s:GradientEntry color="0xFFFFFF" alpha="0.5" />
            </s:LinearGradientStroke>
        </s:stroke>
    </s:Rect>

    <!-- layer 3: right edge -->
    <s:Rect right="1" top="2" bottom="2" width="1" >
        <s:fill>
            <s:SolidColor color="0x000000" alpha="0.55" />
        </s:fill>
    </s:Rect>

</s:SparkSkin>

同样,你可以为不同的皮肤创建不同的类,比如barSkin等等


这可能会帮助你

你能添加一些代码。。。你到底试了什么。。。