Monday, October 31, 2005

Another flash 8 feature: scale9Grid

By now, this feature is probably already well covered by many sites on the net. But here's a short demo:
1. create a rounded corner rect with radius of 16
2. create a mc out of it and name it "d" (my favourite variable name, test string, etc etc)
3. type the following code:

import flash.geom.Rectangle;
d.scale9Grid = new Rectangle(16, 16, d._width - 32, d._height - 32);
d._width = 900;d._height = 50;

That's it.. what's different from the rest of the other demo is, there is very little you need to know to set one up 'cause the 3rd and 4th param are assumed to be the height and width of the rect.

Pretty cool eh..

Thursday, October 20, 2005

FLVPlayer and Cuepoints

Yet another one of my flash project. This time involving sync'ing flv and frames. Since the flv will be loaded from CDROM, there might be a delay between loading time and actually playing time. Also user could pause, so we need to use cuepoints to sync.

The following generic code does what i want:

my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";
// add 2nd AS cue point using time and name parameters
my_FLVPlybk.addASCuePoint(1, "elapsed_time2");
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void { trace("here");}
my_FLVPlybk.addEventListener("cuePoint", listenerObject);

Funny thing is you HAVE to define contentPath BEFORE the cuepoints ....

Sux..