Design Patterns in ActionScript–Abstract Factory

favorites-128x128 Do you still remember the factory method pattern we talked about last time? If you’re already forgot it. May be you can take a look at the following intent, which was defined by the GOF book.

Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.

— By THE GOF BOOK

How to Create a Grid with 1 Pixel Border in Flex

Zebra-256x256 I created a Grid to layout my component. I set the borderthickness to 1 pixel in order to get a 1-pixel-border Grid. However, the border looks more thick than my expectation. The borders are 2 pixel wide except the borders around the Grid.

Design Patterns in ActionScript–Factory Method

Misc-Holiday In our last topic, we talk about the strategy pattern. And it helps us to encapsulate the change of algorithm. Today, we go on talking about the birds. We will consider how to generate the birds, eh, I mean the classes.

Now, we have the classes of eagle and penguin. We can use them anywhere we want. Further more, we can write down the following code to decide which class should be initialized.

An Example Shown block scoping Is Not Supported in ActionScript

To the developer who has long time experience of Java, the first time to use ActionScript maybe will consider how simple the ActionScript is. And someone maybe can’t help to do comparison. The following article is discussed the block scoping is not supported in ActionScript by simple code. If you have interesting please read it.

Design Patterns in ActionScript-Strategy

Adivination-128x128 Today, we’re going to talk about the design patterns in ActionScript. You may be familiar with those patterns if you’re familiar with OO(object oriented). But I won’t suppose you have much knowledge about it, all you need to know is just some basic OO principles, such as encapsulation, inheritance and polymorphism.

as3corelib Tutorial:How to Use JSON Class in Flex

Tooth-Toy-256x256 This class provides encoding and decoding of the JSON format. This demo shows how to encode an object to a JSON-formate string and how to decode a JSON-formate string to an object. It’s really simple with this class provided by as3corelib library.

Using ICODecoder Class to Read ICO file and Display it as Bitmap in ActionScript

applications If you are an experienced Java development, you might know the ICODecoder class ( package com.sun.jimi.core.decoder.ico ). Using this class, We can read ICO file in Java. But how can we do the same in actionScript? The following ICODecoder Class is capable of reading the ICO format in actionscript. Usage is very simple:

Using BMPDecoder class to Load an External BMP File(RLE Compression Support)

k-paint The flash.display.Bitmap class represents display objects that represent bitmap images. These can be images that you load with the flash.display.Loader class, or they can be images that you create with the Bitmap() constructor. Similar to Bitmap class, BMP files decoder class BMPDecoder read bmp file and display (written by munegon), RLE compression be supported. The usage is very simple: