I have a collection of visual assets (say icons) which I'd like to use
all over the place in my components.  I understand how I can embed an
asset directly into a component, like so

  [Bindable]
  [Embed(source='/resources/Buttons.swf',symbol='MoneyIcon')]
  public var MoneyIcon:Class;


What I wanted to do though was create a class like so

[Bindable]
public class Resources {
  [Bindable]
  [Embed(source='/resources/Buttons.swf',symbol='MoneyIcon')]
  public var MoneyIcon:Class;
}

and then reference that from a component like so
  [Bindable]
  public var icons:Resources = new Resources();


<mx:Button icon="{icons.MoneyIcon}"/>


But if I do that, I start getting all sorts of binding warnings - not
only does it complain that I won't see changes to icons, but other
bindings that should work, also start complaining.

The resources class is a DRYer approach that I prefer - it helps with
things like static typing and code completion, and possible smaller
swf size, but maybe I'm missing another way to do it.





  

Reply via email to