Archive for November, 2006

scale9Grid workaround for nested movieclip

November 30, 2006

using setInterval:
http://www.devpro.it/code/122.html

possible solutions using bitmapData class:
http://luar.com.hk/blog/?p=594

Final solutions/Flex 2 (presumably bitmapData solution):
http://www.adobe.com/devnet/flex/quickstart/embedding_assets/#EmbeddingImagesScale9
http://chattyfig.figleaf.com/pipermail/flashcoders/2006-July/169871.html

time tested old goodies:
v2 UI component style  MC subclasses. The trick is to use boundingBox_mc to keep track of the desired dimension either set at runtime or compile time (Flash IDE) at the first frame it get instantiated, and then dynamically load(createChild()) and layout()/draw() all the other visual assets based on the preset layout algorithum accordingly. So it might take some energy just to get the layout right, considering the features such as alignment of a textfield to the bottom-right corner of the component. Using this approach, the MC that needs anti-distortion can be composed of 9-slice mcs, or maybe several slices bitmapData manipulated mcs.
This is the most time consuming while most generic solution. It’s worthwhile for building a site that implement this framework.

Don’t define onRollOver etc. in MovieClip suclasses

November 29, 2006

… unless absolutely necessary. Since MC is dynamic, onRollOver, etc. can always be attached at runtime. There is no need to define abstract type of onRollOver whose sole purpose is just to provide an interface for its subclasses to implement. Since once the methods is defined, even without implement, like this:

private function onRollOver(Void):Void{
//to be implemented in subclasses
}

the class and its subclass instances will automatically become “buttons”. This means if the instances are attached on the stage where they are stacked over other MCs, it will create problems such as flicking when user mouses over the overlapped area.

AS inheritance constructor 101

November 29, 2006

Subclass constructors need arguments

When extending a class whose constuctor got arguments other than “Void”, you need to explicitly call super(args) in its constructor in order to receive all the arguments from the subclasses instantiation.

E.g.,

function ThumbnailAni(url:String, x:Number, y:Number, maskID:String, maskFrmID:String, initAt:MovieClip)
{
super(url, x, y, maskID, maskFrmID, initAt);
}

Subclasses of Movieclips or UIComponents that got metadata from intialized objects don’t need to do this since Inspectable variables will be passed by init obj when attachMovie() is called.

setMask() 101

November 29, 2006

1. setMask() will not affect the display of device fonts. They will be drawn regardless;

2. setMask() takes priority to timeline mask layers;

3. Movieclip nested inside a container mc can mask the container mc (which “includes” itself) by calling setMask() !

skin FLVPlayBack component (flash 8) quick start

November 25, 2006

here and here