PDA

View Full Version : [AS3] small file size


mainegate
08-08-2008, 05:01 PM
Is there a way to create a uiLoader in actionscript so you don't have to put it in your library? It sounds weird but if I take the component and add it to the stage it increases my size of my swf by 12k ...to me is a lot. is there a way to reduce that number...without it is 4k. I want to load some pictures dynamically but I want to keep swf size to bare minimum.

pj-co
08-08-2008, 06:01 PM
have a look at flash.display.Loader

mainegate
08-08-2008, 06:24 PM
I did but when I try to import the uiloader it doesn't work.

pj-co
08-08-2008, 06:32 PM
What I mean is, dont use the component at all -- script the loading. Perhaps someone will post some code as to loading bitmaps but I wanted to just point you in the right direction as the learning process can be more fun and rewarding that way ;)

pj-co
08-08-2008, 06:34 PM
have a look here to:

http://actionscript.org/forums/showpost.php3?p=670780&postcount=13

loading bitmaps is a lot like loading swfs

mainegate
08-08-2008, 07:07 PM
pj-co ...wow that is great...I was trying that before but without the urlloader...thank you very much. Is the process similar for doing it for textboxes or textarea's or other components?

pj-co
08-08-2008, 07:12 PM
pj-co ...wow that is great...I was trying that before but without the urlloader...thank you very much. Is the process similar for doing it for textboxes or textarea's or other components?

Sort of yes. components are nothing more than pre-packaged graphics and actionscript to perform common tasks (like a scrollable text area). They are all written and made in flash so that anything a component can do, ActionScript can also do.

Often with components though the suffer from "feature creep bloat." Basically sometimes they are designed to handle so many different situations and have so many features, they are often more robust than you would need. Hence a simple scripted solution, can often (though not always) be smaller, simpler and faster.