views:

53

answers:

1

Hi all, I'm trying to build/implement a Flash video player to play videos. I have looked at Flex and built a basic application with just a VideoElement. It gets compiled to 41k without statically linking the libs and 300k with linking the libs. I generated the report but am still not sure why I would need all those components just to build a VideoPlayer.

On the other hand, I have had a look at some implementations in ActionScript and it's compiled to 10K. Why is the file size so different in Flex than in pure ActionScript when they both compile down to swfs? Perhaps I'm confused by what Flex is so an explanation would help too. Thanks!

+4  A: 

Flex is essentially a library of classes built on top of plain ActionScript (the mxml files even get generated into ActionScript classes at compile time), so in a nutshell the overhead you are seeing is due to dependencies within the Flex framework. Many people will try to create such things as video players in pure ActionScript to avoid these dependencies and keep the file size down.

Wade Mueller
Thanks for the explanation! So there is no way to really get the Flex application down to the size of plain ActionScript without RSLs? It seems a little silly that the compiler does not know what the program doesn't need.
tteh
@tteh as Wade said it is dependencies within the Flex framework. While you might not explicitly use them, Class A might have a reference to Class B which has references to C and D and each of those have even more references so the compiler can not just omit them as they are required =) Code bloat is a drawback of using frameworks unfortunately.
Allan