2 posts tagged “flex2”
Don't get me wrong, I'm really liking Flex2. I enjoy coding in Flex Builder 2 (i.e. Eclipse) flipping back and forth from and to CF/PHP/Javascript/Flex2/Java/SVN perspectives, getting MXML wire frames from designers working in Fireworks CS3, using ASDoc, FlexUnit, FABridge, FlexModule, FlexAnt, extending Flex2 components (logically by extending classes and design wise by using CSS) and creating frameworks (I have one called Flapjax that I'm working on. I really like Cairngorm but for the most part, it is a bit much . . . more on that later). However, Flex2 components are HUGE and sometimes clunky. The biggest offender for me is the videoDisplay component. Just dragging the component in design view and compiling to a swf is 144KB. Compare that with the Flash CS3 FLVPlayback component that is 52KB when compiled. I quickly went through the component list for both Flex2 and CS3 and on average the Flex2 components are about 3 times as big and the CS3 components. The list component is 192KB in Flex2 and only 32KB in CS3. 6x seems a bit silly, right?! And why is an empty Flex2 application 124KB?
I was really hoping to move away from the Flash IDE completely since there isn't a robust command line compiler for FLAs which makes unit testing and automatic builds more tedious and no FLAModule for Apache/IIS (hmmm . . . maybe a new project for OSFlash?). FL CS3 on my MBP though feels so much better though. It looks like I can't completely jump ship to Flex Builder. Components, Papervision3D, and the integration with Photoshop are sucking me back in.
FLA(sh) + LocalConnection + AMFPHP + Javascript + Actionscript + MXML
Since the introduction of the FABridge from Adobe, I've been creating javascript APIs as a shortcut to xmlhttprequest interactions. Since we are putting Flash on the page to display video anyway, there is not much more overhead in creating an ajax replacement. When including the as3corelib for JSON serializations (plus you get MD5 hashing, advanced string and date parsing, png/jpg encoder and more), it adds an extra 53KB.
Using AMFPHP, javascript uses the FABridge as a pass-through to call server side PHP functions. With as3corelib, objects and arrays can be transformed into JSON. The main advantage of JSON besides the obvious advantage of eval() is alleviating cross domain issues that can tangle Flash. Also, the CS3 components are much "lighter" than the Flex2 components (more on that later). Multiple swfs on a page or a shell SWF that loads in other SWFs works due to the use of the LocalConnection class. I've "borrowed" from Java frameworks and Cairngorm by implementing a quasi front controller (Cairngorm seems a bit "heavy" because what I envision is something a bit more RAD like Rails). I'm cleaning up the code and wrestling with rounding out the rest of the framework. Check back, more to come . . .