Skip to main content
Leafcutter
Inspiring
October 6, 2013
Question

How do I use Embed with an environment variable in an Actionscript AIR project Flash Builder 4.7

  • October 6, 2013
  • 1 reply
  • 599 views

I am using Flash Builder 4.7 to build an Actionscript AIR project.  The project embeds a number of png files from my local directory and I have been using absolute paths which all works fine.

I have a laptop with which I want to start developing the same project - I set up a git repository that both the laptop and main pc can pull from and so I can get the source where I need it and push it back to the central repository.

My problem is that the absolute paths for the embed commands don't work on the laptop as it has a different filesystem setup (Windows 8 with one drive as opposed to Windows 7 with a SSD and a data drive).  I thought the solution would be as easy as using an environment variable to specify the path which could then point to a different physical directory on both machines, i.e:

[Embed(source = "DEVELOPER_RESOURCES/graphics/are/here.png"]

I did a bit of research and there was quite a lot mentioned about setting up resource directories using path variables which I worked through but I just can't get it to compile.  The Actionscript compiler just won't find the png files however I specify the path.  I tried something with a FLEX project and the compiler didn't complain but I think this is because the compiler for FLEX uses a different convention.

[Embed(source ="/Project Name/DEVELOPER_RESOURCES/graphics/are/here.png"]  works with FLEX but not Actionscript.

So does anyone have a recipe for using the Embed command referencing assets using an environment variable that works across multiple machines with different file structures?

This topic has been closed for replies.

1 reply

Leafcutter
Inspiring
October 8, 2013

I managed to find a solution on Windows which was to use symlinks and absolute paths.  You an basically point one directory to another so I did something like:

mklink c:\developer_resources c:/the/local/path/to/my/resources

and then reference all resources as c:\developer_resources\...

Now as long as a developer machine has the right link (from c:\developer_resources to the place where the resources are kept) then it seems to work. 

This doesn't however work for Mac and certainly isn't a solution for passing files between Mac and windows