<?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>toDeBlog &#187; class</title>
	<atom:link href="http://todepoint.com/blog/category/class/feed/" rel="self" type="application/rss+xml" />
	<link>http://todepoint.com/blog</link>
	<description>A blog about User Interface, User Experience, Design, Flash, Product management and all that goes in between.</description>
	<lastBuildDate>Tue, 20 Dec 2011 12:54:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Random number without repeat as3</title>
		<link>http://todepoint.com/blog/2011/01/15/random-number-without-repeat/</link>
		<comments>http://todepoint.com/blog/2011/01/15/random-number-without-repeat/#comments</comments>
		<pubDate>Sat, 15 Jan 2011 11:52:25 +0000</pubDate>
		<dc:creator>adi</dc:creator>
				<category><![CDATA[action script]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[Contribution]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://todepoint.com/blog/?p=341</guid>
		<description><![CDATA[We're using the random object for many things, by its nature it may repeat a number, but sometimes we don't want to get the same number more than once, for example when showing a random image out of an array of images, or jumping to a random frame in a MovieClip. Currently there is no [...]]]></description>
			<content:encoded><![CDATA[<p>We're using the <a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/Math.html#random()" target="_blank" title="random object">random</a> object for many things, by its nature it may repeat a number, but sometimes we don't want to get the same number more than once, for example when showing a random image out of an array of images, or jumping to a random frame in a MovieClip. Currently there is no 'unique' function in Actionscript, you have to write your own solution.<br />
<br />
Here is my class for generating random numbers:</p>
<div id="randomPlace" style="border:1px solid #e0e0e0; width:490px; height:400px;"><img src="http://www.todepoint.com/adi/as_examples/randomPlus/randomPlus.gif" width="490" height="400" alt="randomPlus" /></div>
<p><script type="text/javascript">
// <![CDATA[
var rndfsso = new SWFObject("http://www.todepoint.com/adi/as_examples/randomPlus/random_test.swf", "my_random", "500", "400", "9", "#FFFFFF");
rndfsso.addParam("allowFullscreen", "false");
rndfsso.write("randomPlace");
// ]]&gt;
</script><br />
<br />
<strong>Download:</strong> <a href="http://www.todepoint.com/adi/as_examples/randomPlus/RandomPlus.as" title="random numbers generator class" target="_blank">RandomPlus.as</a>. </p>
<p><strong>Usage:</strong><br />
Create an instance of RandomPlus, defining the numbers scope (start &#038; end numbers), including negative values. in case only one parameter is passed the RandomPlus object will assume it is the end number and that the start number is zero:<br />
<code>var rp:RandomPlus = new RandomPlus( end:Number, start:Number = 0 );</code></p>
<p>After that you can use 'getNum' public function that will return a random number within the scope:<br />
<code>rp.getNum(); // returns a Number</code></p>
<p>You can use public var 'len' to retrieve the length of the scope in case you want to use it for your function:<br />
<code>rp.len; // returns a Number</code></p>
<p>*The object will return unlimited amount of numbers, each time the entire scope was returned it will reshuffle the items so it will continue to return random numbers within the scope, in an ever-changing order.<br />
<br />
Let me know if you liked it (or if you have suggestions), enjoy :)</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://todepoint.com/blog/2011/01/15/random-number-without-repeat/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Pure code AS3 spinning loading animation</title>
		<link>http://todepoint.com/blog/2010/07/22/spinning_animation-as3/</link>
		<comments>http://todepoint.com/blog/2010/07/22/spinning_animation-as3/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 08:35:26 +0000</pubDate>
		<dc:creator>adi</dc:creator>
				<category><![CDATA[action script]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[Contribution]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://todepoint.com/blog/?p=104</guid>
		<description><![CDATA[While working on the video player, I wanted to show spinning loading animation while buffering, and since I decided that the whole thing will be pure code, with no library assets, I had to code this animation &#8211; just the kind of things I like. It didn&#8217;t take long, and I decided to share it [...]]]></description>
			<content:encoded><![CDATA[<p>While working on the video player, I wanted to show spinning loading animation while buffering, and since I decided that the whole thing will be pure code, with no library assets, I had to code this animation &#8211; just the kind of things I like.<br />
It didn&#8217;t take long, and I decided to share it &#8211; why not?
</p>
<p>So here it is:</p>
<div id="loadAnimPlace" style="border:1px solid #e0e0e0; text-align:center;"><img src="http://www.todepoint.com/adi/as_examples/loadAnimation/loader_place.jpg" width="450" height="100" border="0" alt="loader animation with action script 3 code" /></div>
<p><script type="text/javascript">
// <![CDATA[
var ldAnim = new SWFObject("http://www.todepoint.com/adi/as_examples/loadAnimation/loader_anim.swf", "loadAnimSwf", "450", "100", "9", "#ffffff");
ldAnim.write("loadAnimPlace");
// ]]&gt;
</script></p>
<p>What you need to do in order to use it is add two functions:</p>
<p><code><br />
import LoadAnim;<br />
...<br />
private var myAnim	:LoadAnim;<br />
...</p>
<p>public function showAnim():void<br />
{<br />
	myAnim = new LoadAnim(0x333333);  // animation color<br />
	myAnim.x = stage.stageWidth / 2;<br />
	myAnim.y = stage.stageHeight / 2;<br />
	addChild(myAnim);<br />
}</p>
<p>public function hideAnim():void<br />
{<br />
	myAnim.stopAnim();<br />
	removeChildAt(1);<br />
}<br />
</code><br />
Download the class <a href="http://www.todepoint.com/adi/as_examples/loadAnimation/LoadAnim.as" title="download my pure code spinning loading animation class">here</a>, enjoy : )</p>
]]></content:encoded>
			<wfw:commentRss>http://todepoint.com/blog/2010/07/22/spinning_animation-as3/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Glossy buttons in pure as3 code</title>
		<link>http://todepoint.com/blog/2008/04/10/glossy-buttons-in-pure-as3-code/</link>
		<comments>http://todepoint.com/blog/2008/04/10/glossy-buttons-in-pure-as3-code/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 09:36:27 +0000</pubDate>
		<dc:creator>adi</dc:creator>
				<category><![CDATA[action script]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[Colors]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://todepoint.com/blog/?p=46</guid>
		<description><![CDATA[// I&#8217;ve been playing with the drawing classes, experimenting gradients and blending modes, and so I put together a small (basic) as3 class that generates a glossy button with pure code &#8211; no library assets. You can download the class here. The class constructor expects only 3 parameters: @param rad = Width of button @param [...]]]></description>
			<content:encoded><![CDATA[<div id="glsscontent"><img src="http://www.todepoint.com/adi/as_examples/glossy/glossy_but.jpg" width="450" height="200" border="0" /></div>
<p><script src="http://www.todepoint.com/blog/js/swfobject.js" type="text/javascript"></script><br />
<script type="text/javascript">
// <![CDATA[
var glsso = new SWFObject("http://www.todepoint.com/adi/as_examples/glossy/glossy_button2.swf", "sotester", "450", "200", "9", "#6d9a20");
glsso.write("glsscontent");
// ]]&gt;
</script>I&#8217;ve been playing with the drawing classes, experimenting gradients and blending modes, and so I put together a small (basic) as3 class that generates a glossy button with pure code &#8211; no library assets.</p>
<p>You can <a href="http://www.todepoint.com/adi/as_examples/glossy/glossy_class.zip" title="download the glossy class">download the class here</a>.</p>
<p>The class constructor expects only 3 parameters:<br />
<code>@param <strong>rad</strong>          = Width of button<br />
@param <strong>darkColor</strong>    = The color in top area, more dominant<br />
@param <strong>lightColor</strong>  = The color in the bottom area</code></p>
<p>* you can then place it anywhere, and use method <code><strong>setCaption</strong>(cap:String)</code> to place a label on the button, though this is a very basic implementation of text handling, I focused on drawing..</p>
<p>Let me know if you liked it : )</p>
]]></content:encoded>
			<wfw:commentRss>http://todepoint.com/blog/2008/04/10/glossy-buttons-in-pure-as3-code/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>ResizeManager &#8211; simple scaling engine for MovieClips</title>
		<link>http://todepoint.com/blog/2008/04/01/resizemanager-simple-scaling-engine/</link>
		<comments>http://todepoint.com/blog/2008/04/01/resizemanager-simple-scaling-engine/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 08:48:04 +0000</pubDate>
		<dc:creator>adi</dc:creator>
				<category><![CDATA[action script]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://todepoint.com/blog/?p=44</guid>
		<description><![CDATA[Flash objects (SWF) can fill the entire Html body, and scale along with browser window as you resize it (it&#8217;s done by setting width and height attributes to 100% in the embed tags). However unless scaleMode is properly defined as well, the outcome may look surprisingly bad, the flash content may loose proportions and distort, [...]]]></description>
			<content:encoded><![CDATA[<p>Flash objects (SWF) can fill the entire Html body, and scale along with browser window as you resize it (it&#8217;s done by setting <strong>width</strong> and <strong>height</strong> attributes to 100% in the embed tags).  However unless <a herf="http://livedocs.adobe.com/flash/9.0/main/00002154.html" target="_blank" title="scaleMode in Livedocs">scaleMode</a> is properly defined as well, the outcome may look surprisingly bad, the flash content may loose proportions and distort, images quality drops and texts loose readability.. oh man.</p>
<p>Only specific contents should be scaled when the stage is resized, the same way apps handles resizing: an app will redistribute its panels without scaling them, will scale panel background but not the buttons and the controls in it. When the entire stage is simply scaled, the interface balance is disturbed.. and we don&#8217;t want that.</p>
<p>So I decided to share: <strong>ResizeManager</strong> (<a href="http://www.todepoint.com/adi/as_examples/ResizeManager/com.zip" title="Download ResizeManager class">download</a>) is a very simple scaling engine, a single AS2 class that can easily be modified or extended for your needs.<br />
The manger can control <strong>scaling</strong> and some basic <strong>align</strong> options of MovieClips you register to it, so you can scale a background MovieClip to cover the entire stage, and keep another MovieClip centered without scaling. It also adds default definitions for the Stage behavior (scaleMode: noScale, stageAlign: TL), though you can change those.<br />
In order to use it, simply import the class and create an instance of the ResizeManager:<br />
<code><br />
import com.adifeiwel.custom_ui.ResizeManager;</p>
<p>var rm = new ResizeManager();<br />
</code></p>
<p>Then, use method <strong>registerMC()</strong> to register each MovieClip you want to control (including MovieClips nested within MovieClips, make sure parent MC is x:0, y:0), the registerMC method expects the following parameters:<br />
 <code><strong>_parentName</strong>:MovieClip</code> (the name of the MoviClip)<br />
 <code><strong>_widthUpdate</strong>:Number</code> (scaling in percentage from Stage.width, 0 for no-scale)<br />
 <code><strong>_heightUpdate</strong>:Number</code> (scaling in percentage from Stage.height, 0 for no-scale)<br />
 <code><strong>_centerUpdate</strong>:Boolean</code> (align MovieClip to center of stage)<br />
 <code><strong>_middleUpdate</strong>:Boolean</code> (vertical-align MovieClip to middle of stage)</p>
<p>for example (<a href="http://www.todepoint.com/adi/as_examples/ResizeManager/" target="_blank" title="ResizeManager example" alt="ResizeManager example">see it here</a>):<br />
<code><br />
rm.registerMC(portMC.mainBG, 100, 100, false, false);<br />
// will scale to cover all Stage</p>
<p>rm.registerMC(portMC.middleMC.middleBG, 100, 0, false, false);<br />
// will scale to take 100% of Stage.width</p>
<p>rm.registerMC(portMC.middleMC.middleContentMC, 0, 0, true, false);<br />
// aligned to center</p>
<p>rm.registerMC(portMC.transMC, 0, 0, true, true);<br />
// aligned to center, vertical-align to middle.</p>
<p>rm.registerMC(portMC.vClip, 0, 80, false, false);<br />
// will scale to take 80% of Stage.height<br />
</code></p>
<p>enjoy : )</p>
<p><strong>Update:</strong> You can <a href="http://www.todepoint.com/adi/as_examples/ResizeManager/scaleable01.fla.zip" title="download ResizeManager FLA example" alt="download ResizeManager FLA example">download the example FLA here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://todepoint.com/blog/2008/04/01/resizemanager-simple-scaling-engine/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Hunting swf memory issues &#8211; take &#8216;em down!</title>
		<link>http://todepoint.com/blog/2007/11/06/hunting-swf-memory-issues-take-em-down/</link>
		<comments>http://todepoint.com/blog/2007/11/06/hunting-swf-memory-issues-take-em-down/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 13:16:07 +0000</pubDate>
		<dc:creator>adi</dc:creator>
				<category><![CDATA[action script]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://todepoint.com/blog/?p=38</guid>
		<description><![CDATA[In one of my current projects I&#8217;m experiencing a &#8216;memory waste&#8217; issue, after a basic efficiency re-writing did not solve the problem, I began reading about how flash handles scope chains and memory, and found this very interesting article &#8216;Scope Chain and Memory waste in Flash MX&#8216; by Timothée Groleau.Now I am going to re-attack [...]]]></description>
			<content:encoded><![CDATA[<p>In one of my current projects I&#8217;m experiencing a &#8216;memory waste&#8217; issue, after a basic efficiency re-writing did not solve the problem, I began reading about how flash handles scope chains and memory, and found this very interesting article &#8216;<a href="http://timotheegroleau.com/Flash/articles/scope_chain.htm" target="_blank">Scope Chain and Memory waste in Flash MX</a>&#8216;  by Timothée Groleau.Now I am going to re-attack the issue with better understanding of what to look for. thanks Timothée.Another good resource to refine your coding practice is <a href="http://www.adobe.com/devnet/flash/articles/as_bestpractices_print.html" target="_blank">Adobe&#8217;s AS2 best practice article</a>.Be ware, avoid driving after reading these two : )</p>
]]></content:encoded>
			<wfw:commentRss>http://todepoint.com/blog/2007/11/06/hunting-swf-memory-issues-take-em-down/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash &#8211; Highlighting a string in a textfield</title>
		<link>http://todepoint.com/blog/2007/08/09/flash-highlighting-a-string-in-a-textfield/</link>
		<comments>http://todepoint.com/blog/2007/08/09/flash-highlighting-a-string-in-a-textfield/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 22:12:41 +0000</pubDate>
		<dc:creator>adi</dc:creator>
				<category><![CDATA[action script]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[Contribution]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://todepoint.com/blog/?p=30</guid>
		<description><![CDATA[Jack Doyle at greensock shared a really cool AS2 class he calls &#8216;TextMetrics&#8217; &#8211; sounds promising ha?The class calculates x/y coordinates of a string in a textfield, allowing highlighting it or calculating rows width.. nice.Check out his example. Thanks Jack!]]></description>
			<content:encoded><![CDATA[<p>Jack Doyle at <a href="http://blog.greensock.com/" target="_blank">greensock</a> shared a really cool AS2 class he calls &#8216;TextMetrics&#8217; &#8211; sounds promising ha?The class calculates x/y coordinates of a string in a textfield, allowing highlighting it or calculating rows width.. nice.Check out his <a href="http://blog.greensock.com/textmetrics/" target="_blank">example</a>. Thanks Jack!</p>
]]></content:encoded>
			<wfw:commentRss>http://todepoint.com/blog/2007/08/09/flash-highlighting-a-string-in-a-textfield/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

