JSFL :: printLinkageIDs

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

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

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

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

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

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>
		< ![CDATA[
			import flash.net.Responder;
 
			public var gateway:RemotingConnection;
 
			public function checkLogin(service:String,params:Array):void
			{
				gateway = new RemotingConnection("http://yourwebserver.com/flashservices/gateway.php");

AS2 :: TileMaker Class

Came up with this one after a number of posts over @ gotoAndLearn() about making grids from XML files. Since I'm all about reusability, I devised an easy way to create animated thumnail tiles for an XML photo gallery could be an XML video gallery too. Just feed in the required parameters and off you go. Button events could easily be added to the thumbnails also.

import mx.utils.Delegate;
import labs.otuome.effects.Animator;
 
class labs.otuome.utils.TileMaker
{
	private var _xmlfile:String;
	private var _gridType:String;
	private var _increment:Number;

AS2 :: FlashCookie Class

Goal: Create a simple way to incorporate SharedObjects into Flash-based forms.

class labs.otuome.utils.FlashCookie
{
   private var _mainTL:MovieClip;
   private var _cookie:SharedObject;
   private var _cookieName:String;
   private var _chips:Object;
 
   public function FlashCookie(newCookie:String,target:MovieClip)
   {
      this._cookieName = newCookie;
      _cookie = SharedObject.getLocal(_cookieName);
	  _mainTL = target;
   }
 
   public function bakeCookie(obj:Object):Void
   {
      var i:String;
      for (i in obj) 
      {

AS2 :: Guestbook Class

Goal: To devise an easy way to add user interaction to a full-Flash site, in this case a guestbook.

class labs.otuome.utils.Guestbook
{
	private var _earl:String;
	private var _display;
	private var _getEntries:LoadVars;
	private var _sender:LoadVars;
	private var _receiver:LoadVars;
	private var _refresh:LoadVars;
	private var _mainTL:MovieClip;
	private var _validname:Boolean;
	private var _validemail:Boolean;
	private var _validcity:Boolean;
	private var _validmsg:Boolean;
	private var _array:Array;
	private var _uri:String;
 

AS2 :: BackgroundFill Class

Goal: To devise an easy reusable way to create seamless backgrounds for full-screen Flash movies whether it be gradients or bitmaps. Works with a "bg" Object customized to your needs.

import flash.display.BitmapData;
import flash.geom.Matrix;
 
class labs.otuome.ui.graphics.BackgroundFill
{
	private var _main:MovieClip;
	private var _sub:MovieClip;
	private var _w:Number;
	private var _h:Number;
	private var _gradient:Object;
	private var _bitmap:String;
	private var _fillType:String;
	private var _colors:Array;
	private var _alphas:Array;

Copyright © 2008 Otuome Labs. All rights reserved.

sfy39587f11