Archive for the ‘Actionscript’ Category
Creating a Flex-free MXML app with Razor
As it turns out, it was fairly simple to add support to the base Razor component classes to enable them for use inside mxml. You can use the razor.controls.Application class as the base tag for your mxml, change the default namespace, and instantiate any of the razor components with regular mxml tags.
The resulting swf is [...]
Razor components now on github, new license.
Its been a long time since the last update, but I recently uploaded the latest version of the Razor component framework to github, ditched the old wiki and set up a new home page.
You can find more information, download the source and see a demo application here.
I recently changed the license from GPL (which was [...]
AS3: Removing duplicates from an array
Just for shiggles (yes, I said it.), removing duplicate items from an array in one line of ActionScript 3:
var arr:Array = ["a","b","b","c","b","d","c"];
var z:Array = arr.filter(function (a:*,b:int,c:Array):Boolean { return ((z ? z : z = new Array()).indexOf(a) >= 0 ? false : (z.push(a) >= 0)); }, this);
trace(z);
Messing around with papervision again
Nothing too spectacular, but I threw together a new pointless animation for my front page.
See it here.
One day I will have enough varied content to warrant a menu or something.
Here is the source, for learning purposes. It won't compile without a couple of files, but you can get the idea
AS3 Dynamic Speech Bubble Snippet
The static method drawSpeechBubble in the file below uses the drawing API to draw a rounded rectangle based speech bubble with a dynamic point. The side the point is on moves depending on the relative position to the bubble. It looks best if you set the point to be fairly close to the actual rectangle.
Usage:
AS:
SpeechBubble.drawSpeechBubble(target:Sprite, [...]
Converting html entities in AS3
I'm posting this here mainly because I always have to look it up. But maybe this post will help someone down the road.
Converting a string with html entities (such as &) to their respective symbols:
AS:
public function htmlUnescape(str:String):String
{
return new XMLDocument(str).firstChild.nodeValue;
}
Converting a string so that it has html entities:
AS:
public function htmlEscape(str:String):String
{
return XML( new [...]
FP9 component pseudo-comparison
I thought I'd compile a little comparison of my Razor components (80% done!) vs the flex framework and the Flash CS3 components. I included just the components shown, but this is slightly unfair to Flex since it includes way more features in the framework that aren't actually used here. Flash player 9 required for all [...]
Slow progress
Last night I put some finishing touches to the Color Swatch/Color picker components for the Razor Component Set. It is mostly a rewrite of the old AS1 colour picker I made a few years ago. You can see the results below!
On another note, I've decided that the whole component set (AS 2 and 3 versions) [...]
Flash and Papervision3D abuse
I have these incredible tools at my disposal, and I produce this...
FlashDevelop 3 alpha
I've been waiting for this one for a while: FlashDevelop 3.0.0 alpha was just released on the FlashDevelop forums.
http://www.flashdevelop.org/community/viewtopic.php?t=1436
