所以我正在使用 FlashDevelop 和 flex,但我无法让源代码正常工作。当我嵌入图像时它工作得很好,但如果我只是去 source="../img/Koala.jpg" 我用于工作嵌入的相同路径它不起作用。在 flash builder 中,我所要做的就是 source="/img/Koala.jpg" ,它工作得很好。如果我输入路径“D:\flashDevelop\FlexMobileProject\src\img\Koala.jpg”,这可以正常工作。谁能解释一下我在这里缺少什么?
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="HomeView" creationComplete="init()">
<fx:Script>
<![CDATA[
[Embed(source = "../img/Koala.jpg")]
[Bindable] public var img:Class;
public function init():void {
var s:String = new String();
label.text = String(imgstage.sourceHeight);
trace(imgstage.source);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<!-- can't find the image even if that path is the same as the embed -->
<s:Image id="imgstage" source="../img/Koala.jpg" y="0" x="0"/>
<s:Label id="label" text="name"></s:Label>
</s:View>