Missing In Action

When you get busy, you don't realize how fast time passes. This has been the case with me over the past several weeks. Because of that I've kinda neglected this spot. Part of my time was spent building a new home for my code library though. You can now find it @ www.thesourcecode.org. Think things will be back to normal now. Got some more video tuts in mind so you can be on the lookout for those too. Read more

Flex :: Custom ComboBox Part 2

Last time we looked @ creating a custom ComboBox that could be reused for displaying states/countries. This time will wrap up by looking @ how that ComboBox can be used as an itemRenderer in a DataGrid. Since DataGrids use TextInputs as their default renderers when the grid is editable, we have to tell the grid we want to use our ComboBox for a particular column or columns. So, here's an example of an editable grid that's making use of the custom component: Read more

Flex :: Custom ComboBox Part 1

Goal: Create a reusable custom ComboBox for US States, World Countries, etc. Useful for inline DataGrid editing and any kind of form where you need the dropdown pre-selected. I didn't want to hardcode my states/countries lists but rather read them in from an XML file so that I wouldn't have to bother the code to make any changes to the data. I've come up with two methods for doing this: MXML and ActionScript. Here's the MXML way: [code lang="Actionscript"]< ?xml version="1.0" encoding="utf-8"?> Read more

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. [code lang="Actionscript"]import mx.transitions.Tween; import mx.transitions.easing.*; class org.thesourcecode.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); Read more

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. [code lang="Actionscript"]class org.thesourcecode.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; Read more

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. [code lang="Actionscript"]import mx.utils.Delegate; class org.thesourcecode.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 Read more

Flex :: AMFPHP Login

The subject pops up a lot about reusable Flex components. Here's one to handle multi-user logins via AMFPHP / MySQL: [code lang="Actionscript"]< ?xml version="1.0" encoding="utf-8"?> < ![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"); Read more

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. [code lang="Actionscript"]import mx.utils.Delegate; import org.thesourcecode.effects.Animator; class org.thesourcecode.utils.TileMaker{ private var _xmlfile:String; private var _gridType:String; Read more

AS2 :: FlashCookie Class

Goal: Create a simple way to incorporate SharedObjects into Flash-based forms. [code lang="Actionscript"]class org.thesourcecode.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) { Read more

AS2 :: Guestbook Class

Goal: To devise an easy way to add user interaction to a full-Flash site, in this case a guestbook. [code lang="Actionscript"]class org.thesourcecode.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; Read more