Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Adobe Flex SDK 3.0 (Release)
-
None
-
Affected OS(s): All OS Platforms
Affected OS(s): All OS Platforms
Language Found: English
Description
Steps to reproduce:
1. Create a new project called BugDemo in FlexBuilder. Create a folder src and set it as the main source folder. Save the following as the file BugDemo.as in the src folder and set it as the default application file:
package {
import flash.display.Sprite;
public class BugDemo extends Sprite
{
//using relative path works correctly in flex builder and mxmlc
[Embed(source="../src_other/flex_header.jpg")]
public static var embeddedAsset:Class;
//absolute classpath works correctly in flex builder, not in mxmlc
// [Embed(source="/flex_header.jpg")]
// public static var embeddedAsset:Class;
public function BugDemo()
{ var other:Other = new Other(); addChild(new embeddedAsset()); } }
}
2. Create the folder src_other. And add it as an additional source folder. Save the file flex_header.jpg in the folder src_other. Save the following as the file Other.as in the folder src_other:
package
{
public class Other
{
public function Other()
}
}
3. In a terminal window, navigate to the root project folder and the swf should compile successfully using the line
mxmlc src/BugDemo.as -sp+=src_other
4. In the file BugDemo.as, comment out the definition for embeddedAsset:Class lines and uncomment the second definition. Try and compile again using mxmlc
Actual Results:
Project fails to compile with mxmlc, but will compile successfully using FlexBuilder.
Expected Results:
According to page 965 of the Flex Developer Guide:
"If the path starts with a slash character, Flex first searches the directory of the MXML file for the asset, and then it searches the source path. You specify the source path to the Flex compiler by using the source-path compiler option. For example, you set the source-path option as the following code shows: -source-path=a1,a2,a3 The MXML file a1/testEmbed.mxml then uses the following code: <mx:Button label="Icon Button" icon="@Embed(source='/assets/logo.gif')"/> Flex first searches for the file in a1/assets, then in a2/assets, and then in a3/assets."
mxmlc should check all the source paths for the embedded assets when using the slash notation. it appears to only support relative paths.
Workaround (if any):
Use relative paths instead of absolute paths for embedding assets.