Flex 5 UIComponent should have Behavior Design Pattern [part 2]

Sat, 01/21/2012 - 05:30
I’ve been asked for an example, so here it is. Read this first, but look to it as an abstraction. package org.apache.flex.five.corebehaviors { import flash.display.DisplayObject; import flash.events.FocusEvent;   import org.apache.flex.five.interfaces.IBehavior; import org.apache.flex.five.interfaces.IUIComponent;   public final class FocusListener implements IBehavior { private var _target : IUIComponent;   public function FocusListener(target : IUIComponent) { _target = target; _target.addEventListener(FocusEvent.FOCUS_IN, focusInHandler); _target.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler); }   protected var _name : String = "org.apache.flex.five.interfaces.FocusListener"; public function get name():String { return _name; }   public function destroy():void { _target.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler); _target.removeEventListener(FocusEvent.FOCUS_OUT, [...]
Categories: Interesting Stuff

Drawing Display Objects into Bitmaps with BitmapData.draw() Method - AS3 How-To

Sun, 01/08/2012 - 22:30
In many circumstances you may want to draw a DisplayObject into a Bitmap. For example, to take an image 'snapshot' of a Sprite. The important BitmapData.draw method became even more important in development for mobile as Bitmaps are easier to process by mobile devices than vector content. We discuss the method with special emphasis on the second, often overlooked, transform matrix parameter. AS3 Flash source files provided.
Categories: Interesting Stuff

BitmapData.draw or cacheAsBitmapMatrix or Vector Content - AIR Mobile Experiments

Tue, 12/20/2011 - 00:48
Suppose you want to zoom and pan a MovieClip with static but otherwise complex vector content. From the point of view of performance - memory and frame rate - is it better to leave it in the vector form, draw a scaled up version into a BitmapData or use cacheAsBitmapMatrix AS3 method available in mobile AIR? We compare these three techniques and provide Flash source files and AS3 code which make it easy to test. Also, we show how to create one-finger panning effect.
Categories: Interesting Stuff

AS3 DisplayObject Auto Sorter

Wed, 11/30/2011 - 03:39
A common issue I have while creating Flash/ActionScript 3 games is needing to depth sort DisplayObjects based on some property of the display object itself (most often, their y coordinate). I do this so often that, a while back, I created a special class that extends Sprite and automatically handles this for you. I thought
Categories: Interesting Stuff

Using Flash to Skin Flex Components

Tue, 10/25/2011 - 21:22
I’ll add more later… busy… package {   import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.BlendMode; import flash.display.DisplayObject; import flash.geom.ColorTransform; import flash.geom.Matrix;   import mx.core.UIComponent;   [DefaultProperty("children")] public class FlashSymbolContainer extends UIComponent {   private var _children:Array; private var childrenDirty:Boolean = false; … Continue reading →
Categories: Interesting Stuff

You are here

Actionscript