OK :)
Embed assets like this:

package com.foo.bar {

[Embed('../assets/symbols.swf', symbol='hearts')]
public class FooBar extends Sprite {

public function FooBar() { super(); }

}
}

Then in your MXML:

<mx:Button label="1" icon="{com.foo.bar.FooBar}" />

This approach is better because it doesn't create dummy variables. You don't
use mx.core.SpriteAsset (which is a redundancy introduced "by design" in the
framework). You can add more functionality to the embedded asset, if needed.
Besides, it's easier to debug (you can, for example put trace() in
constructor and see how many times this or another asset is used). Sometimes
it is a requirement to document assets too, but if you cannot name them as
you want - which is the case with embedding on variables, then this is the
way to go.

Best.

Oleg

Reply via email to