Monday, July 24, 2006

Showing list of fonts in a Flash V2 comboBox formatted with the corresponding fonts

I was browsing the actionscript.org forums today and found a query by a user. It read "I have a combobox full of font names. I was thinking that it would be pretty cool to have the actual font format show in the label as well. ...."

I had a lil free time and thought I'd give it a shot.

This is what you need to do:

1. Drag a comboBox component from the components Panel to your FLA's Library.

2. Add the following code:


/* --------------------------- code starts here --------------------------- */
import mx.controls.ComboBox;
var myCB:ComboBox;

function init ()
{
myCB = ComboBox(createClassObject(ComboBox,"myCB", this.getNextHighestDepth()));
myCB.setSize(175,22);
myCB.rowCount = 7;
myCB.dataProvider = TextField.getFontList ();
myCB.open ();
myCB.addEventListener ("change", function ()
{
myCB.textField.setStyle ("fontFamily", myCB.value);
});
myCB.addEventListener ("load", setCBListFonts);
myCB.addEventListener ("scroll", setCBListFonts);
}
function setCBListFonts ()
{
for (var i in myCB.dropdown.listContent)
{
var _tf:TextFormat = myCB.dropdown.listContent[i].cell.getTextFormat ();
_tf.font = myCB.dropdown.listContent[i].cell.text;
myCB.dropdown.listContent[i].cell.setTextFormat (_tf);
}
}

init();
/* --------------------------- code ends here --------------------------- */


3. Test Movie, and you should be done!

This is how the final SWF looks: (If SWF doesnt show up below,check it out here
)



Tuesday, July 18, 2006

[OT] : blogspot.com, typepad.com, geocities.com banned in India!

I had been wondering why a few of my favourite blogs were not accessible today morning. And only by evening(when a friend of mine told over chat) did I know that my blog was blocked too! I figured out the govt of India had asked the ISPs to block a few blogs because they were supposed to have 'objectionable content'. Wonder if they mistook me when I said i'm a flasher ;o)

On a serious note, I'm pretty seriously pissed off!

More info here.

Meanwhile someone let me know about this site:http://www.pkblogs.com And guess what was the first blog I read through this proxy? The one which was supposed to be the reason behind this ban (na, am not gonna provide a link) - and I never even knew about this blog before! Guess the Govt of India has ended up providing some indirect advertising for those bloggers with 'objectionable content'!

Oops, now will the sue me for saying this? :P

May be I'll cut it short here. Hoping they lift the ban soon! - Or may be its time I booked my own domain name...

Update:07/ 22/ 06 : the ban seems to have been lifted off now!

Monday, July 03, 2006

18 Errors - No comments found

I was browsing through the AS3LR on LiveDocs today and at some point in time stopped at this (http://livedocs.macromedia.com/specs/actionscript/3/as3_specification195.html) page. Returning back to the FF window after a while freaked me out for a second.

LoL