[問題] flex 嵌入圖片

看板Flash作者 (())時間16年前 (2009/06/06 16:17), 編輯推噓1(109)
留言10則, 3人參與, 最新討論串1/1
最近剛碰flex,想要試著將圖片加入flex中呈現 由於我在測試時發現了錯誤,所以有點疑問 程式碼很短,如下 <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > <mx:Button id="myButton" label="Download File" icon="@Embed(source='/assets/download_icon.png')"/> </mx:Application> 但出現了兩個錯誤.... unable to resolve '/assets/download_icon.png' for transcoding Unable to transcode /assets/download_icon.png. 上網查了些資訊,有人把圖檔轉成SWF後才使用 請問是否無法直接這麼使用必須一定要先轉成SWF? 或者是我哪裡寫錯了呢@@a (不好意思...問題很初階 囧) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 202.39.223.4

06/06 19:18, , 1F
咦?應該是可以直接embed圖檔沒問題的呀
06/06 19:18, 1F

06/06 19:19, , 2F
不然在Script tag裡面用embed metatag嵌入到一個Class
06/06 19:19, 2F

06/06 19:19, , 3F
物件,然後把Button tag的icon attribute值設為此class
06/06 19:19, 3F

06/06 19:44, , 4F
降子阿....那我試試看這個方法,感謝︿︿
06/06 19:44, 4F

06/07 00:43, , 5F
<mx:Button label="Download File">
06/07 00:43, 5F

06/07 00:44, , 6F
<mx:icon>@Embed(source='/assets/download_icon.png')
06/07 00:44, 6F

06/07 00:44, , 7F
</mx:icon>
06/07 00:44, 7F

06/07 00:44, , 8F
</mx:Button> 改成這樣子呢
06/07 00:44, 8F

06/07 00:45, , 9F
我自己這樣寫是可以將圖片嵌入在按鈕裡面
06/07 00:45, 9F

06/08 09:47, , 10F
不好意思 我發現錯誤了 資料夾路徑放置在SRC下才對...
06/08 09:47, 10F
文章代碼(AID): #1AAYNyTC (Flash)