1. 程式人生 > >FLEX 4常用設定背景圖片的方法

FLEX 4常用設定背景圖片的方法

<?xml version="1.0"encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

               xmlns:s="library://ns.adobe.com/flex/spark"

               xmlns:mx="library://ns.adobe.com/flex/mx"

               minWidth="955"minHeight="600">

    <s:BorderContainer width="100%"height="100%"backgroundImage="@Embed(source='assets/untitled.png')">

        //內容

    </s:BorderContainer> 

</s:Application>

註釋:圖片不能用絕對路徑,一般用@Embed(source='圖片路徑)"

 <s:BorderContainer width="100%"height="100%"backgroundImage="@Embed(source='assets/untitled.png')">中

source後的是檔案路徑,flex中路徑的起始位置是src目錄,加 ../就是到src的上一層