我可以在CSS中设置Spark Image源吗?

时间:2012-05-14 11:19:41

标签: css flex flex4 stylesheet flex4.5

我想在flex 4.6中设置样式表中的图像源。

例如,

<s:Image styleName="imgDelete" />

来源将在CSS中提供......

我该怎么办?

1 个答案:

答案 0 :(得分:1)

取自:How to set an image's source in a Flex stylesheet (not Embed)

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
minWidth="636" minHeight="389" width="636" height="389"
>

<fx:Style>
    @namespace mx "library://ns.adobe.com/flex/mx";
    @namespace s "library://ns.adobe.com/flex/spark";

    s|Application {
        image-source: Embed(source="done.png");
    }

</fx:Style>
<mx:Image source="{getStyle('imageSource')}" >
</mx:Image>
</s:Application>