<?xml version="1.0" encoding="UTF-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ActionScript Scraps &#187; as2.0</title>
	<atom:link href="http://blog.sitedaniel.com/tag/as20/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sitedaniel.com</link>
	<description>Flash, Flex and AIR development</description>
	<lastBuildDate>Wed, 28 Jul 2010 11:15:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Swf Info : width, height, swf version, actionscript version, framerate</title>
		<link>http://blog.sitedaniel.com/2009/11/swf-info-width-height-swf-version-actionscript-version-framerate/</link>
		<comments>http://blog.sitedaniel.com/2009/11/swf-info-width-height-swf-version-actionscript-version-framerate/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 13:31:30 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as2.0]]></category>
		<category><![CDATA[as3.0]]></category>
		<category><![CDATA[info]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[swfinfo]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=441</guid>
		<description><![CDATA[Have a local SWF but no FLA? Need to know the width, height, swf version, actionscript version or framerate? You can use this tool to load in your SWF and find out everything you need to know. It works with Flash Movies using ActionScript 2.0 or 3.0 and will tell you instantly all the information [...]]]></description>
			<content:encoded><![CDATA[<p>Have a local SWF but no FLA? Need to know the width, height, swf version, actionscript version or framerate?<br />
You can use this tool to load in your SWF and find out everything you need to know.<br />
It works with Flash Movies using ActionScript 2.0 or 3.0 and will tell you instantly all the information you need to know about your SWF.</p>
<p><a href="http://dev.sitedaniel.com/swfinfo/swfinfo.swf" rel="shadowbox;height=122;width=200"><img src="http://dev.sitedaniel.com/swfinfo/swfinfo.png" alt="swfinfo" title="swfinfo" width="202" height="124" class="alignnone size-full wp-image-358" /></a></p>
<p>swfVersion, actionScriptVersion, frameRate, width, height</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2009/11/swf-info-width-height-swf-version-actionscript-version-framerate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Vauxhall Comparator</title>
		<link>http://blog.sitedaniel.com/2009/04/vauxhall-comparator/</link>
		<comments>http://blog.sitedaniel.com/2009/04/vauxhall-comparator/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 11:48:24 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as2.0]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[sites]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=238</guid>
		<description><![CDATA[This is a project I worked on a few years ago and forgot about for a while. It took a while for it to go live with the the Vauxhall.co.uk redesign but it is live now. It is ActionScript2.0 and run by a very large data set, and configured completely via XML. http://www.vauxhall.co.uk/vaux/pages/cars/helpMeChoose/comparator/index.jsp]]></description>
			<content:encoded><![CDATA[<p>This is a project I worked on a few years ago and forgot about for a while. It took a while for it to go live with the the Vauxhall.co.uk redesign but it is live now.<br />
It is ActionScript2.0 and run by a very large data set, and configured completely via XML. </p>
<p><a href="http://www.vauxhall.co.uk/vaux/pages/cars/helpMeChoose/comparator/index.jsp">http://www.vauxhall.co.uk/vaux/pages/cars/helpMeChoose/comparator/index.jsp</a></p>
<p><a href="http://www.vauxhall.co.uk/vaux/pages/cars/helpMeChoose/comparator/index.jsp"><img src="http://blog.sitedaniel.com/wp-content/uploads/2009/04/comparator.jpg" alt="comparator" title="comparator" width="400" height="245" class="alignnone size-full wp-image-239" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2009/04/vauxhall-comparator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fig Leaves Xmas promotion</title>
		<link>http://blog.sitedaniel.com/2008/11/fig-leaves-xmas-promotion/</link>
		<comments>http://blog.sitedaniel.com/2008/11/fig-leaves-xmas-promotion/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 21:24:10 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as2.0]]></category>
		<category><![CDATA[sites]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=114</guid>
		<description><![CDATA[This small project went live recently. It is AS2.0 and XML driven. link]]></description>
			<content:encoded><![CDATA[<p>This small project went live recently. It is AS2.0 and XML driven.</p>
<p><a href="http://www.figleaves.com/uk/ts_hf.asp?item=giftshop&cm_re=menu-_-menu_top-_-shop_by_brand" />link</a></p>
<p><a href="http://www.figleaves.com/uk/ts_hf.asp?item=giftshop&#038;cm_re=menu-_-menu_top-_-shop_by_brand"><img src="http://blog.sitedaniel.com/wp-content/uploads/2009/02/site_figleaves.jpg" alt="" title="site_figleaves" width="400" height="251" class="alignnone size-full wp-image-116" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2008/11/fig-leaves-xmas-promotion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leading Zero Static function for digital clock</title>
		<link>http://blog.sitedaniel.com/2008/09/leading-zero-static-function-for-digital-clock/</link>
		<comments>http://blog.sitedaniel.com/2008/09/leading-zero-static-function-for-digital-clock/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 11:13:33 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as2.0]]></category>
		<category><![CDATA[static function]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=77</guid>
		<description><![CDATA[If you've ever created a digital timer or clock then you probably used something like this function. It adds a leading zero if the number is only one digit long. This means that if the minute value is '6' then it will return '06'. eg. 12:06:43 &#160; class com.sitedaniel.utils.StringUtil &#123; public function StringUtil&#40;&#41;&#123;&#125; /** * [...]]]></description>
			<content:encoded><![CDATA[<p>If you've ever created a digital timer or clock then you probably used something like this function. It adds a leading zero if the number is only one digit long. This means that if the minute value is '6' then it will return '06'. eg. 12:06:43</p>
<pre class="actionscript">&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">sitedaniel</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">StringUtil</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> StringUtil<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>
	<span style="color: #808080; font-style: italic;">/**
	 * leadingZero
	 * Adds a zero if the length is less than 2
	 * @param	s
	 * @return  String with length of 2
	/*
	eg.
	input '0'  return '00'
	input '5'  return '05'
	input '24' return '24'
	*/</span>
	<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> leadingZero<span style="color: #66cc66;">&#40;</span>s:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">switch</span> <span style="color: #66cc66;">&#40;</span>s.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">1</span> :
				<span style="color: #b1b100;">return</span> <span style="color: #ff0000;">&quot;0&quot;</span> + s;
				<span style="color: #b1b100;">break</span>;
			<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">2</span> :
				<span style="color: #b1b100;">return</span> s;
				<span style="color: #b1b100;">break</span>;
			<span style="color: #000000; font-weight: bold;">default</span> :
				<span style="color: #b1b100;">return</span> s;
				<span style="color: #b1b100;">break</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2008/09/leading-zero-static-function-for-digital-clock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dead Set launch</title>
		<link>http://blog.sitedaniel.com/2008/09/dead-set-launch/</link>
		<comments>http://blog.sitedaniel.com/2008/09/dead-set-launch/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 15:54:57 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as2.0]]></category>
		<category><![CDATA[brightcove]]></category>
		<category><![CDATA[flv]]></category>
		<category><![CDATA[sites]]></category>
		<category><![CDATA[streaming]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=71</guid>
		<description><![CDATA[The E4 Dead Set site went live on Friday. The build was enjoyable as there are many interesting video and sound effects. It is XML driven and uses the BrightCove FLV player and Omniture Tracking. link]]></description>
			<content:encoded><![CDATA[<p>The E4 <a href="http://www.e4.com/deadset">Dead Set</a> site went live on Friday.<br />
The build was enjoyable as there are many interesting video and sound effects.<br />
It is XML driven and uses the BrightCove FLV player and Omniture Tracking.</p>
<p><a href="http://www.e4.com/deadset">link</a></p>
<p><a href="http://www.e4.com/deadset"><img src="http://blog.sitedaniel.com/wp-content/uploads/2008/09/deadset.jpg" alt="" title="Dead Set" width="400" height="293" class="alignnone size-full wp-image-75" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2008/09/dead-set-launch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS2.0 DesignTool</title>
		<link>http://blog.sitedaniel.com/2008/08/as20-designtool/</link>
		<comments>http://blog.sitedaniel.com/2008/08/as20-designtool/#comments</comments>
		<pubDate>Tue, 26 Aug 2008 19:24:00 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as2.0]]></category>
		<category><![CDATA[design tool]]></category>
		<category><![CDATA[static function]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=65</guid>
		<description><![CDATA[Following up on an earlier post, here is the AS2.0 version of the dragToPosition X &#38; Y coordinate tracer. class com.sitedaniel.utils.Design { public static function dragToPosition(mc:MovieClip):Void { mc.onPress = function():Void { startDrag(this, false); } mc.onRelease = function():Void { this.stopDrag(); trace(this._x + ', ' + this._y); } } }]]></description>
			<content:encoded><![CDATA[<p>Following up on an earlier post, here is the AS2.0 version of the dragToPosition X &amp; Y coordinate tracer.</p>
<pre>
class com.sitedaniel.utils.Design
{
	public static function dragToPosition(mc:MovieClip):Void
	{
		mc.onPress = function():Void
		{
			startDrag(this, false);
		}
		mc.onRelease = function():Void
		{
			this.stopDrag();
			trace(this._x + ', ' + this._y);
		}
	}
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2008/08/as20-designtool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS2.0 Delegate.create with parameters</title>
		<link>http://blog.sitedaniel.com/2008/08/as20-delegatecreate-with-parameters/</link>
		<comments>http://blog.sitedaniel.com/2008/08/as20-delegatecreate-with-parameters/#comments</comments>
		<pubDate>Tue, 26 Aug 2008 19:21:47 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as2.0]]></category>
		<category><![CDATA[delegate]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=63</guid>
		<description><![CDATA[This is an oldie but a goodie. Getting around scope problems in AS2 can be a pain, but mx.utils.Delegate can help. The only problem is that you can't pass parameters to your function using this one. The following class enables you to use the Delegate.create method, and also pass parameters to the function: class com.sitedaniel.utils.Delegate [...]]]></description>
			<content:encoded><![CDATA[<p>This is an oldie but a goodie.<br />
Getting around scope problems in AS2 can be a pain, but mx.utils.Delegate can help. The only problem is that you can't pass parameters to your function using this one. The following class enables you to use the Delegate.create method, and also pass parameters to the function:</p>
<pre>
class com.sitedaniel.utils.Delegate
{
    public static function create(t:Object, f:Function):Function
    {
        var _args:Array = arguments.slice(2);
        var _func:Function = function():Void
        {
            var _newArgs:Array = arguments.concat(_args);
            f.apply(t, _newArgs);
        };
        return _func;
    }
}
</pre>
<p><strong>UPDATE 11/10/08</strong></p>
<p>This post gets quite a bit of traffic so I thought I should add a usage example.</p>
<p>This is a function that creates 5 buttons and spaces them in a loop:</p>
<pre>
private function _createButtons():Void {
    for (var i:Number = 0; i<5; i++) {
        var tmp:MovieClip = _mc.createEmptyMovieClip('b_'+i, i);
        tmp._x = 40 * i;
        tmp.onRelease = Delegate.create(this, _onRelease, i);
    }
}</pre>
<p><strong>Delegate.create(this, _onRelease, i);</strong></p>
<p>Then by passing 'i' in as a parameter, it comes into the function as an argument:</p>
<pre>
private function _onRelease(n:Number):Void {
    trace('_onRelease : '+n)
}</pre>
<p>You can also pass in multiple arguments, including different types:</p>
<pre>
tmp.onRelease = Delegate.create(this, _onRelease, i, true, {val:10});
...
function _onRelease(n:Number, isGood:Boolean, myObj:Object):Void {...
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2008/08/as20-delegatecreate-with-parameters/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Customising the FlashDevelop Class templates</title>
		<link>http://blog.sitedaniel.com/2008/07/customising-the-flashdevelop-class-templates/</link>
		<comments>http://blog.sitedaniel.com/2008/07/customising-the-flashdevelop-class-templates/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 16:29:43 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as2.0]]></category>
		<category><![CDATA[as3.0]]></category>
		<category><![CDATA[flashdevelop]]></category>

		<guid isPermaLink="false">http://86.18.184.155/sitedaniel/?p=50</guid>
		<description><![CDATA[Here's how to update the new Class template text in FlashDevelop. Out of the box, if you hit Ctrl+1 you'll get this: /** * ... * @author Default */ class { } So that you don't have to add in your name every time, you can edit the template here: Tools -&#62; Application Files... Templates/ [...]]]></description>
			<content:encoded><![CDATA[<p>Here's how to update the new Class template text in FlashDevelop.<br />
Out of  the box, if you hit Ctrl+1 you'll get this:</p>
<pre>
/**
* ...
* @author Default
*/

class {

}</pre>
<p>So that you don't have to add in your name every time, you can edit the template here:</p>
<p><strong>Tools -&gt; Application Files...<br />
Templates/ AS3.fdt (AS2.fdt)</strong></p>
<p>You can add in your URL as well:</p>
<pre>
package $(CSLB){

	/**
	* ...
	* @author 	Daniel
	* @url		http://www.sitedaniel.com
	*/
	public class $(EntryPoint) $(CSLB){

	}

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2008/07/customising-the-flashdevelop-class-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Opening Pop-up windows from Flash</title>
		<link>http://blog.sitedaniel.com/2008/06/opening-pop-up-windows-from-flash/</link>
		<comments>http://blog.sitedaniel.com/2008/06/opening-pop-up-windows-from-flash/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 13:30:53 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as2.0]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://86.18.184.155/sitedaniel/?p=49</guid>
		<description><![CDATA[Recently I read that the best way to open pop-up windows from Flash was to use the ExternalInterface class. I found some code that looked good but it didn't work in Safari on a Mac. if (ExternalInterface.available) { ExternalInterface.call("window.open", "popup.html", "win", "height=300, width=400, toolbar=no, scrollbars=yes"); } else { getURL('popup.html', '_blank'); } However it isn't that [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I read that the best way to open pop-up windows from Flash was to use the ExternalInterface class. I found some code that looked good but it didn't work in Safari on a Mac.</p>
<pre>
if (ExternalInterface.available) {
	ExternalInterface.call("window.open",
				"popup.html",
				"win",
				"height=300,
				width=400,
				toolbar=no,
				scrollbars=yes");
} else {
	getURL('popup.html', '_blank');
}</pre>
<p>However it isn't that hard to just use getURL and call a javascript function set in the html page:</p>
<pre>
//javascript
	function openPopup() {
		winWidth = 450;
		winHeight = 680;
		screenWidth = screen.availWidth;
		screenHeight = screen.availHeight;
		if (screenWidth &lt; winWidth) {
			winWidth = screenWidth;
		}
		if (screenHeight &lt; winHeight) {
			winHeight = screenHeight;
		}
		winTop = (screenHeight - winHeight) / 2;
		winLeft = (screenWidth - winWidth) / 2;
		window.open(\'page.html\',\'Title\',\'width=450,
				height=680,scrollbars=no,
				status=no,resizeable=yes\'+ \',
				left=\' + winLeft + \',
				top=\' + winTop);
		//window.focus();
	}</pre>
<p>So far this works in all browsers.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2008/06/opening-pop-up-windows-from-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vauxhall Diesel</title>
		<link>http://blog.sitedaniel.com/2008/05/vauxhall-diesel/</link>
		<comments>http://blog.sitedaniel.com/2008/05/vauxhall-diesel/#comments</comments>
		<pubDate>Mon, 19 May 2008 12:38:05 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as2.0]]></category>
		<category><![CDATA[sites]]></category>

		<guid isPermaLink="false">http://86.18.184.155/sitedaniel/?p=47</guid>
		<description><![CDATA[This site is tucked away a little on vauxhall.co.uk but I really like it. There are a few hidden 'application' type sections that include a vehicle chooser and engine comparator. link]]></description>
			<content:encoded><![CDATA[<p>This site is tucked away a little on <a href="http://www.vauxhall.co.uk">vauxhall.co.uk</a> but I really like it. There are a few hidden 'application' type sections that include a vehicle chooser and engine comparator.</p>
<p><a href="http://www.vauxhall.co.uk/vx/microsite/diesel08/index.html">link</a></p>
<p><a href="http://www.vauxhall.co.uk/vx/microsite/diesel08/index.html" title="diesel.jpg"><img src="/wp-content/uploads/2008/05/diesel.jpg" alt="diesel.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2008/05/vauxhall-diesel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
