Author Archives: Jason Bejot

Generate a Random Number within a Range

This is a really basic need and I find myself using it in about 90% of the flash/flex stuff I build. Generating a random number within a range is ridiculously easy and can be implemented as a one line static function: public static function randomRange(low:Number, high:Number):int { return Math.floor(Math.random() * (high – low)) + low; [...]

Posted in Actionscript | Tagged , , | 9 Comments

Embedding Fonts in Flex

If you’re like me and most of your Flex projects are ActionScript projects, then you might have noticed that your SWF’s get really bloated when you embed fonts. Where is all this extra stuff coming from? Well, one big thing is that when you embed fonts in an ActionScript Project (i.e. via the Embed metadata [...]

Posted in Actionscript, Flex | Tagged , , | 9 Comments

Superscript and Subscript in Actionscript

Unfortunately, superscripting and subscripting text in actionscript is not an included feature of TextFields. So, I’ve built a utility class to handle all your superscripting and subscripting needs. I’m just going to give a general overview here but provide the source code for download so you can just plug it in to whatever you’re working [...]

Posted in Actionscript | Tagged , , , , , | 14 Comments