Archive for October, 2007

Static Classes

Posted in Actionscript 3.0, Code Snippets, Other on October 30th, 2007 by Omar Faleh – Be the first to comment

Static classes are life savers for those who want a central data hubs where all shared variables are stored and accessed and modified. Some programmers think that this is dangerous since there is no real control over who gets to do what with the variables.. but for a scenario where several objects need to access the same data.. I can’t think of better ways of doing so.

here’s an example of a static class:

package com.packageName{

	public class DataStore{
		static var _DS:DataStore;
		static var dataArray:Array;

		public function DataStore(){
			// write something here
		}

		public static function getInstance(): DataStore	{
			if (_DS == null) _DS = new DataStore();
			return _DS;
		}

		public function doSomething(){
			// write code here
		}
	}
}

and then to call the function doSomething from this class, this is the way it’s called:

com.packageName.DataStore.getInstance().doSomething();

Creating a Video Player in AS3 using NetStream

Posted in Actionscript 3.0, Code Snippets on October 30th, 2007 by Omar Faleh – 2 Comments

I always try to opt from using the flv player component.. although it saves us half the work when it comes to accessing the properties and methods, sometimes it is still very heavy (in size) compared to this approach that really doesn’t add anything worth mentioning

import flash.media.SoundTransform;import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;

public class videoPlayer
{
	public function videoPlayer():void
	{

		var customClient = new Object();
		customClient.onMetaData = metaDataHandler;

		var nc = new NetConnection();
		nc.connect(null);

		var ns = new NetStream(nc);
		ns.client = customClient;
		var vid = new Video(320, 240);
		vid.name = "vid";

 		this.addChild(vid);
		vid.attachNetStream(ns);
 		ns.play("videos/videoSample.flv");

		st = new SoundTransform();
 		st.volume=0.5;

		ns.soundTransform=st;
	}

	public function metaDataHandler(infoObject:Object):void {
		for (var prop in infoObject){
			trace(prop+" : "+infoObject[prop]);
		}
	}

}

Gugga framework Alpha Release

Posted in Adobe Technologies, Flash Technologies on October 15th, 2007 by Omar Faleh – Be the first to comment

http://www.gugga.com/GuggaFlashFramework/
I am still waiting for the Fuse library to be ported into AS3.. IU can’t bring myself to get back into the flash built-in Tween classes.
I heard some recommendations for tween-lite… I wonder if I should start dipping my feet into that puddle or just wait until I see something else emerging.

Thermo is Coming

Posted in Adobe Technologies, New Technologies on October 15th, 2007 by Omar Faleh – Be the first to comment

Thermo-Img
“Thermo” is an upcoming Adobe product that makes it easy for designers to create rich Internet application UIs. Thermo allows designers to build on familiar workflows to visually create working applications that easily flow into production and development.

interesting, eh?