Avg. Rating 3.5

Problem

There are different ways of using embed flash symbols. What’s the best way?

Solution

This entry is not bringing you any new knowledge, but is meant to ask you to give some thoughts about the design and the way you will create it, without forgetting your application performance and scalability.

Detailed explanation

These different ways of declaring and using it, are not meant to be confusing to the developer or designer, they give you instead freedom to your code, to adapt it to your application needs. As you develop/design your application you will come to these questions: Is this symbol being used dynamically? Will this symbol being shown constantly in my component? Etc. These and some other questions will identify the best way of using your embed symbols. If you want to use a Flash symbol in your FLEX application, for example as a background image for a panel, you must 1st embed the symbol in your application, in order to call it in your component. To embed a Flash Symbol you must declare it like:

Embed(source="/nelson/examples/assets/ExampleFlash.swf#Logo");

Embed(source="/nelson/examples/assets/ExampleFlash.swf", symbol="Logo");

To use the declared Flash Symbol for example, as a background image of a Panel, you have different ways of doing it: declare it inline:
<mx:Panel... backgroundImage="@Embed(source='/nelson/examples/assets/ExampleFlash.swf', symbol='Logo')"/>
embed it using AS3 and then use the created class in the MXML tag:

////Icons de Status

[Bindable]

[Embed(source="/nelson/examples/assets/ExampleFlash.swf", symbol="Logo")]

private var getLogo:Class;

... <mx:Panel... backgroundImage="{getLogo}"/>

embed it and assign it to the object style in AS3:
myPanel.setStyle("backgroundImage", getLogo);
use CSS:

///* CSS file */

.myImageCSS{

backgroundImage: Embed(source="/nelson/examples/assets/ExampleFlash.swf#Logo");

}

I hope this will help you to get a view of the different ways of using it. There is no "best way" it all depends on your application needs.
Report abuse

Related recipes