Adobe
Products
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
Student and Teacher Editions
More products
Solutions
Digital marketing
Digital media
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Buy
Home use for personal and home office
Education for students, educators, and staff
Business for small and medium businesses
Licensing programs for businesses, schools, and government
Special offers
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
My products and services
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out My orders My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / Flex Developer Center /

Flex 3 Cookbook excerpts: Images, bitmaps, videos, sounds; unit testing with FlexUnit; compiling and debugging

by Joshua Noble

Flex 3 Cookbook

Created

10 November 2008

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
debugging Flex FlexUnit unit testing

Requirements

User level

Beginning

The best way to showcase a powerful new technology is to demonstrate its real-world results, and that's exactly what this new Cookbook does with Adobe Flex 3.

Wide ranging and highly practical, Flex 3 Cookbook contains more than 300 proven recipes for developing interactive Rich Internet Applications and Web 2.0 sites. You'll find everything from Flex basics, to solutions for working with visual components and data access, to tips on application development, unit testing, and using Adobe AIR.

You also get ideas from the development community. Through its Flex Cookbook website, Adobe invited Flex developers to post their own solutions for working with this technology, and from hundreds of posts, the authors chose the best and most useful solutions to supplement Flex 3 Cookbook.

Each recipe inside provides a solution to a common problem, explains how and why it works, and offers sample code that you can put to use immediately. Topics include:

  • Containers and dialogues
  • Working with Text
  • Data driven components
  • DataGrid and Advanced DataGrid
  • ItemRenderers and Editors
  • Images, bitmaps, videos, and sounds
  • CSS, styling, and skinning
  • States and effects
  • Working with Collections, arrays, and DataProviders
  • Using DataBinding
  • Validation, formatting, and regular expressions
  • Using Charts and data visualization
  • Services and Data Access
  • Using RSLs and Modules
  • Working with Adobe AIR

Whether you're a committed Flex developer or still evaluating the technology, you'll discover how to get quick results with Flex 3 using the recipes in this Cookbook. It's an ideal way to jumpstart your next web application.

The printed book is available through most major online and retail bookstores worldwide, and can be read online at Safari Books Online. For more information visit the O'Reilly store.

Copyright © 2008, Joshua Noble and Todd Anderson. All rights reserved.

Images, bitmaps, videos, sounds

Images, bitmaps, videos, and sounds is a mouthful and a far wider range of topics than could be adequately covered in a single chapter, so this one concentrates on answering the most common questions. As Flash becomes the primary method of delivering video over the Internet and the use of the Flex Framework in creating photo and MP3 applications increases, understanding how to work with all of these elements becomes more and more important.

The Flash Player offers multiple levels of tools for dealing with images and sound. The first avenue of control contains the Image and VideoDisplay classes, MXML classes that simplify much of dealing with images and video and enable you to quickly integrate these assets into your application. The next step down is the flash.media package, which houses the Video, Sound, SoundTransform, Camera, and Microphone classes; their corollaries, Loader, NetConnection, and NetStream, are in the flash.net package. These classes provide much finer control over the integration of sound, video, and images into an application and require slightly more time to perfect. Finally, you can reach down to the bytes that make up all data in the Flash Player: the BitmapData classes and the ByteArray classes. These enable you not only to manipulate the bitmap data of the images that you load into the Flash Player, but also to create new bitmaps and stream the data out.

Many of the examples in this chapter manipulate images and videos as bitmap data. This is not nearly as difficult as it sounds, because the Flash Player provides numerous convenience methods for working with the BitmapData class, and manipulating the bitmap data directly greatly increases the efficiency of your application. You'll also be working extensively with the NetStream class, for handling video and users' microphones and cameras. NetStream is an effective way of streaming information both to and from server-side applications.

Download the complete chapter

Chapter 8: Images, bitmaps, videos, sounds (PDF, 850K)

Unit testing with FlexUnit

Unit testing is a practice and concept that has been slowly gaining in popularity and acceptance in the Flex community as Flex applications have grown larger and more complex. Unit testing, the process of ensuring that new additions or changes to a project do not introduce bugs or modify expected behavior, enables large teams to work in tandem without introducing bugs and confirm that small individual parts of a program, down to specific methods, all return the expected results. This lets bugs and errors be pinpointed much more quickly, because a properly written unit test will test the behaviour of a single method or a very small piece of functionality.

