<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>OMAR FALEH [FLASH GORDON]</title>
	<link>http://blog.morscad.com</link>
	<description>This is the blog of Omar Faleh. a Montréal-based flash programmer and web developer. Flash Gordon is the Nick Name I was given by one of my former project managers after a project I did with him.. we work in different places now but the name remains as a memory</description>
	<pubDate>Wed, 28 May 2008 19:36:42 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>
	<language>en</language>
			<item>
		<title>Double Buffering for smooth netstream FLV playback</title>
		<link>http://blog.morscad.com/code-snippets/double-buffering-for-smooth-netstream-flv-playback/</link>
		<comments>http://blog.morscad.com/code-snippets/double-buffering-for-smooth-netstream-flv-playback/#comments</comments>
		<pubDate>Wed, 28 May 2008 19:36:42 +0000</pubDate>
		<dc:creator>Omar Faleh</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Actionscript 2.0]]></category>

		<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://blog.morscad.com/code-snippets/double-buffering-for-smooth-netstream-flv-playback/</guid>
		<description><![CDATA[This post is to highlight the double buffering technique (also known as dynamic buffering) that "should" make video streaming in flash alot smoother without having to prebuffer anything.
This technique works on progressive video download as well as streaming:

var startBufferLength:Number= 2; //keep this in the range 2-4+
var xpandedBufferLength:Number = 15;  //arbitrarily highnc = new NetConnection();
nc.connect(null);
ns [...]]]></description>
			<content:encoded><![CDATA[<p>This post is to highlight the double buffering technique (also known as dynamic buffering) that "should" make video streaming in flash alot smoother without having to prebuffer anything.</p>
<p>This technique works on progressive video download as well as streaming:</p>
<pre>
var startBufferLength:Number= 2; //keep this in the range 2-4+
var xpandedBufferLength:Number = 15;  //arbitrarily highnc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
ns.setBufferTime(3);
ns.autoPlay = false;
ns.onStatus = Delegate.create(this, handleVideoStatus);//(if this was AS3 the syntax will be:
//ns.addEventListener(NetStatusEvent.NET_STATUS, handleVideoStatus);

// if this was Actionscript 3, this following line would be:
// private function handleStatus(event:NetStatusEvent):void 

function handleVideoStatus(infoObject:Object)
{

	switch (infoObject.code) {
		case "NetConnection.Connect.Success":

		break;

		case "NetStream.Buffer.Full":
			ns.bufferTime = xpandedBufferLength;
		break;

		case "NetStream.Buffer.Empty":
			ns.bufferTime = startBufferLength;
		break;

		case "NetStream.Play.Start":
			// the video has started playing, do something here
		break;

		case "NetStream.Play.Stop" :
			// the video has stopped playing (finished)
		break;

	}
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.morscad.com/code-snippets/double-buffering-for-smooth-netstream-flv-playback/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Reading from and writing to shared object</title>
		<link>http://blog.morscad.com/code-snippets/reading-from-and-writing-to-shared-object/</link>
		<comments>http://blog.morscad.com/code-snippets/reading-from-and-writing-to-shared-object/#comments</comments>
		<pubDate>Wed, 28 May 2008 18:36:59 +0000</pubDate>
		<dc:creator>Omar Faleh</dc:creator>
		
		<category><![CDATA[Actionscript 2.0]]></category>

		<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://blog.morscad.com/code-snippets/reading-from-and-writing-to-shared-object/2008/05/28/</guid>
		<description><![CDATA[Reading the shared object:

var my_so:SharedObject = SharedObject.getLocal("SomeName");
var trackingDate:Date = my_so.data.theDate
writing to a shared object:

var my_so:SharedObject = SharedObject.getLocal("SomeName");
var _date = new Date();
my_so.data.theDate = _date;
my_so.flush(10000);
and clearing a shared object (erasing its content)

var my_so:SharedObject = SharedObject.getLocal("SomeName");
my_so.clear();
]]></description>
			<content:encoded><![CDATA[<p>Reading the shared object:</p>
<pre>
var my_so:SharedObject = SharedObject.getLocal("SomeName");
var trackingDate:Date = my_so.data.theDate</pre>
<p>writing to a shared object:</p>
<pre>
var my_so:SharedObject = SharedObject.getLocal("SomeName");
var _date = new Date();
my_so.data.theDate = _date;
my_so.flush(10000);</pre>
<p>and clearing a shared object (erasing its content)</p>
<pre>
var my_so:SharedObject = SharedObject.getLocal("SomeName");
my_so.clear();</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.morscad.com/code-snippets/reading-from-and-writing-to-shared-object/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Loader flash calls a function from the loaded flash</title>
		<link>http://blog.morscad.com/code-snippets/loader-flash-calls-a-function-from-the-loaded-flash/</link>
		<comments>http://blog.morscad.com/code-snippets/loader-flash-calls-a-function-from-the-loaded-flash/#comments</comments>
		<pubDate>Wed, 28 May 2008 18:27:00 +0000</pubDate>
		<dc:creator>Omar Faleh</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://blog.morscad.com/code-snippets/loader-flash-calls-a-function-from-the-loaded-flash/2008/05/28/</guid>
		<description><![CDATA[let's imagine this scenario:
A.swf loads B.swf
after load is completed,A.swf needs to execute a function in B.swf called runCommands() for example.. here is the code for that (this is the code inside A.swf):

import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.*;
import flash.net.URLRequest;

...

var loaderRequest:URLRequest = new URLRequest("B.swf");
var movieLoader:Loader = new Loader();
movieLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
movieLoader.load(loaderRequest)....

function completeHandler(_event:Event)
{

	var _loaderInfo:LoaderInfo = _event.target as LoaderInfo;
	var loadedObject:Object = _loaderInfo.content;
	loadedObject.runCommands()
}
]]></description>
			<content:encoded><![CDATA[<p>let's imagine this scenario:<br />
A.swf loads B.swf<br />
after load is completed,A.swf needs to execute a function in B.swf called runCommands() for example.. here is the code for that (this is the code inside A.swf):</p>
<pre>
import flash.display.Loader;
import flash.display.<span class="searchhilite">LoaderInfo</span>;
import flash.events.*;
import flash.net.URLRequest;

...

var loaderRequest:URLRequest = new URLRequest("B.swf");
var movieLoader:Loader = new Loader();
movieLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
movieLoader.load(loaderRequest)....

function completeHandler(_event:Event)
{

	var _loaderInfo:LoaderInfo = _event.target as LoaderInfo;
	var loadedObject:Object = _loaderInfo.content;
	loadedObject.runCommands()
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.morscad.com/code-snippets/loader-flash-calls-a-function-from-the-loaded-flash/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Custom Events</title>
		<link>http://blog.morscad.com/code-snippets/26/</link>
		<comments>http://blog.morscad.com/code-snippets/26/#comments</comments>
		<pubDate>Mon, 03 Dec 2007 00:13:20 +0000</pubDate>
		<dc:creator>Omar Faleh</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://blog.morscad.com/uncategorized/26/2007/12/02/</guid>
		<description><![CDATA[Creating custom events in AS3 is really easy, and very powerful. example:
lets say that there is a custom event that should be fired when a "Tween Lite" animation is done playing. we start by creating the custom event :

package  {
	import flash.events.*;

	public class FinishedEvent extends Event{

		private var trackingValue:String;
		public static var DO_SOMETHING= "do_something"

		public function FinishedEvent(type:String , [...]]]></description>
			<content:encoded><![CDATA[<p>Creating custom events in AS3 is really easy, and very powerful. example:</p>
<p>lets say that there is a custom event that should be fired when a "<a href="http://blog.greensock.com/tweenliteas3" target="_blank">Tween Lite</a>" animation is done playing. we start by creating the custom event :</p>
<pre>
package  {
	import flash.events.*;

	public class FinishedEvent extends Event{

		private var trackingValue:String;
		public static var DO_SOMETHING= "do_something"

		public function FinishedEvent(type:String , someValue:String) {
 			super(type);
			trackingValue = someValue;

		}

		public function getDispatcherName()
 		{
 			return  trackingValue;
 		}
	}
}</pre>
<p> <a href="http://blog.morscad.com/code-snippets/26/#more-26" class="more-link">(more...)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.morscad.com/code-snippets/26/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Static Classes</title>
		<link>http://blog.morscad.com/uncategorized/static-classes/</link>
		<comments>http://blog.morscad.com/uncategorized/static-classes/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 03:02:24 +0000</pubDate>
		<dc:creator>Omar Faleh</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Code Snippets]]></category>

		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://blog.morscad.com/?p=25</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>here's an example of a static class:</p>
<pre>
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
		}
	}
}</pre>
<p>and then to call the function doSomething from this class, this is the way it's called:</p>
<pre>com.packageName.DataStore.getInstance().doSomething();</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.morscad.com/uncategorized/static-classes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Creating a Video Player in AS3 using NetStream</title>
		<link>http://blog.morscad.com/code-snippets/creating-a-video-player-in-as3-using-netstream/</link>
		<comments>http://blog.morscad.com/code-snippets/creating-a-video-player-in-as3-using-netstream/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 02:38:43 +0000</pubDate>
		<dc:creator>Omar Faleh</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://blog.morscad.com/?p=24</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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</p>
<pre>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]);
		}
	}

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.morscad.com/code-snippets/creating-a-video-player-in-as3-using-netstream/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Gugga framework Alpha Release</title>
		<link>http://blog.morscad.com/adobe-technologies/gugga-framework-alpha-release/</link>
		<comments>http://blog.morscad.com/adobe-technologies/gugga-framework-alpha-release/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 01:25:27 +0000</pubDate>
		<dc:creator>Omar Faleh</dc:creator>
		
		<category><![CDATA[Flash Technologies]]></category>

		<category><![CDATA[Adobe Technologies]]></category>

		<guid isPermaLink="false">http://blog.morscad.com/?p=22</guid>
		<description><![CDATA[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.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.gugga.com/GuggaFlashFramework/">http://www.gugga.com/GuggaFlashFramework/</a><br />
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.<br />
I heard some recommendations for <a href="http://blog.greensock.com/tweenliteas3/" target="_blank">tween-lite</a>... I wonder if I should start dipping my  feet into that puddle or just wait until I see something else emerging.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.morscad.com/adobe-technologies/gugga-framework-alpha-release/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thermo is Coming</title>
		<link>http://blog.morscad.com/adobe-technologies/thermo-is-coming/</link>
		<comments>http://blog.morscad.com/adobe-technologies/thermo-is-coming/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 01:16:45 +0000</pubDate>
		<dc:creator>Omar Faleh</dc:creator>
		
		<category><![CDATA[New Technologies]]></category>

		<category><![CDATA[Adobe Technologies]]></category>

		<guid isPermaLink="false">http://blog.morscad.com/?p=21</guid>
		<description><![CDATA[
"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?
]]></description>
			<content:encoded><![CDATA[<blockquote><a href="http://labs.adobe.com/wiki/index.php/Thermo" target="_blank"><img src="http://blog.morscad.com/wp-content/uploads/2007/10/thermo-774986gif.png" alt="Thermo-Img" /></a><br />
"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.</p></blockquote>
<p>interesting, eh?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.morscad.com/adobe-technologies/thermo-is-coming/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Event Broadcaster - passing events from one object to another</title>
		<link>http://blog.morscad.com/code-snippets/event-broadcaster-passing-events-from-one-object-to-another/</link>
		<comments>http://blog.morscad.com/code-snippets/event-broadcaster-passing-events-from-one-object-to-another/#comments</comments>
		<pubDate>Wed, 19 Sep 2007 21:21:22 +0000</pubDate>
		<dc:creator>Omar Faleh</dc:creator>
		
		<category><![CDATA[Actionscript 2.0]]></category>

		<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://www.morscad.com/Blog/?p=19</guid>
		<description><![CDATA[let's imagine this scenario:
we instantiate a certain number of instances of object A on the stage (_root) .. and we want each object to be receive a different value, and have that object do something with it
a real life example would be: create a client object and pass the client name as an argument to [...]]]></description>
			<content:encoded><![CDATA[<p>let's imagine this scenario:</p>
<p>we instantiate a certain number of instances of object A on the stage (_root) .. and we want each object to be receive a different value, and have that object do something with it</p>
<p>a real life example would be: create a client object and pass the client name as an argument to that object.</p>
<p>and let's assume that we have a complex class hierarchy that requires code optimization, which generally means that we need to know how to find the code without scrolling through a 5 page long classes.</p>
<p>for that, we can create an Event Manager class that listens to events from all objects in the structure and handles the calls and manages the data.</p>
<p>a simple example would be:<br />
 <a href="http://blog.morscad.com/code-snippets/event-broadcaster-passing-events-from-one-object-to-another/#more-19" class="more-link">(more...)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.morscad.com/code-snippets/event-broadcaster-passing-events-from-one-object-to-another/feed/</wfw:commentRss>
		</item>
		<item>
		<title>how to access an object on stage from a child class</title>
		<link>http://blog.morscad.com/code-snippets/how-to-access-an-object-on-stage-from-a-child-class/</link>
		<comments>http://blog.morscad.com/code-snippets/how-to-access-an-object-on-stage-from-a-child-class/#comments</comments>
		<pubDate>Wed, 19 Sep 2007 15:42:29 +0000</pubDate>
		<dc:creator>Omar Faleh</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://www.morscad.com/Blog/?p=18</guid>
		<description><![CDATA[I am not sure that this is the best or only way of doing it.. but here's what I found so far
what used to be _root.mcName in AS2 is gone... and now the while concept of root is also gone
according to Adobe (from the Flash CS3 help file)
the root property is  the top-most display [...]]]></description>
			<content:encoded><![CDATA[<p>I am not sure that this is the best or only way of doing it.. but here's what I found so far<br />
what used to be _root.mcName in AS2 is gone... and now the while concept of root is also gone</p>
<p>according to Adobe (from the Flash CS3 help file)</p>
<blockquote><p>the <code><span class="searchhilite"><code>root</code></span></code> property is  the top-most display object in the portion of the display list's tree structure  represented by that SWF file</p></blockquote>
<p>however, if you have an object on the stage with name <em>chalk</em> for example you can't access it by saying: root.chalk</p>
<p>because root is the parent displayObject of a stage, where objects are added.</p>
<p>so, on the document class or on the frames, if you write:<br />
 <a href="http://blog.morscad.com/code-snippets/how-to-access-an-object-on-stage-from-a-child-class/#more-18" class="more-link">(more...)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.morscad.com/code-snippets/how-to-access-an-object-on-stage-from-a-child-class/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
