PDA

View Full Version : 1 big swf vs. multi small swfs


juworld
09-26-2006, 12:20 AM
I am new to flex2 and I have been playing around using the project mxml and load other mxml (such as panels). Then I realized that when I compile my project, it only generates 1 swf.

Well, I am currently doing a transition from flash 8 to flex. in flash8, I have one "wrapper" swf that loads in different "module" swfs. This reduces my file size dramatically and I do not have to preload all the "module" swfs.

I am not sure what is the best way to do this with flexs. Should I create multiple swfs from flex and have the application level mxml load in different swf at different times? or should I just use one big swf?

Or am I not getting this and there is a much better way to go about this.

Thanks in advance,

Justin

flexy
09-26-2006, 08:54 AM
Development methods are different in Flex to Flash 8. Personally, I'd look at the overall effect you're trying to achieve, and see if there are workarounds in Flex that might not be easily available to you in Flash. For example: are the separate SWFs you're loading in very different from each other, or is it simply a matter of different content/data? You can handle data in Flex a lot more easily then Flash, and because of this, you might be able to ditch a lot of your UI elements from external SWFs, and rely on reusing the same display elements; just substituting data.

If you do want to load SWF content into a wrapper SWF in Flex, then you would need to create separate MXML applications for each of these SWFs, and export them individually. The downside is the overhead; a Flex SWF has a minimum file size of 115Kb (a Flex movie with nothing in it!).

It'll be interesting to hear what you choose and how you proceed.

Tink
09-26-2006, 12:01 PM
If you do want to load SWF content into a wrapper SWF in Flex, then you would need to create separate MXML applications for each of these SWFs, and export them individually.You could consider this the same as creating multiple FLA's in Flash to create your SWF's.

The reason you might take this approach in Flash is becuase u have large assets in your movies. This could be the case in Flex, but majority of the time won't be as you won't have as many creative elements in your Flex RIA as you would a creative Flash site. If you did have these elements i would probably go down the road of loading them at runtime in Flex as opposed to creating seperate Flex swf's as you will be loading the Flex architecture over and over again (which isn't massive, but best avoided).

rkettrey
03-22-2007, 07:25 PM
We are looking right now at doing the same thing with the modules. We have an old Flash 8 app that works this way (a Main.swf and all of our screens of our intranet app are there are own SWF).

The thing that is irrating me about Flex Builder 2 is that it wants the applications or modules to be at the root of source directory. We want them packages (e.g. src/com/companyname/screen/profile, src/com/companyname/screen/hr, etc). We are going to eventually have a few hundred screens and there is no way I want these all in the same directory.

I am making another post to see if anyone can find a way around this. FlexBuilder seems to allow you through the properties to select any MXML file to be a runnable app that it compiles, but when you select one in a sub directory of source it just silently ignores it.

geoff2010
04-05-2007, 12:58 PM
rkettrey,
You don't need your files at the root. You simply have to define an xmlns in the root tag of the .mxml file. If your structure looks like:

c:\projects\src\
MainFile.mxml

c:\projects\src\com\sitename\
Module1.mxml
Module2.mxml

You would simply put this in the application tag of MainFile.mxml

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:mods="com.sitename.*">

<mods:Module1/>
<mods:Module2/>

</mx:Application>