The core of unit testing is the test case, an evaluation that passes a value into a method of an application and reports the test as passing if the correct value is returned. These can be as simple as checking whether a method returns the correct integer value for an operation or as complex as ensuring that some display logic is appropriately performed or that a service has returned the correct object type. Many test cases taken together are referred to as a test suite, a group of test cases that can test an entire application or a specific aspect of a very large application. The test suite will show all test cases that have passed or failed. As a developer adds new code to the application, new test cases are written to provide coverage for that new code and are added to the test suite, and then the entire test suite is run. This ensures that any added code does not interfere with previously functional code and that the new code integrates as expected with the application.

The FlexUnit Framework allows you to create test cases and asynchronous tests and evaluate test suites in a test harness application that provides a visual display of all the tests in that test suite. The recipes in this chapter, all of which were written and developed by Daniel Rinehart, show how to develop meaningful test cases and integrate them into coherent test suites, as well as how to use more-advanced tools like the Antennae library that assist in automatically generating tests as you develop your applications.

Download the complete chapter

Chapter 20: Unit testing with FlexUnit (PDF, 570K)

Compiling and debugging

Compiling Flex applications is most often done through Flex Builder or through invoking the MXML compiler (mxmlc) on the command line, but there are many other tools that let you compile an application, move files, or invoke applications. Tools such as make, Ant, or Rake, for example, enable you to simplify an entire compilation and deployment routine so that you can invoke it from a single command.

Debugging in Flex is done through the debug version of the Flash Player, which enables you to see the results of trace statements. With Flex Builder 3, you can step through code line by line and inspect the properties of variables. Flex Builder 3 also introduces a new profiling view that lets you examine memory usage and the creation and deletion of objects. Outside of Flex Builder, numerous open source tools expand your options. With Xray and Console.as for Firebug, for example, you can inspect the values of objects, or you can view the output of trace statements with FlashTracer or the Output Panel utility instead of using the Flex Builder IDE. The recipes in this chapter cover debugging with both the tools provided in Flex Builder as well as tracing values and inspecting objects by using Xray and FlashTracer.

Download the complete chapter

Chapter 21: Compiling and debugging (PDF, 1.7MB)

More Like This

  • Debugging Flex 4 applications – Part 2: Breakpoints
  • Debugging Flex 4 applications – Part 3: Variables view, watchpoints, and Run to Line
  • Programming Flex 3 excerpts: Application debugging; embedding Flex applications in a web browser
  • Configuring Flash Builder 4.5 and Eclipse PHP development tools
  • Global exception and error handling in Flex
  • The architecture of Flex and PHP applications
  • Debugging Flex 4 applications – Part 1: Debugging basics
  • Test Driven Development using Flash Builder 4 and FlexUnit
  • New debugging and profiling features in Flash Builder 4

Tutorials & Samples

Tutorials

  • Flex mobile performance checklist
  • Flex and Maven with Flexmojos – Part 3: Journeyman
  • Migrating Flex 3 applications to Flex 4.5 – Part 4

Samples

  • Twitter Trends
  • Flex 4.5 reference applications
  • Mobile Trader Flex app on Android Market

Flex User Forum

More
07/25/2011 Flash Player Debug Issues - Safari 5.1 & Chrome 13
04/22/2012 Loader png - wrong color values in BitmapData
04/22/2012 HTTPService and crossdomain.xml doesn't work as expected
04/23/2012 Memory related crashes in Flex application

Flex Cookbook

More
04/06/2012 How to detect screen resize with a SkinnableComponent
02/29/2012 Embed Stage3D content inside Flex application components
02/15/2012 Custom WorkFlow Component
02/09/2012 Using Camera with a MediaContainer instead of VideoDisplay

Products

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • Mobile Apps
  • Photoshop
  • Touch Apps
  • Student and Teacher Editions

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • For personal and home office
  • For students, educators, and staff
  • For small and medium businesses
  • For businesses, schools, and government
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy Policy and Cookies (Updated)

Ad Choices

Reviewed by TRUSTe: site privacy statement