as3, chargedweb, com, package
May 05jloacode
I’ve decided to make a sort of a mini package containing some handy utils (but not only) classes in one place.
Includes such classes like: VectorUtil, ResourceMonitor, MatrixUtil, LoaderUtil, Cache, VimeoPlayer, SkypeStatusIcon etc.
Download the com.chargedweb.* package
UPD1: now with docs
UPD2:
- added AlignUtil class (more info here)
ps: i wish i had some free time to collect all my classes in one huge package
as3, black'n'white, saturation
Mar 18jloacode, misc
Sometimes i need a fast black’n'white saturation method and this one’s the shortest i presume.
I can’t remember whose this method originally was, but it’s nice.
private var rc:Number = 1/3, gc:Number = 1/3, bc:Number = 1/3;
private var sf:ColorMatrixFilter = new ColorMatrixFilter([rc, gc, bc, 0, 0, rc, gc, bc, 0, 0, rc, gc, bc, 0, 0, 0, 0, 0, 1, 0]);
private function blackAndWhite(target:UIComponent, enabled:Boolean):void
{
if(enabled) target.filters = [sf];
else target.filters = [];
}
as3, cursor, CursorManager, flex
Mar 12jloacode

So there i was, trying to build my latest application which involved run-time cursor loading/usage.
I knew that the flex sdk had that static CursorManager class (i.e. mx.core.CursorManager), but as i looked up the manual – there’s no loadIcon() method, only setters that require class references which is sooooo unhandy if u deal with run-time loading assets (like i do).
So, i got myself some coffee, opened the eclipse and after some time spend – eureka!
I came to this slight solution which besides is elementary.
Read more
as3, class, skype, status
Feb 22jloacode

Today i had some free time to make a skype status icon class (don’t know who’d need that).
Anyways, it’s a simple class that connects to the skype service, retrieves the status code for a specified account name and displays the status icon. All parameters customizable. I’ve even created a sample page with a php proxy (see the archive)
Download SkypeStatusIcon sources
as3, flex, icon, load
Feb 20jloacode
The only thing why flex sucks is that components can’t actually load icons (Button class for example) i thought.
Yes, but that was until i found Ben Stucki‘s slight solution to this issue.
He wrote a nice utility class called IconUtility which creates BitmapAssets at run-time. This class is huge.
Sample button icon load up code:
var myBtn:Button = new Button();
myBtn.label = "press me";
myBtn.setStyle("icon", IconUtility.getClass(myBtn, "assets/my_icon.png"));
addChild(myBtn);
IconUtility Component for Dynamic Run-Time Icons
Download: IconUtility Class (302 kb)
as3, sort, sorton, vector
Feb 20jloacode
As you probably know the new fp10 api provides a new Vector class (wonder my didn’t they just make typed Arrays like in C#) that increases performace about x2 times.
But, still among with the performance you could face some difficulties working with Vectors, for example it doesn’t implement a sortOn() method which, i think you’d agree, is very handy.
UPD: lots of people use very strange/complicated methods to sort vectors.
Guys, stop complicating yr life – the task is way much easier.
So, here’s how i do the sortOn() with Vectors:
/**
* Converts vector to an array
* @param v:* vector to be converted
* @return Array converted array
*/
function vectorToArray(v:*):Array
{
var n:int = v.length; var a:Array = new Array();
for(var i:int = 0; i < n; i++) a[i] = v[i];
return a;
}
/**
* Here's a little example on how to sort a Vector using sortOn
*/
var v:Vector.<Object> = new Vector.<Object>();
v.push({id:5, email:"andrew@someweb.com"});
v.push({id:35, email:"david@someweb.com"});
v.push({id:12, email:"jill@someweb.com"});
// now to sort the Vector on the "id" property
var vSorted:Vector.<Object> = Vector.<Object>(vectorToArray(v).sortOn("id", Array.NUMERIC));
// easy and convinient isn't it? ^_^
Hope might be useful.
Cheers
air, air2beta2, airpackager, app, as3, dmg, exe, rpm
Feb 20jloaapp, code

UPD: now works with air 2 runtime
AirPackager is a small app that will help you generate exe/dmg/rpm files out of your air package in other words – it’s just a GUI for the adt.
To install the app you need the AIR2 beta2 runtime AIR2 runtime
Again, works only on windows.
Download AirPackager.exe
air, air2beta2, app, as3, exe, poweroff
Feb 20jloaapp, code

UPD: now works with air 2 runtime
PowerOff is a simple shutdown timer, which i created just to reveal (test) some of the new features of AIR2 beta2 api.
To install the app you need the AIR2 beta2 runtime AIR2 runtime
And, btw, it works only on windows.
Download PowerOff.exe
Download PowerOff source files
as3, javascript, js, metrics, scrollbar, swf, swfsize
Feb 20jloacode

SWFSize is a simple, lightweight library to control the swf’s container metrics & use the browser’s native scrollbars.
Project page http://chargedweb.com/swfsize/.
UPD: version updated to 1.1
UPD: version updated to 1.2
UPD: version updated to 1.3
UPD: version updated to 1.4.0
UPD: version updated to 1.4.1

as3, captcha, class, validator
Feb 20jloacode

Some time ago i was surfing the net and i noticed that flash captchas are very popular on such components stores like flashden etc, but just few of them are actually made properly and can prevent spammers from doing their magic ^_^.
So, i’ve decided to write a little sample catcha validator class for those of u that need or would need one.
Read more
Older Entries Newer Entries