Skip navigation
Currently Being Moderated

Embed path lookup in actionscript projects

Sep 7, 2012 12:55 PM

Tags: #flash_builder #path #metadata #embed #actionscript_project #4.7

The paths inside [Embed] metadata tags seem to be handled differently depending on if it's a pure Actionscript project or a Flex project.


In a Flex project, I can create a tag like this:

[ Embed(source="myAsset.png") ]

And the compiler will search for the file myAsset.png at the root of the project


In an actionscript project however (AIR or SWF) I get the following compiler error:

Could not find Embed source 'myAsset.png'. Searched '/Users/doug/Documents/Adobe Flash Builder 4.7/asWebTest4.7/src/myAsset.png', 'embeds/myAsset.png' in SWCs on the library 8Flex Problem


In order to get Flash Builder to find the file, I must either supply an absolute path, or a path relative to the file containing the [Embed] tag. 


This disconnect between Flex projects and Actionscript projects is problematic from a user experience perspective, and likely to cause confusion.  Also, this causes projects built in previous versions of Flash Builder to no longer compile.  The actionscript compiler should interpret Embed paths as relative to the project folder, IMO.  


As a side note, the phrase "in SWCs on the library path" in the compiler error is confusing in my opinion as it seems to imply that the compiler is searching filepaths inside of SWCs somehow.  Perhaps it should say, "Searched '/Users/doug/Documents/Adobe Flash Builder 4.7/asWebTest4.7/src/myAsset.png', 'embeds/myAsset.png', and in SWCs on the library path" ?

  • Currently Being Moderated
    Sep 9, 2012 10:09 PM   in reply to dmccluer



    There is a change in new compiler on how it resolves [Embed] metadata paths. (refer )


    The reason this behavior is different from Flex projects is they still use legacy compiler.

    Mark as:
  • Currently Being Moderated
    Sep 19, 2012 12:57 PM   in reply to dmccluer



    You can refer to embedded assets either relative to the embedding file (though this is less portable, as you note) or relative to a rooted location (Mac/Unix OS root, source root(s), library-path SWC roots) using a leading forward slash (this is similar to how paths are used in HTML to refer to items from the webroot):




    The forward slash approach should work in 4.6 and 4.7.


    The special "Eclipse path" resolution is no longer supported in sourc ecode embedded paths in 4.7 (since those are not portable to command-line or ant builds).

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points