Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.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 Flex:如何从flash.display.Bitmap创建图像控件?_Apache Flex_Image_List_Itemrenderer - Fatal编程技术网

Apache flex Flex:如何从flash.display.Bitmap创建图像控件?

Apache flex Flex:如何从flash.display.Bitmap创建图像控件?,apache-flex,image,list,itemrenderer,Apache Flex,Image,List,Itemrenderer,我需要从位图创建一个图像控件,因为我有一个ItemRedender用于列表控件 我正在尝试在列表控件中显示图像列表(位图),但现在无法显示。只需创建新图像并将图像源设置为位图,即可将位图用作图像。您可以这样做: var _image:Image = new Image(); _image.source = yourBitmap; 试试这个例子,希望这会有所帮助 请修改图像路径 <?xml version="1.0" encoding="utf-8"?> <mx:Applica

我需要从位图创建一个图像控件,因为我有一个ItemRedender用于列表控件


我正在尝试在列表控件中显示图像列表(位图),但现在无法显示。

只需创建新图像并将图像源设置为位图,即可将位图用作图像。您可以这样做:

var _image:Image = new Image();
_image.source = yourBitmap;

试试这个例子,希望这会有所帮助

请修改图像路径

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
        <![CDATA[
            [Embed(source="assets/<image1>")]
            [Bindable]
            public var img1:Class;

            [Embed(source="assets/<image2>")]
            [Bindable]
            public var img2:Class;
            [Bindable]
            private var arr:Array = new Array({image:img1},{image:img2});

        ]]>
    </mx:Script>
    <mx:List dataProvider="{arr}" width="100%" height="100%">
        <mx:itemRenderer>
            <mx:Component>
                <mx:Image source="{data.image}"/>
            </mx:Component>
        </mx:itemRenderer>
    </mx:List>
</mx:Application>