| By Jesse Randall Warden | Article Rating: |
|
| February 8, 2007 11:00 AM EST | Reads: |
31,206 |
Worse, states have the nice feature of removing children from the DisplayList that aren't being drawn in the current state. My guess is, Flash Player uses this as an opportunity to run Garbage Collection on the not-being-drawn-assets. Remember, the unofficial ways the Flash Player 8 garbage collector works is a) every 60 seconds and/or b) when RAM usages increase by 20% or more. In the case of 60 PNGs , each utilizing a meg of RAM (compressed!), that's a ton of memory usage. Naturally, as soon as that animation is removed from the DisplayList, it's a prime candidate for collection. Meaning, the PNGs are no longer in RAM. When the animation is played again, it's slow because the frames have to be loaded into memory yet again. That's my theory too.
For the preload, my fix was pretty simple. You basically make a frame called "asset preload", and throw everything that animation needs on that frame. You can even put it at the front of the animation, in a graphic, alpha'd to 0. This forces Flash Player to throw all the assets in RAM. Since Flash Player is generally good at not running Garbage Collection while animations are going, you can usually be sure your animation will then run well. It did in my tests, anyway. This does not work if your computer itself is running low on RAM. For example, I ran a bunch of these examples at once, and my computers GC + Flash's I guess were running at the same time, because it would freeze during the animations.
I'm not sure what to do - in Flash, this was easy: you just made a MovieClip's visible property false. It's still there, just not being shown, but as soon as you make visible true, it draws immediately. It is being drawn, though, and taking up system resources. The DisplayList does the same thing with remove child. You can actually have an animation playing, but not in the DisplayList , taking up resources. It's better than visible = false, that's for sure. Either way, my guess is, visible = false is a better safeguard against Garbage Collection unloading your preloaded animation from memory vs. removing it from the DisplayList altogether. This is easy in Flash, hard in Flex if you are using states.
Sound compression is frustrating too. In Flash, there is a multitude of ways to compress it with more codecs. In Flex, it's a little harder. If you are sharing a lot of assets, you may run across the same sound sounding different because Flex compressed it differently. Really annoying. Or, you forgot to re-comment-in your code that you commented out to compile an ebmedded SoundAsset in Flash... thus you never compiled your sound into the SWF. How's your brain's cookie trail?
Resource usage is the biggest kicker. Eclipse 3.1 on my PC came, get this, standard with a max of 40 megs in the Eclipse ini. That's right, 40 megs! Ah, to be a full-time Java developer, and need only that much. When dealing with multimedia content, we Flashdevs need all the RAM we can get, and then some. Especially since Flex Builder can actually render some of those SWFs in real-time in Design View. It actually got so bad at one point, I couldn't even compile: Java 1.5 would collapse on my Windows XP page file faster than Mike Foley, the guy who lives in a trailer down by the river, does on your coffee table. I closed every program to no avail. For the record, I didn't have this problem on my Intel MacBook using the standalone install of Flex Builder. In fact, I gave up looking for the Eclipse.ini on the Flex Builder install (non-plugin) because the performance was acceptable.
That's the worst of the minefield.
The rest really have to do with the new ways Mouse, Keyboard, and focus events mesh with the updated and now built-in EventDispatcher. It's also key to make sure you know exactly how things are working in ActionScript 3. For example, when listening for MouseEvent.CLICK events from your Flash created button, you'll get two. This is normal. By default, it sends one, as does your UIComponent. Since MouseEvent click events bubble, they'll get to whoever's listening. You should intercept it in your UIComponent wrapper, call stopPropagation on the event, create a new event, and dispatch something more meaningful.
Application Example
Flash Design in Flex Application Proof of Concept: www.jessewarden.com/flex/flash_flex/source/
Code Walkthrough
Here is a video tutorial walking
through the code. In it, you'll see animations created in Flash and
then used in Flex in a variety of ways. I've also implemented
someCairngorm 2 action with real dynamic data to showcase this isn't
just a proof of concept with no substance.
Code Walkthrough Video Tutorial: www.jessewarden.com/flex/flash_flex/captivate/
Source Code
Please note: I cannot give you access
to FLAs and fonts because I legally don't own the design. The video
tutorial should show you enough about how they are made. The actual
code that made them I did include, as well as theSWFs. Therefore, you
CAN compile this in Flex using the provided SWFs.
If you want the design, you can purchase it at Templatemonster.com, direct link to the design here: www.templatemonster.com/flash-templates/5393.html.
Source Code to Flash Design in Flex App Example - View Source:
www.jessewarden.com/flex/flash_flex/source/srcview/ |
ZIP: www.jessewarden.com/flex/flash_flex/source/srcview/JXLDownloadsv3.zip.
Published February 8, 2007 Reads 31,206
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Jesse Randall Warden
Jesse R. Warden, a member of the Editorial Board of Web Developer's & Designer's Journal, is a Flex, Flash and Flash Lite consultant for Universal Mind. A professional multimedia developer, he maintains a Website at jessewarden.com where he writes about technical topics that relate to Flash and Flex.
![]() |
Peter Beckwith 03/15/07 12:02:08 PM EDT | |||
< in compiling when out code specific sound that comment to have you preloading, without via control can so your tag Embed the use if So, example. for mx.core.BitmapAsset and mx.core.SoundAsset not does currently alpha 9 Flash Flex. assets embed are interop with encounter you?ll problems only classes 3 ActionScript same share You future. solution viable a is thus coming? ?is since fourth about said be much there said, That flow. work production of part major software want don?t typically yet, released isn?t 9) (Flash Blaze Fourth,> ??????????????????????????? want to explain why it reads like a korean spam e-mail? |
||||
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe Unveils LiveCycle Enterprise Suite 2 for Deployment in the Cloud
- Adobe Flex Developer Earns $100K in New York City
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Ph.D. in Twitter Anyone?
- Eolas Sues the Internet
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Betas Target RIAs and Cloud Computing
- Special Report on the Emerging Cloud Computing Trend
- Adobe Cans Another 9% of its Workforce
- My Thoughts on Ulitzer
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Ulitzer Live! New Media Conference & Expo
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Executives Feature on Cloud Computing Expo Power Panel
- Software Flexibility in the Cloud - Part 4 of 5
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Is Microsoft as Free as Open Source?
- Adobe Reader Sued
- Adobe Unveils LiveCycle Enterprise Suite 2 for Deployment in the Cloud
- Where Are RIA Technologies Headed in 2008?
- Cover Story: How to Increase the Frame Rates of Your Flash Movies
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Your First Adobe Flex Application with a ColdFusion Backend
- Adobe Flex 2: Advanced DataGrid
- i-Technology Blog: Death-Knell For "Rich Media? Hardly!
- Adobe/Macromedia - Microsoft, Look Out!
- How To Create a Photo Slide Show ...
- Adobe Flex Interface Customization - Themes, Styles, Skins
- Personal Branding Checklist
- Has the Technology Bounceback Begun?
- "Real-World Flex" by Adobe's Christophe Coenraets




































