Re: [flexcoders] Embed statement and relative paths

2007-01-17 Thread Daniel Wabyick

Relative paths, strangely, are relative to the *file* that you are 
embedding assets in. So what I assume is that you are embedding in an 
MXML or CSS file some ways down in your project hierarchy.

My solution to this was to create an EmbedRegistry class which is the 
sole location of embed statements throughout my (medium sized) project.


/** Truncated version of the Embed registry. **/
public class EmbedRegistry
{
[Embed(source='../../../../assets/static_assets.swf', 
symbol='scene_icon')]
public static const sceneIcon : Class;

[Embed(source='../../../../assets/static_assets.swf', 
symbol='presentation_icon')]
public static const presentationIcon : Class;
}

Then, I can use the classes like such:

mx:Button icon={ EmbedRegistry.sceneIcon }  /

Hope that helps!
-D




Janis Radins wrote:

 Ignore previous message, accidentally pressed Send button to early

 So the problem is:
 I've stumbled upon problem that appears when I try to Embed some 
 assets in class Flex doesnt accept relative paths.
 Somehow I thought it should threat project root as root path for any 
 embedding but it seems it doesnt.
 Guess I tried everything and only full path starting from C:/ worked.
 Is this normal behavior or this is bug?

 Janis

  



Re: [flexcoders] Embed statement and relative paths

2007-01-17 Thread Keith Peters
you can also go to the project root by starting the path with /

Daniel Wabyick wrote:


 Relative paths, strangely, are relative to the *file* that you are
 embedding assets in. So what I assume is that you are embedding in an
 MXML or CSS file some ways down in your project hierarchy.

 My solution to this was to create an EmbedRegistry class which is the
 sole location of embed statements throughout my (medium sized) project.

 /** Truncated version of the Embed registry. **/
 public class EmbedRegistry
 {
 [Embed(source='../../../../assets/static_assets.swf',
 symbol='scene_icon')]
 public static const sceneIcon : Class;

 [Embed(source='../../../../assets/static_assets.swf',
 symbol='presentation_icon')]
 public static const presentationIcon : Class;
 }

 Then, I can use the classes like such:

 mx:Button icon={ EmbedRegistry.sceneIcon } /

 Hope that helps!
 -D

 Janis Radins wrote:
 
  Ignore previous message, accidentally pressed Send button to early
 
  So the problem is:
  I've stumbled upon problem that appears when I try to Embed some
  assets in class Flex doesnt accept relative paths.
  Somehow I thought it should threat project root as root path for any
  embedding but it seems it doesnt.
  Guess I tried everything and only full path starting from C:/ worked.
  Is this normal behavior or this is bug?
 
  Janis