JSFL :: printLinkageIDs
Submitted by hasan on Thu, 01/25/2007 - 08:00.If you ever find yourself prepping 100s of assets for some Flash/Flex skinning, this command will peruse the Library and print out all the linkage IDs you so carefully crafted to a text file that you can later use to import or copy/paste into your styling scheme...
/* * JSFL printLinkageIDs * Author: Hasan Otuome * hasan.otuome.com * Version: 1.0 * January 21, 2007 */ fl.outputPanel.clear(); //declare some variables var doc = fl.getDocumentDOM(); var lib = doc.library; //library variables var clips = lib.items; var clip;
AS3 :: StringUtils Class
Submitted by hasan on Thu, 10/05/2006 - 07:00.Came up with this idea after perusing proto.layer51.com. It's basically a sub-class of String and the 1st method is a reduction method that let's you feed in a string, a limit and a "there's more" indicator. Anyways, here's the code:
class labs.otuome.utils.StringUtils extends String
{
public var theString:String;
public function StringUtils(string:String)
{
super();
theString = string;
}
public function reduce(stringLength,trimIndicator):String
{
var trimmedString:Array = [];
if (theString.length < = stringLength)AS2 :: Animator Class
Submitted by hasan on Thu, 08/17/2006 - 07:00.Nothing special here. This is just a helper class for the TileMaker class. It only has (1) method animate which I made static so you don't have to create instances of this class.
import mx.transitions.Tween;
import mx.transitions.easing.*;
class labs.otuome.effects.Animator extends MovieClip
{
private function Animator(){super();}
static public function animate(clip:MovieClip,newx:Number,newy:Number,tweenType:Function)
{
var xTween:Tween = new Tween(clip,"_x",tweenType,clip._x,newx,3,true);AS2 :: XMLMenu Class
Submitted by hasan on Wed, 07/26/2006 - 07:00.Goal: minimize the amount of code rewrite involved in creating XML-based menus in Flash. You can customize the Class to match the structure of your XML file.
class labs.otuome.utils.XMLMenu extends MovieClip
{
//declare your variables
private var _i:Number;
private var _j:Number;
private var _mainTL;
private var _btns:XML;
private var _butz:Array;
private var _tmpX:Number;
private var _tmpY:Number;
private var _btn;
private var _xmlfile:String;
private var _menutarget:MovieClip;
private var _space:Number;
private var _vertical:Boolean;AS2 :: CuePoints Class
Submitted by hasan on Sun, 07/16/2006 - 07:00.Goal: Wanted to simplify cue point usage for FLVs that needed text captions. The repetitive static code is placed in the class file leaving the dynamic stuff for the FLA.
import mx.utils.Delegate;
class labs.otuome.utils.CuePoints
{
private var _vid;
private var _arr:Array;
private var _ct:TextField;
private var _cf:Function;
public function CuePoints(co:Object)
{
_vid = co.video;
_arr = co.cues;
_ct = co.textbox;
_cf = co.animation;
_vid.addEventListener("cuePoint", Delegate.create(this,_onCue));
}//end constructor
Flex :: AMFPHP Login
Submitted by hasan on Mon, 07/10/2006 - 07:00.The subject pops up a lot about reusable Flex components. Here's one to handle multi-user logins via AMFPHP / MySQL:
< ?xml version="1.0" encoding="utf-8"?>
<mx :Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" width="355" height="213">
</mx><mx :Script>
< 

