« How Not to Code Flex Applications (RIA Unleashed: Boston 2009) | Main | Social Applications with Adobe Flash Collaboration Services (RIA Unleashed: Boston 2009) »

Custom Components in Flex 3 and 4 (RIA Unleashed: Boston 2009)

Jesse Warden

Custom components are important
* Flex based application instead of just Flash
* Designers don't know flex
* Memory constrained
* Isolated and encapsulated for code reuse and testing

Types of components
* Visual
* Non-visual (data/service manipulations)
* Either Facades or Proxies

Base class versus component
* Shape (best for drawing), Bitmap (rastering), Sprite (Flex), MovieClip (Sprite with Animation)
* De-coupling through composition

Component Libraries (Take care of low level Flash player stuff for you, when to draw, event handling, etc.)
* Flash CS3 (Build quickly, small file size)
* Minimal (Keith Paters, up and running quickly, RAD)
* Flex (Enterprise quality stuff)

Custom Components
* UIComponent
* Model, View, and Controller
* Invalidation
* Embedded Content
* Styles

Place custom components in a library project so that you can see them in design view.

For complex processing use green threads.

Testing
* fluint
* FlexUnit4
* visual test harnesses (Application that just shows the component you care about)

Monkey Patching
* When the framework doesn't do what you need (like making a private variable public)
* Makes it hard to follow Flex SDK updates (copy and edit the file along with version file)

Conclusions
* Components are building blocks of Flex apps
* Extend UIComponent
* static children in createChildren()
* draw stuff in updateDisplayList()
* data setter sets internal value, and flags to redraw and call invalidate methods

Tags: flex riaunleashedboston2009