[转]Flex应用程序中嵌入SVG文件

http://www.it118.org/specials/be5aa227-758a-4292-a143-5d0de10556fb/346c8779-cfdd-4eaa-ba1f-faa2e2a538d7.htm

可以将 SCG 文件嵌入到 Flex 应用程序中。

嵌入 SVG 文件与嵌入图像几乎是相同的。差别在于您可以将嵌入的 SVG 文件的实例当作 Sprite 类的实例处理。 (它们实际上是 SpriteAsset 类的实例, SpriteAsset 类是 Sprite 类的子类。) 嵌入的 SVG 文件还保留它们的矢量属性, 且在被缩放或转换时不会显示像素。

注意: 不能在运行时导入 SVG 文件;仅可以在编译时在 Flex 应用程序中嵌入它们。

<?xml version="1.0" encoding="utf-8"?>  
<mx:Application   
    xmlns:mx="http://www.adobe.com/2006/mxml"   
    layout="horizontal"   
    viewSourceURL="srcEmbeddingSvgFiles/index.html"  
    width="600" height="470"  
  
>  
    <mx:Script>  
    <![CDATA[ 
            [Embed(source="assets/frog.svg")] 
 
            [Bindable] 
            public var SvgFrog:Class;             
        ]]>  
    </mx:Script>  
  
    <mx:Image id="smallFrog" source="{SvgFrog}" width="128" height="130"/>  
  
    <mx:Image id="largeFrog" source="{SvgFrog}"/>  
</mx:Application>  

你可能感兴趣的:(xml,Flex)