|
-
Senior Member
Hey Gobbles,
There are several ways to approach this, so I am not sure what best suits your situation.
(This post may get a little lenghty, so I will start with the quick solution.)
First off, if file size is an issue, why are you wanting to put your images in an .swc? If you do this, then you are actually increasing file size because you have some standard code that is part of an swc. I've not personally used the 'external' setting, but if it does what I think it does, then the solution below would give you similar results.
My initial thought is to rethink your solution. If you are just needing images, then I would suggest using the mx:Image tag or SWFLoader class if you want more functionality like tying it to a progress bar. On Image components, you can set the source dynamically at runtime, bind in the xml, etc...
This solution would allow you the most amount of flexibility. You could update the images at a later date, etc...
Generally when you use a swc and a library project, you are planning to share common assets across multiple projects. However, unless you are planning to use RSL's (runtime shared libraries), then the only benefit you will receive is on the development end where you won't have redundant code, but a centralized code repository. However, when you compile in the default 'Merge into code' mode, both projects will have all the code from the library swc compiled into them.
Example: I am currently working on a web site where every page is a unique .aspx page with a .swf embedded and each page is it's own unique project. However, alot of the buttons, panels, and other UI / art elements are common across various pages which are originally created in Flash or photoshop. I use a library project for all these UI elements and misc assets which is about 120K. Because it is an RSL, the browser loads and caches it when the user visits any of the pages of the site. When the user navigates to another page, flashplayer only loads the master .swf and it's specific modules for that page. The common assets from the RSL are pulled from cache and thus saves the user download/wait time.
Unfortunately, there's not alot of information out there on creating your own custom RSLs, but once I am past my deadline and release to beta, I plan to put my findings together as a tutorial that will help explain how to leverage RSLs, dynamically loaded assets, and reduce / streamline loadtimes. There are a bunch poorly documented tools you need to understand like the Digest and Optimizer command line tools, and mastering them to understand how they work takes a little time.
If you still want to go the .swc route, just leave a followup post and when I am in the office tomorrow, I will dig up some example code and post it for you along with the links to the resources that I found on using swc and RSL's.
The Early Bird may get the worm, but the second mouse to the trap gets the cheese...
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|