Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


From Design to Reality
Taking a designed interface and making it work in Flash using application states

This article will cover techniques in dealing with application state and complex animations. Additionally, I've included a few quick primers on how to implement some of the designs a Flash developer can be expected to put into Flash as well as a sample application file. This article will cover techniques in dealing with application state and complex animations. Additionally, I've included a few quick primers on how to implement some of the designs a Flash developer can be expected to put into Flash as well as a sample application file.

There are many articles dealing with application state, from Visual Basic to PHP. My goal is not to rehash those topics, but to show you some tips and tricks I've learned in merging state and animation in Flash, since one of the main features that draws people to utilizing the Flash Player in a browser is its ability to keep application state.

The term "application state" is very broad, especially when applied to Flash development. Through the use of a timeline, you can lay out your application's states. A programmatic example is keeping the user's name in a variable that doesn't go away when the user navigates from page to page, as would happen on a Web page since the Internet is stateless. A less attractive example is playing "variable toss," where the variable is thrown on the end of the URL variable, with developers praying they never break the chain... or making the assumption that cookies are working on the end user's machine and attempting to use session variables, which is typically done in a PHP or ASP/.NET environment.

This article addresses the ability for components to have state utilizing complex animations. The challenge is changing state and having the interface follow suit, as well as transitioning between states. Because Flash allows timelines within timelines, you can easily build complex animations and nest them in your application state timeline without affecting it adversely in timing. More simply, a designer gives you a complex animation that you're supposed to make use of in your application and/or one of your components. I'll first cover ways you can go about implementing the design, and describe the pros and cons of each technique. Next, I'll describe methodologies in constructing your application as a whole. Finally, I'll describe the code used to keep track of state and manipulate the animations within your component.

If you're already familiar with implementing designs in Flash, and you have your own Flash application construction methodology, then you can skip to Part 3. A discussion on what can be done in the management and meetings up front to get to this phase can be seen at my Web site (www.jessewarden.com/archives/000309.html).

What's the best way to take a designer's comp, a compositor's video, an audiophile's mix, or an illustrator's layout and merge it with your code?

Image Editing Quick Primer
First, it helps to know your options. In Flash 5 and up, you can import PNGs, a bitmap format that is lossless (no quality loss in saving to this format) and supports up to 32 bit (8 bit alpha channel). A Photoshop comp can be exported straight from Photoshop to PNG, or, if the effect layers are flattened, brought into Fireworks and converted there. For complex- shaped interfaces and interface elements, this is the most common way to implement them inside Flash so you don't get the white or black background filling in the gaps. Since bitmaps are drawn to the screen in squares, designers use an alpha channel (unknowingly) to mask certain areas. Wherever possible, use a JPEG compressed outside of Flash. Square bitmaps are faster to render than their irregular-shaped bitmap counterparts (they don't negatively affect animation speed as compared to irregular bitmaps). Additionally, depending on the depth of your target monitor, sometimes the bitmap alpha channels show up. Yes, an invisible part of the image can be seen, I know. On 24 bit/16 bit monitors, this can sometimes happen with PNGs. The way to fix it is to put the PNG into a graphic and use the graphic instead of the PNG. Then, duplicate the image on a new layer and guide one of the layers (so you have a copy after you modify the copy; you never know when you'll need to go back to the original, and guided assets do not affect the final SWF file size [exclusion of sounds]). Select the image that is not on the guided layer, and then choose Modify –> Break Apart. Then select the Lasso tool. You'll notice three new tools on the bottom of the tool palette. Choose the Magic Wand Properties, change Threshold to 0, Smoothing to Pixels. This will usually ensure that you'll be able to select all of the alpha channel. Select the invisible alpha channel areas and delete them. Now you don't have to worry about the bitmap falling apart because it's contained in the graphic, and you can animate the graphic. However, the alpha is gone, but you still have your irregular shape intact. The one gotcha is this "autosmoothes" your image. This option (Flash's custom smoothing of images) can usually be turned off by right-clicking the asset in the Flash Library, selecting properties, and unchecking the checkbox. Now you're stuck with it.

Quick Video Primer
You can import the video directly into Flash MX and Flash MX 2004 and Pro. However, it is highly recommended that you do two things to ensure that your video will look professional:

  • Obtain an uncompressed version of your video. If you compress video twice, it'll look worse and a lot of times come out bigger in file size than it was. "Garbage in, garbage out."
  • Purchase Sorenson Squeeze. This product is the professional way to compress your Flash video; you get good control and good results, better than you can get with Flash alone. Then you can import the FLV, or make a video object in Flash and import the FLV into it by right-clicking on it in the Library and then selecting the import button.

Quick Audio Primer
As with images, it's best if you compress your audio outside of Flash. However, this really is best only if done with MP3 compression. For shorter sounds, it's okay to use Flash. Flash has ADPCM for short sounds, its own Speech codec for voice-overs (MX+), and MP3 internally, or you can import your own MP3, which won't be recompressed, or just use it RAW. Believe it or not, you're better off mixing down a bunch of sounds rather than compressing each one individually. Sometimes you can gain very slight compression increases if you separate the sounds out, as some sounds compress better than others, but the loss in processing power from uncompressing and playing all of those sounds together, as well as using most if not all of the eight sound channels Flash provides, is not worth the marginal file size savings, not to mention a bigger timeline.

About 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.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

A really informative article. I learned a lot about Flash concepts and development.
Regards
Jens


Your Feedback
Jens Hauser wrote: A really informative article. I learned a lot about Flash concepts and development. Regards Jens
Enterprise Open Source Magazine Latest Stories . . .
Apache Deltacloud, the Red Hat-contributed ReSTful API that abstracts differences between clouds so services on any cloud can be managed – provided of course there’s a driver – has graduated from the Apache Foundation’s incubator and is now a full-fledged Top-Level Project (TLP). The...
With Cloud Expo 2012 New York (10th Cloud Expo) just four months away, what better time to start introducing you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference... We have technical and st...
AMD said late Tuesday that its chief sales officer Emilio Ghilardi had left the company and that CEO and president Rory Read is going to do his job while a replacement is sought. AMD didn’t say why Ghilardi left but it’s assumed Read wants his own people. Read is relatively new to th...
During the lifespan of M3 (Monitis Monitor Manager) there has always been something lacking – timers. M3 execution procedure was outlined in this previous article. The execution mentioned in the latter was a one-time-execution, whereas server monitoring requires periodic invocati...
Red Hat is putting its bought-in Gluster scale-out NAS storage technology, acquired in October, on the Amazon cloud. It’s styled Red Hat Virtual Storage Appliance for Amazon Web Services and other clouds are supposed to follow in short order.
A new episode of the screencast series is now available at the OpenNebula YouTube Channel. This screencast demonstrates the new easily-customizable self-service portal for cloud consumers. Its aim is to offer a simplified access to shared infrastructure for non-IT end users. The scree...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE