views:

201

answers:

1

I'm creating a project in flex builder but it's not using the flex framework, it's just pure actionscript.

At the moment I have some bitmap resources embedded for drawing things, but I'd like a little animation and thought I could create swf animations for them in flash and use the [Embed()] thing to embed them in the actionscript project.

This works perfectly well for me, however I'm a little concerned about efficiency and how well this approach will scale when my project gets larger.

Does anyone know if there are any efficiency implications to embedding maybe 20 or 30 swf files, or do they get efficiently integrated into the main swf file? Most of the animations are really simple and I could probably redo them in actionscript if needed but it's a lot easier just to draw them in flash and embed them.

+1  A: 

Hey,

Not too sure exactly what you mean by efficiency, but embedding a large number of files is generally not considered best practice. You generally only want to embed things that need to show up immediately when the application loads, or that are so small it would be overkill to load them via URLLoader and the like.

Say you only view 5 of your animated swfs at startup, and the as the user clicks around and goes to different screens/views, they are revealed the rest. Then you could just load the swfs at runtime via URLLoader or the Flex Module architecture.

The benefit of having your swfs and assets not embeddded in your main swf is that:

  • it dramatically decreases swf size
  • it makes it easier to swap out graphics at runtime (or without needing to compile)

If I were you I would remove as many [Embed] tags as possible, and replace them with either loading via modules or urlloader.

Best, Lance

viatropos