<?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"
	>

<channel>
	<title></title>
	<atom:link href="http://blog.wisebisoft.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.wisebisoft.com</link>
	<description></description>
	<pubDate>Sun, 30 Nov 2008 23:25:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>Connection Timed Out - Debugger</title>
		<link>http://blog.wisebisoft.com/2008/12/01/flex-debugger-timed-out/</link>
		<comments>http://blog.wisebisoft.com/2008/12/01/flex-debugger-timed-out/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 23:08:07 +0000</pubDate>
		<dc:creator>Biro Barna</dc:creator>
		
		<category><![CDATA[Flex Builder 3 Professional]]></category>

		<guid isPermaLink="false">http://blog.wisebisoft.com/?p=87</guid>
		<description><![CDATA[Hi everyone,  
After formatting my laptop a few days ago I was quite surprised to see that whenever I tried debugging my Flex application, the debugger simply wouldn&#8217;t connect and it kept throwing an annoying &#8220;Connection Timed Out!&#8221; warning. At first, I thought that the problem might be caused by the tons of additional [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everyone,  </p>
<p>After formatting my laptop a few days ago I was quite surprised to see that whenever I tried debugging my Flex application, the debugger simply wouldn&#8217;t connect and it kept throwing an annoying &#8220;Connection Timed Out!&#8221; warning. At first, I thought that the problem might be caused by the tons of additional plug-ins I installed &#8220;for fun and out of curiosity&#8221; but the problem seemed to persist even after I uninstalled Flex and installed it again.  That&#8217;s when I really became curious, so I started surfing on Google in hope of a solution&#8230; Surprisingly the first link I ran over was exactly what I was looking for ( lucky me&#8230; hehe )&#8230; I never experienced this probleme before but thank God it&#8217;s a 2 seconds fix ( I took the risk to borrow the images I&#8217;ll be posting from the other blog: <a href="http://therush.wordpress.com/2008/03/11/resolved-flex-builder-3-debugger-stopped-working/" target="_blank">my saviour</a> and I hope that no one will &#8220;stone me&#8221; because of this ).  </p>
<p><strong>SOLUTION:</strong> Hit F11 to start the debugger, once the browser window opens, right click somewhere inside the content area and select &#8220;Debugger&#8221; from the menu list:  </p>
<p><img src="http://therush.files.wordpress.com/2008/03/debugger_in_menu.gif" alt="null" /></p>
<p>After clicking on &#8220;Debugger&#8221; you&#8217;ll see a pop-up with some options. Check the &#8220;Other Machine&#8221; radio button and fill the input field with the IP address of the machine you are currently on:  </p>
<p><img src="http://therush.files.wordpress.com/2008/03/debugger_setting.gif" alt="null" /> </p>
<p>After all that is done, simply close the current browser window and hit F11 once again ( from inside Flex, obviously ). This time, everything should be working just fine, the debugger should be back online and tracing whatever it has to trace.  </p>
<p>A really simple and fast fix.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wisebisoft.com/2008/12/01/flex-debugger-timed-out/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using DataGrid headerRenderer</title>
		<link>http://blog.wisebisoft.com/2008/11/01/using-datagrid-headerrenderer/</link>
		<comments>http://blog.wisebisoft.com/2008/11/01/using-datagrid-headerrenderer/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 18:50:18 +0000</pubDate>
		<dc:creator>Biro Barna</dc:creator>
		
		<category><![CDATA[Flex Builder 3 Professional]]></category>

		<guid isPermaLink="false">http://blog.wisebisoft.com/?p=74</guid>
		<description><![CDATA[I helped a friend of mine with a project of his recently and we were having some problems with the DataGridColumn&#8217;s headerRenderer property. We finally got it working but I thought that I&#8217;ll post the solution so that others won&#8217;t waste hours with this.
One more thing that I&#8217;d like to mention before I post the [...]]]></description>
			<content:encoded><![CDATA[<p>I helped a friend of mine with a project of his recently and we were having some problems with the DataGridColumn&#8217;s headerRenderer property. We finally got it working but I thought that I&#8217;ll post the solution so that others won&#8217;t waste hours with this.</p>
<p>One more thing that I&#8217;d like to mention before I post the source files and a simple example to demonstrate the final result: DON&#8217;T USE FLEX 2 !!! UPGRADE TO FLEX 3 !!! During this project, I was using Flex 3 and my friend was using Flex 2&#8230; All that I can say is that the experience was horrible !!! I got the thing working in Flex 3 in no time but Flex 2&#8230; huh, now that was a pain in the butt. I finally ended up redoing the whole thing in Flex 2 so I can sort out the stupid errors Flex 2 was throwing at us about &#8220;you can&#8217;t use Binding for static variables&#8221; ( which I couldn&#8217;t remember being so&#8230; but it seems that my memory was playing tricks on me ) and other really annoying bugs ( example: the area beneath the arrow was a &#8220;dead spot&#8221;, so we ended up wrapping the Image and Label in a second HBox component which we have set as the hitArea for the main HBox component&#8230; really weird. ).</p>
<p>Again, DON&#8217;T USE FLEX 2, sell your car, your socks or whatever and get your hands on FLEX 3 ( It&#8217;s totally worth it ) !!! The example itself is simple, we replaced the header with a HBox custom component which has an Image component inside of it and a Label to display some text. The goal was to change the arrow from UP to DOWN on each header click, simple but it turned out to be quite frustrating .</p>
<p>Ok, enough of that, source files can be found here: <a href="http://blog.wisebisoft.com/wp-content/uploads/headerRenderer/DataGridTest.zip" target="_self">DataGrid Header Rendering</a></p>
<p>And here&#8217;s the final result too ( obviously, I &#8220;scaled it down&#8221; because the project itself was way bigger and we obviously wasn&#8217;t allowed to use it for other purposes or post it&#8217;s source code ):</p>

<object	type="application/x-shockwave-flash"
			data="http://blog.wisebisoft.com/wp-content/uploads/headerRenderer/DataGridTest.swf"
			width="535"
			height="300">
	<param name="movie" value="http://blog.wisebisoft.com/wp-content/uploads/headerRenderer/DataGridTest.swf" />
</object>
<p><br/><strong>EDIT:</strong> This method only works for the simple DataGrid component. If you want it to work with multiple sorting and you go with the AdvancedDataGrid component then you must rethink the solution, otherwise all your headers will always display the same UP or DOWN arrow ( due to the static counter variable I&#8217;ve used to alternate between the UP and DOWN arrow ).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wisebisoft.com/2008/11/01/using-datagrid-headerrenderer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Advanced Flex 3 Contact Form</title>
		<link>http://blog.wisebisoft.com/2008/10/26/advanced-flex-3-contact-form/</link>
		<comments>http://blog.wisebisoft.com/2008/10/26/advanced-flex-3-contact-form/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 11:16:40 +0000</pubDate>
		<dc:creator>Biro Barna</dc:creator>
		
		<category><![CDATA[Flex Builder 3 Professional]]></category>

		<guid isPermaLink="false">http://blog.wisebisoft.com/?p=62</guid>
		<description><![CDATA[To make things a bit different, I decided to create a Flex 3 Contact form just to show all the &#8220;anti-Flex&#8221; people out there that Flex is not only for hardcore development and ugly graphics. With a bit of effort and time, anyone can produce really good looking applications in Flex Builder too ( and [...]]]></description>
			<content:encoded><![CDATA[<p>To make things a bit different, I decided to create a Flex 3 Contact form just to show all the &#8220;anti-Flex&#8221; people out there that Flex is not only for hardcore development and ugly graphics. With a bit of effort and time, anyone can produce really good looking applications in Flex Builder too ( and I didn&#8217;t even bother using graphics with this example, I only edited the look of the component and I think that the results is quite good ).</p>
<p>Final result ( sneak peek ):</p>
<p><img alt="" src="http://blog.wisebisoft.com/wp-content/uploads/flex3_contact_form.jpg" title="Advanced Flex 3 Contact Form" class="alignleft" width="500" height="560" /></p>
<p>I didn&#8217;t want to complicate stuff to badly with this example, my goal was to create a good looking and clean Flex 3 contact form ( I&#8217;m sure that many of you guys out there are really bored of all those simple Flash contact forms ) and obviously, to add more &#8220;advanced&#8221; features. To spice things up a bit, I played around with Shared Objects too. Once the user sends the E-mail he&#8217;ll be provided with an option &#8220;Save personal information or Not&#8221;. Ok, what does this do ? Well, it simply creates a shared object and stores your personal information on your computer for later use. This way, whenever you open your PC and visit this site, you&#8217;ll always have certain fields filled out, saving you time.</p>
<p>Obviously, this can be done more complexly too, shared objects aren&#8217;t really hard to use but it&#8217;s a decent example on how to use them and once you understand how they work then you can experiment with your own stuff ( for example: create a shared object for your games so that when users revisit the game then they&#8217;ll already have the Name filled out&#8230; or any other features ), it&#8217;s really up to everyone&#8217;s imagination.</p>
<p>The working example can be viewed here: <a href="http://www.wisebisoft.com/_experiments/AdvancedContactForm/AdvancedContactForm.html" target="_blank">Working Example</a><br />
You can download the source files from here: <a href="http://blog.wisebisoft.com/wp-content/uploads/AdvancedContactForm.zip">Advanced Flex 3 Contact Form</a></p>
<p>Of course, the source files contain both .mxml and .php files that were used when I created the example. I really hate downloading examples that are only partially working ( although they have their ups and down ) so I decided to always provide all my files when posting an example so that anyone can easily play around with it and hopefully learn something from my examples.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wisebisoft.com/2008/10/26/advanced-flex-3-contact-form/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simple Flex 3 File Downloader</title>
		<link>http://blog.wisebisoft.com/2008/10/26/simple-flex-3-file-downloader/</link>
		<comments>http://blog.wisebisoft.com/2008/10/26/simple-flex-3-file-downloader/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 10:36:53 +0000</pubDate>
		<dc:creator>Biro Barna</dc:creator>
		
		<category><![CDATA[Flex Builder 3 Professional]]></category>

		<guid isPermaLink="false">http://blog.wisebisoft.com/?p=51</guid>
		<description><![CDATA[The title kinda says it all. Here&#8217;s a simple example on how to track the progress of a downloading file with Flex 3. The cool thing about this example is that it can be easily reproduced to work in CS3 ( or CS4 ) too. The code part is essentially the same just that in [...]]]></description>
			<content:encoded><![CDATA[<p>The title kinda says it all. Here&#8217;s a simple example on how to track the progress of a downloading file with Flex 3. The cool thing about this example is that it can be easily reproduced to work in CS3 ( or CS4 ) too. The code part is essentially the same just that in CS3 you can create your own progress bar and update that instead of the progress bar component ( that I&#8217;ve used with Flex 3 ).</p>
<p>This little file downloader can come really handy when your visitors are downloading larger files. You can keep your visitor busy with some interactive animations while the file is downloading and at the same time you&#8217;ll have a progress bar telling your visitor how long must he wait until the download is complete.</p>
<p>The working example can be viewed here: <a href="http://www.wisebisoft.com/_experiments/FileDownloader/FileDownloader.html" target="_blank">Working Example</a><br />
You can download the source code from here: <a href="http://blog.wisebisoft.com/wp-content/uploads/FileDownloader.zip">Flex 3 File Downloader</a></p>
<p>Simply copy-paste the code into a new Flex 3 Project and make sure that you have a folder called &#8220;assets&#8221; in your source folder and inside your &#8220;assets&#8221; folder, you have an mp.3 file called &#8220;example.mp3&#8243;. Simple as that.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wisebisoft.com/2008/10/26/simple-flex-3-file-downloader/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ease and Blur in AS 3.0</title>
		<link>http://blog.wisebisoft.com/2008/10/26/ease-and-blur-in-as-30/</link>
		<comments>http://blog.wisebisoft.com/2008/10/26/ease-and-blur-in-as-30/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 10:02:37 +0000</pubDate>
		<dc:creator>Biro Barna</dc:creator>
		
		<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://blog.wisebisoft.com/?p=44</guid>
		<description><![CDATA[This is a simple example on how to apply easing and blur to an object.
The code is fairly simple, I just created a container that will hold our text field ( I don&#8217;t like working on object directly so I usually add each and every object into a container ), I defined a simple TextFormat [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple example on how to apply easing and blur to an object.</p>
<p>The code is fairly simple, I just created a container that will hold our text field ( I don&#8217;t like working on object directly so I usually add each and every object into a container ), I defined a simple TextFormat to format our text and added everything to the stage. Once all this was done, I simply added an ENTER_FRAME event listener to the stage that will handle all the easing and blurring ( this is the essential part since this function has all the math that handles the easing ).</p>
<p>The example can be downloaded from here: <a href="http://blog.wisebisoft.com/wp-content/uploads/EaseAndBlur.zip">Ease And Blur</a></p>
<p>The source code looks like this ( obviously, the MainClass class is set as a Document Class ):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">package</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">Sprite</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">MovieClip</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">StageAlign</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">StageScaleMode</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">events</span>.<span style="color: #660066;">Event</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">text</span>.<span style="color: #660066;">TextField</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">text</span>.<span style="color: #660066;">TextFieldAutoSize</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">text</span>.<span style="color: #660066;">TextFormat</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">text</span>.<span style="color: #660066;">TextFormatAlign</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">text</span>.<span style="color: #660066;">AntiAliasType</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">filters</span>.<span style="color: #660066;">BlurFilter</span>;
&nbsp;
	<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">class</span> MainClass <span style="color: #003366; font-weight: bold;">extends</span> Sprite
	<span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> container<span style="color: #339933;">:</span>Sprite;			<span style="color: #006600; font-style: italic;">// container that holds the text field</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> tf<span style="color: #339933;">:</span>TextField;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> easeFactor<span style="color: #339933;">:</span>Number <span style="color: #339933;">=</span> .2;		<span style="color: #006600; font-style: italic;">// amount of easing</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> MainClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// set stage properties</span>
			stage.<span style="color: #660066;">scaleMode</span> <span style="color: #339933;">=</span> StageScaleMode.<span style="color: #660066;">NO_SCALE</span>;
			stage.<span style="color: #660066;">showDefaultContextMenu</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span>;
			stage.<span style="color: #660066;">align</span> <span style="color: #339933;">=</span> StageAlign.<span style="color: #660066;">LEFT</span>;
&nbsp;
			init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// create a text format for your text field</span>
			<span style="color: #003366; font-weight: bold;">var</span> tFormat<span style="color: #339933;">:</span>TextFormat <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> TextFormat<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			tFormat.<span style="color: #660066;">font</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Arial&quot;</span>;
			tFormat.<span style="color: #660066;">bold</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span>;
			tFormat.<span style="color: #660066;">color</span> <span style="color: #339933;">=</span> 0x000000;
			tFormat.<span style="color: #660066;">size</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">36</span>;
			tFormat.<span style="color: #660066;">align</span> <span style="color: #339933;">=</span> TextFormatAlign.<span style="color: #660066;">LEFT</span>;
&nbsp;
			<span style="color: #006600; font-style: italic;">// create the text field</span>
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> TextField<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">autoSize</span> <span style="color: #339933;">=</span> TextFieldAutoSize.<span style="color: #660066;">LEFT</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">selectable</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">multiline</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">text</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Wisebisoft&quot;</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">antiAliasType</span> <span style="color: #339933;">=</span> AntiAliasType.<span style="color: #660066;">ADVANCED</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">sharpness</span> <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">400</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">setTextFormat</span><span style="color: #009900;">&#40;</span>tFormat<span style="color: #009900;">&#41;</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> <span style="color: #339933;">-</span>Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">width</span> <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> <span style="color: #339933;">-</span>Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">height</span> <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span>;
&nbsp;
			<span style="color: #006600; font-style: italic;">// create a container that will hold the text field</span>
			<span style="color: #006600; font-style: italic;">// and add an ENTER_FRAME event listener that </span>
			<span style="color: #006600; font-style: italic;">// will handle the easing and blurring</span>
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Sprite<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">mouseChildren</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span>;
			addChild<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">addChild</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span><span style="color: #009900;">&#41;</span>;
&nbsp;
			stage.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>Event.<span style="color: #660066;">ENTER_FRAME</span><span style="color: #339933;">,</span> eventFrameHandler<span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> eventFrameHandler<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>Event<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>mouseX <span style="color: #339933;">!=</span> 0 <span style="color: #339933;">&amp;&amp;</span> mouseY <span style="color: #339933;">!=</span> 0<span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #003366; font-weight: bold;">var</span> mouse_xpos<span style="color: #339933;">:</span>Number <span style="color: #339933;">=</span> mouseX;
				<span style="color: #003366; font-weight: bold;">var</span> mouse_ypos<span style="color: #339933;">:</span>Number <span style="color: #339933;">=</span> mouseY;
&nbsp;
				<span style="color: #006600; font-style: italic;">// calculate new position</span>
				mouse_xpos <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">x</span>;
				mouse_xpos <span style="color: #339933;">-=</span> <span style="color: #009900;">&#40;</span>mouse_xpos <span style="color: #339933;">-</span> mouseX<span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">easeFactor</span>;
				mouse_ypos <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">y</span>;
				mouse_ypos <span style="color: #339933;">-=</span> <span style="color: #009900;">&#40;</span>mouse_ypos <span style="color: #339933;">-</span> mouseY<span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">easeFactor</span>;
&nbsp;
				<span style="color: #006600; font-style: italic;">// update positions and apply a blur filter</span>
				<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> mouse_xpos;
				<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> mouse_ypos;
				<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tf</span>.<span style="color: #660066;">filters</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #003366; font-weight: bold;">new</span> BlurFilter<span style="color: #009900;">&#40;</span>Math.<span style="color: #660066;">abs</span><span style="color: #009900;">&#40;</span>mouse_xpos <span style="color: #339933;">-</span> mouseX<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> Math.<span style="color: #660066;">abs</span><span style="color: #009900;">&#40;</span>mouse_ypos <span style="color: #339933;">-</span> mouseY<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span>;
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000066; font-weight: bold;">else</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span>stage.<span style="color: #660066;">stageWidth</span> <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span>;
				<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span>stage.<span style="color: #660066;">stageHeight</span> <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Here&#8217;s the final result ( working example ):</p>

<object	type="application/x-shockwave-flash"
			data="http://blog.wisebisoft.com/wp-content/uploads/EaseAndBlur.swf"
			width="535"
			height="300">
	<param name="movie" value="http://blog.wisebisoft.com/wp-content/uploads/EaseAndBlur.swf" />
</object>
]]></content:encoded>
			<wfw:commentRss>http://blog.wisebisoft.com/2008/10/26/ease-and-blur-in-as-30/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simple Drag in AS 3.0</title>
		<link>http://blog.wisebisoft.com/2008/10/25/simple-drag-in-as-30/</link>
		<comments>http://blog.wisebisoft.com/2008/10/25/simple-drag-in-as-30/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 16:53:32 +0000</pubDate>
		<dc:creator>Biro Barna</dc:creator>
		
		<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://blog.wisebisoft.com/?p=38</guid>
		<description><![CDATA[Here&#8217;s a really simple and fast example on how to use Drag in ActionScript 3.0. Not much has changed since ActionScript 2.0 when it comes to dragging objects around, just that now, things are much easier to use and we can write much more organized code when taking advantage of ActionScript 3.0&#8217;s OOP features.
MainClass.as which [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a really simple and fast example on how to use Drag in ActionScript 3.0. Not much has changed since ActionScript 2.0 when it comes to dragging objects around, just that now, things are much easier to use and we can write much more organized code when taking advantage of ActionScript 3.0&#8217;s OOP features.</p>
<p>MainClass.as which is set as a Document Class:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">package</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">import</span> com.<span style="color: #660066;">wisebisoft</span>.<span style="color: #660066;">CustomCircle</span>;
&nbsp;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">Sprite</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">StageAlign</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">StageScaleMode</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">events</span>.<span style="color: #660066;">MouseEvent</span>;
&nbsp;
	<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">class</span> MainClass <span style="color: #003366; font-weight: bold;">extends</span> Sprite
	<span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> MainClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			stage.<span style="color: #660066;">scaleMode</span> <span style="color: #339933;">=</span> StageScaleMode.<span style="color: #660066;">NO_SCALE</span>;
			stage.<span style="color: #660066;">showDefaultContextMenu</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span>;
			stage.<span style="color: #660066;">align</span> <span style="color: #339933;">=</span> StageAlign.<span style="color: #660066;">LEFT</span>;
&nbsp;
			init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>			
			<span style="color: #003366; font-weight: bold;">var</span> circle<span style="color: #339933;">:</span>CustomCircle <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> CustomCircle<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">100</span><span style="color: #339933;">,</span> 0x000000<span style="color: #009900;">&#41;</span>;
			circle.<span style="color: #660066;">buttonMode</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span>;
			circle.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">280</span>; circle.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">200</span>;
			circle.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_DOWN</span><span style="color: #339933;">,</span> startDragHandler<span style="color: #009900;">&#41;</span>;
			circle.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_UP</span><span style="color: #339933;">,</span> stopDragHandler<span style="color: #009900;">&#41;</span>;
			addChild<span style="color: #009900;">&#40;</span>circle<span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> startDragHandler<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>MouseEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			event.<span style="color: #660066;">target</span>.<span style="color: #660066;">startDrag</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> stopDragHandler<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>MouseEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			event.<span style="color: #660066;">target</span>.<span style="color: #660066;">stopDrag</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>CustomCircle.as which is just a simple class that draws our custom circle which we&#8217;ll be interacting with:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">package</span> com.<span style="color: #660066;">wisebisoft</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">Sprite</span>;
&nbsp;
	<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">class</span> CustomCircle <span style="color: #003366; font-weight: bold;">extends</span> Sprite
	<span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> CustomCircle<span style="color: #009900;">&#40;</span>radius<span style="color: #339933;">:</span>Number<span style="color: #339933;">,</span> color<span style="color: #339933;">:</span>uint<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			drawCircle<span style="color: #009900;">&#40;</span>radius<span style="color: #339933;">,</span> color<span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> drawCircle<span style="color: #009900;">&#40;</span>radius<span style="color: #339933;">:</span>Number<span style="color: #339933;">,</span> color<span style="color: #339933;">:</span>uint<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">graphics</span>.<span style="color: #660066;">beginFill</span><span style="color: #009900;">&#40;</span>color<span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">graphics</span>.<span style="color: #660066;">drawCircle</span><span style="color: #009900;">&#40;</span>0<span style="color: #339933;">,</span> 0<span style="color: #339933;">,</span> radius<span style="color: #009900;">&#41;</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">graphics</span>.<span style="color: #660066;">endFill</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Of course, you can download the example from here: <a href="http://blog.wisebisoft.com/wp-content/uploads/SimpleDrag.zip">Simple Drag</a></p>

<object	type="application/x-shockwave-flash"
			data="http://blog.wisebisoft.com/wp-content/uploads/SimpleDrag.swf"
			width="535"
			height="300">
	<param name="movie" value="http://blog.wisebisoft.com/wp-content/uploads/SimpleDrag.swf" />
</object>
]]></content:encoded>
			<wfw:commentRss>http://blog.wisebisoft.com/2008/10/25/simple-drag-in-as-30/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Reusable AS 3.0 ScrollBar Class</title>
		<link>http://blog.wisebisoft.com/2008/10/25/reusable-as-30-scrollbar-class/</link>
		<comments>http://blog.wisebisoft.com/2008/10/25/reusable-as-30-scrollbar-class/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 11:32:05 +0000</pubDate>
		<dc:creator>Biro Barna</dc:creator>
		
		<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://blog.wisebisoft.com/?p=3</guid>
		<description><![CDATA[Hi everyone and welcome to the newly launched Wisebisoft WebLog.
If you have been visiting the old blog then you know that I had a reusable ActionScript 3.0 scrollbar class there which was a kinda out of date. Although I created a new version, I decided not to upload it there but wait until this new [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everyone and welcome to the newly launched Wisebisoft WebLog.</p>
<p>If you have been visiting the old blog then you know that I had a reusable ActionScript 3.0 scrollbar class there which was a kinda out of date. Although I created a new version, I decided not to upload it there but wait until this new WebLog is launched.</p>
<p>I didn&#8217;t bother adding fancy graphics to it but of course it can be done. The scrollbar has additional features too that can be disabled or enabled, one such feature is the &#8220;blurring feature&#8221; which will blur the content on scroll. You can play around with these features yourself and even add new ones if you like.</p>
<p>You can download the working example from here: <a href="http://blog.wisebisoft.com/wp-content/uploads/CustomScrollbar.zip">Custom ScrollBar</a></p>
<p>Here&#8217;s the source code of the class:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">package</span> com.<span style="color: #660066;">wisebisoft</span>.<span style="color: #660066;">widgets</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">MovieClip</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">Stage</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">events</span>.<span style="color: #660066;">Event</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">events</span>.<span style="color: #660066;">EventPhase</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">events</span>.<span style="color: #660066;">MouseEvent</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">filters</span>.<span style="color: #660066;">BitmapFilterQuality</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">filters</span>.<span style="color: #660066;">BlurFilter</span>;
	<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">geom</span>.<span style="color: #660066;">Rectangle</span>;
&nbsp;
	<span style="color: #006600; font-style: italic;">/**
	 * 
	 * Author: Biro Barna ( http://www.wisebisoft.com/ )
	 * Created on: Wednesday, September 03, 2008, 4:22 AM (GTM +2:00) Minsk
	 * Description: Reusable ActionScript 3.0 ScrollBar class
	 * Usage: Simply instantiate the class and pass all the 5 required arguments ( and you can set 6 additional properties too ).
	 * Example: new CustomScrollBar(stage, content_mc, content_mask, scroll_track, scroll_btn, true, true, true, true, .2, 5);
	 * 
	 * ---------------- ONLY 5 PARAMETERS ARE REQUIRED FOR THE CLASS TO FUNCTION ----------------------
	 * 
	 * -- stage -- is your Stage object, it will help you prevent people from messing up certain features
	 * -- content_mc -- is the movie clip holding the content that you want to scroll
	 * -- content_mask -- is the movie clip that you'll use to mask content_mc movie clip
	 * -- scroll_track -- is the movie clip that plays the role of a track for the scroll_btn
	 * -- scroll_btn -- is the button that you can click + hold and drag to scroll your content_mc movie clip
	 * 
	 * -- -------------- ALL THE PARAMETERS AFTER THE 5TH PARAMETER ARE OPTIONAL ---------------------------------------
	 * 
	 * -- the following 4 parameters in the line enable or disable certain features like mouse wheel scrolling or blurring
	 * -- .3 -- is the easing that will be added to the content_mc movie clip; the lower the value is the more easing is applied
	 * -- 10 -- is the number of pixels the scroll_btn will move on the Y axis each time you scroll with the mouse wheel
	 * 
	 * */</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">class</span> CustomScrollBar
	<span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> content<span style="color: #339933;">:</span>MovieClip;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> contentMask<span style="color: #339933;">:</span>MovieClip;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> scrollTrack<span style="color: #339933;">:</span>MovieClip;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> scrollButton<span style="color: #339933;">:</span>MovieClip;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> useMouseWheel<span style="color: #339933;">:</span>Boolean;			<span style="color: #006600; font-style: italic;">// helps you enable or disable the mouse wheel scrolling feature</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> enableJumping<span style="color: #339933;">:</span>Boolean;			<span style="color: #006600; font-style: italic;">// helps you enable or disable the &quot;jumping feature&quot;</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> buttonModeEnabled<span style="color: #339933;">:</span>Boolean;		<span style="color: #006600; font-style: italic;">// helps you enable or disable the scroll button's buttonMode property</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> easing<span style="color: #339933;">:</span>Number;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> scrollSpeed<span style="color: #339933;">:</span>Number;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> moveValue<span style="color: #339933;">:</span>Number;				<span style="color: #006600; font-style: italic;">// helps calculate the final moveSpeed value</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> moveSpeed<span style="color: #339933;">:</span>Number;				<span style="color: #006600; font-style: italic;">// the speed with which the content will be scrolled</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> currentContentY<span style="color: #339933;">:</span>Number;			<span style="color: #006600; font-style: italic;">// stores the current position of the content movie clip</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> scrollTrackScaleY<span style="color: #339933;">:</span>Number;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> contentHeight<span style="color: #339933;">:</span>Number;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> scrollTrackHeight<span style="color: #339933;">:</span>Number;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> scrollButtonHeight<span style="color: #339933;">:</span>Number;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> contentMaskHeight<span style="color: #339933;">:</span>Number;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> movieStage<span style="color: #339933;">:</span>Stage;
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> enterFrameActive<span style="color: #339933;">:</span>Boolean;		<span style="color: #006600; font-style: italic;">// it &quot;signals&quot; if the ENTER_FRAME event has been triggered or not</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> allowRemove<span style="color: #339933;">:</span>Boolean;			<span style="color: #006600; font-style: italic;">// helps your function know when it is allowed to remove the ENTER_FRAME event</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> blurEnabled<span style="color: #339933;">:</span>Boolean;			<span style="color: #006600; font-style: italic;">// enables or disables content blur on scroll</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// CLASS CONSTRUCTOR //</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> CustomScrollBar<span style="color: #009900;">&#40;</span>
&nbsp;
							movieStage<span style="color: #339933;">:</span>Stage<span style="color: #339933;">,</span>
							content<span style="color: #339933;">:</span>MovieClip<span style="color: #339933;">,</span>
							contentMask<span style="color: #339933;">:</span>MovieClip<span style="color: #339933;">,</span> 
							scrollTrack<span style="color: #339933;">:</span>MovieClip<span style="color: #339933;">,</span>
							scrollButton<span style="color: #339933;">:</span>MovieClip<span style="color: #339933;">,</span>
							useMouseWheel<span style="color: #339933;">:</span>Boolean <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>		<span style="color: #006600; font-style: italic;">// mouse wheel scrolling is by default: ENABLED</span>
							enableJumping<span style="color: #339933;">:</span>Boolean <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>		<span style="color: #006600; font-style: italic;">// the &quot;jumping feature&quot; is by default: ENABLED</span>
							buttonModeEnabled<span style="color: #339933;">:</span>Boolean <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>	<span style="color: #006600; font-style: italic;">// scroll button's buttonMode property is by default: ENABLED</span>
							blurEnabled<span style="color: #339933;">:</span>Boolean <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>		<span style="color: #006600; font-style: italic;">// content blurring on scroll event is by default: DISABLED</span>
							easing<span style="color: #339933;">:</span>Number <span style="color: #339933;">=</span> .15<span style="color: #339933;">,</span>				<span style="color: #006600; font-style: italic;">// easing speed is by default set to: .15</span>
							scrollSpeed<span style="color: #339933;">:</span>Number <span style="color: #339933;">=</span> <span style="color: #CC0000;">5</span>				<span style="color: #006600; font-style: italic;">// scrolling speed is be default set to: 5</span>
&nbsp;
						   <span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// store certain properties of the objects passed to the class constructor</span>
			<span style="color: #006600; font-style: italic;">// in specific variables, increasing performance at the same time</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">content</span> <span style="color: #339933;">=</span> content;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">contentMask</span> <span style="color: #339933;">=</span> contentMask;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">scrollTrack</span> <span style="color: #339933;">=</span> scrollTrack;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">scrollButton</span> <span style="color: #339933;">=</span> scrollButton;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">useMouseWheel</span> <span style="color: #339933;">=</span> useMouseWheel;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">enableJumping</span> <span style="color: #339933;">=</span> enableJumping;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buttonModeEnabled</span> <span style="color: #339933;">=</span> buttonModeEnabled;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">blurEnabled</span> <span style="color: #339933;">=</span> blurEnabled;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">easing</span> <span style="color: #339933;">=</span> easing;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">scrollSpeed</span> <span style="color: #339933;">=</span> scrollSpeed;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">movieStage</span> <span style="color: #339933;">=</span> movieStage;
&nbsp;
			setHeights<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			setButtonMode<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			setContentMask<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			storeTrackScaleY<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			repositionObjects<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			addListeners<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// store the height of your objects</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> setHeights<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			contentHeight <span style="color: #339933;">=</span> content.<span style="color: #660066;">height</span>;
			contentMaskHeight <span style="color: #339933;">=</span> contentMask.<span style="color: #660066;">height</span>;
			scrollTrackHeight <span style="color: #339933;">=</span> scrollTrack.<span style="color: #660066;">height</span>;
			scrollButtonHeight <span style="color: #339933;">=</span> scrollButton.<span style="color: #660066;">height</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// enable or disable the buttonMode property of your scroll button</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> setButtonMode<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			scrollButton.<span style="color: #660066;">buttonMode</span> <span style="color: #339933;">=</span> buttonModeEnabled;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// apply the mask movie clip to the content movie clip</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> setContentMask<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// cache both the content and content mask so that you'll</span>
			<span style="color: #006600; font-style: italic;">// be able to apply masks that container an alpha channel too</span>
&nbsp;
			content.<span style="color: #660066;">cacheAsBitmap</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span>;
			contentMask.<span style="color: #660066;">cacheAsBitmap</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span>;
			content.<span style="color: #660066;">mask</span> <span style="color: #339933;">=</span> contentMask;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// reposition your objects so that everything will scroll correctly</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> repositionObjects<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			contentMask.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> content.<span style="color: #660066;">x</span>;
			scrollButton.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> scrollTrack.<span style="color: #660066;">x</span>;
			content.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> contentMask.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> scrollTrack.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> scrollButton.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> 0;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// store the scaleY property of the scroll track movie clip</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> storeTrackScaleY<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			scrollTrackScaleY <span style="color: #339933;">=</span> scrollTrack.<span style="color: #660066;">scaleY</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// add all the event listeners that will be handling the scrolling</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> addListeners<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			enterFrameActive <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span>;
&nbsp;
			<span style="color: #006600; font-style: italic;">// check to see if the actual height of the content is more than the</span>
			<span style="color: #006600; font-style: italic;">// height of the content mask; if the content height is less, that means that there</span>
			<span style="color: #006600; font-style: italic;">// is no use for a scroll track and nor for a scroll button, so we'll make them invisible</span>
			<span style="color: #006600; font-style: italic;">// ... otherwise, add all the required listeners that will handle the scrolling</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>contentHeight <span style="color: #339933;">&lt;=</span> contentMaskHeight<span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				scrollTrack.<span style="color: #660066;">visible</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span>;
				scrollButton.<span style="color: #660066;">visible</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span>;
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000066; font-weight: bold;">else</span>
			<span style="color: #009900;">&#123;</span>
				scrollTrack.<span style="color: #660066;">visible</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span>;
				scrollButton.<span style="color: #660066;">visible</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span>;
&nbsp;
				<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>useMouseWheel <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					content.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_WHEEL</span><span style="color: #339933;">,</span> mouseWheelHandler<span style="color: #009900;">&#41;</span>;
				<span style="color: #009900;">&#125;</span>
&nbsp;
				<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>enableJumping <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					scrollTrack.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_DOWN</span><span style="color: #339933;">,</span> scrollTrackMouseHandler<span style="color: #009900;">&#41;</span>;
				<span style="color: #009900;">&#125;</span>
&nbsp;
				scrollButton.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_DOWN</span><span style="color: #339933;">,</span> startDragHandler<span style="color: #009900;">&#41;</span>;
				scrollButton.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_UP</span><span style="color: #339933;">,</span> stopDragHandler<span style="color: #009900;">&#41;</span>;
				movieStage.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_UP</span><span style="color: #339933;">,</span> stopDragHandler<span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// the moveContentHandler function is responsible for moving the content movie clip</span>
		<span style="color: #006600; font-style: italic;">// some easing is added too ( just to make it look better ) and an optional blur filter</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> moveContentHandler<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>Event<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// store the current Y position of the content movie clip</span>
			currentContentY <span style="color: #339933;">=</span> content.<span style="color: #660066;">y</span>;
&nbsp;
			moveValue <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>contentHeight <span style="color: #339933;">-</span> contentMaskHeight<span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span>scrollTrackHeight <span style="color: #339933;">-</span> scrollButtonHeight<span style="color: #009900;">&#41;</span>;
			moveSpeed <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>scrollButton.<span style="color: #660066;">y</span> <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>moveValue<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> content.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> easing;
			content.<span style="color: #660066;">y</span> <span style="color: #339933;">+=</span> moveSpeed;
&nbsp;
			<span style="color: #006600; font-style: italic;">// if blurEnabled is set to &quot;true&quot; then it will apply a blur filter to the movie clip that is holding the content;</span>
			<span style="color: #006600; font-style: italic;">// you can edit the filter parameters so that it will fit your needs; I tried keeping the blurring feature as</span>
			<span style="color: #006600; font-style: italic;">// simple as possible, this feature was intended to be a &quot;fun feature&quot; than something advanced</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>blurEnabled <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				content.<span style="color: #660066;">filters</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #003366; font-weight: bold;">new</span> BlurFilter<span style="color: #009900;">&#40;</span>Math.<span style="color: #660066;">abs</span><span style="color: #009900;">&#40;</span>moveSpeed <span style="color: #339933;">/</span> <span style="color: #CC0000;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> Math.<span style="color: #660066;">abs</span><span style="color: #009900;">&#40;</span>moveSpeed<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> BitmapFilterQuality.<span style="color: #660066;">MEDIUM</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span>;
			<span style="color: #009900;">&#125;</span>
&nbsp;
			removeContentEnterFrame<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// function responsible for moving the scroll button movie clip if the</span>
		<span style="color: #006600; font-style: italic;">// visitor uses the mouse wheel to scroll the content movie clip</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> mouseWheelHandler<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>MouseEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			allowRemove <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span>;
			addContentEnterFrame<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
			scrollButton.<span style="color: #660066;">y</span> <span style="color: #339933;">+=</span> event.<span style="color: #660066;">delta</span> <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>scrollSpeed<span style="color: #009900;">&#41;</span>;
&nbsp;
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>scrollButton.<span style="color: #660066;">y</span> <span style="color: #339933;">&lt;=</span> 0<span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				scrollButton.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> 0;
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>scrollButton.<span style="color: #660066;">y</span> <span style="color: #339933;">&gt;=</span> <span style="color: #009900;">&#40;</span>scrollTrackHeight <span style="color: #339933;">-</span> scrollButtonHeight<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				scrollButton.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> scrollTrackHeight <span style="color: #339933;">-</span> scrollButtonHeight;
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// function responsible for the &quot;jumping feature&quot;, meaning that you can click any point on</span>
		<span style="color: #006600; font-style: italic;">// the scroll track movie clip and the scroll button will be moved to that certain point, updating</span>
		<span style="color: #006600; font-style: italic;">// the content movie clip's positions at the same time</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> scrollTrackMouseHandler<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>MouseEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">eventPhase</span> <span style="color: #339933;">==</span> EventPhase.<span style="color: #660066;">AT_TARGET</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				addContentEnterFrame<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
				<span style="color: #006600; font-style: italic;">// check for the coordinates of the visitor's CLICK event on the scroll track movie clip, if the coordinates are</span>
				<span style="color: #006600; font-style: italic;">// close to the top of the scroll track then the scroll button will be moved to the top of the track...</span>
				<span style="color: #006600; font-style: italic;">// ...else if the click event had place close to the bottom of the track then the scroll button will be placed at </span>
				<span style="color: #006600; font-style: italic;">// the bottom of the track... else, it will be moved to the exact point from where the visitor has fired the CLICK event</span>
&nbsp;
				<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">target</span>.<span style="color: #660066;">mouseY</span> <span style="color: #339933;">*</span> scrollTrackScaleY <span style="color: #339933;">&lt;=</span> <span style="color: #009900;">&#40;</span>scrollTrackHeight <span style="color: #339933;">-</span> scrollButtonHeight <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span>
					event.<span style="color: #660066;">target</span>.<span style="color: #660066;">mouseY</span> <span style="color: #339933;">*</span> scrollTrackScaleY <span style="color: #339933;">&gt;=</span> <span style="color: #009900;">&#40;</span>scrollButtonHeight <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					scrollButton.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> event.<span style="color: #660066;">target</span>.<span style="color: #660066;">mouseY</span> <span style="color: #339933;">*</span> scrollTrackScaleY  <span style="color: #339933;">-</span> scrollButtonHeight <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span>;
				<span style="color: #009900;">&#125;</span>
				<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">target</span>.<span style="color: #660066;">mouseY</span> <span style="color: #339933;">*</span> scrollTrackScaleY <span style="color: #339933;">&lt;=</span> <span style="color: #009900;">&#40;</span>scrollButtonHeight <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					scrollButton.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> 0;
				<span style="color: #009900;">&#125;</span>
				<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">target</span>.<span style="color: #660066;">mouseY</span> <span style="color: #339933;">*</span> scrollTrackScaleY <span style="color: #339933;">&gt;=</span> <span style="color: #009900;">&#40;</span>scrollTrackHeight <span style="color: #339933;">-</span> scrollButtonHeight <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					scrollButton.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> scrollTrackHeight <span style="color: #339933;">-</span> scrollButtonHeight;
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// function responsible for the drag feature of the scroll button</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> startDragHandler<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>MouseEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			allowRemove <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span>;
			addContentEnterFrame<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			scrollButton.<span style="color: #660066;">startDrag</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">new</span> Rectangle<span style="color: #009900;">&#40;</span>scrollTrack.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> scrollTrack.<span style="color: #660066;">y</span><span style="color: #339933;">,</span> 0<span style="color: #339933;">,</span><span style="color: #009900;">&#40;</span>scrollTrackHeight <span style="color: #339933;">-</span> scrollButtonHeight<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// function responsible for stopping the scroll button from dragging once the visitor releases it</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> stopDragHandler<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>MouseEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			scrollButton.<span style="color: #660066;">stopDrag</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			allowRemove <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// function responsible for adding the ENTER_FRAME event that is responsible</span>
		<span style="color: #006600; font-style: italic;">// for moving ( positioning ) the content movie clip</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> addContentEnterFrame<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>enterFrameActive <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				enterFrameActive <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span>;
				content.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>Event.<span style="color: #660066;">ENTER_FRAME</span><span style="color: #339933;">,</span> moveContentHandler<span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// this function will remove the ENTER_FRAME event once the content movie clip stops scrolling</span>
		<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> removeContentEnterFrame<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>currentContentY <span style="color: #339933;">==</span> content.<span style="color: #660066;">y</span> <span style="color: #339933;">&amp;&amp;</span> allowRemove <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				content.<span style="color: #660066;">removeEventListener</span><span style="color: #009900;">&#40;</span>Event.<span style="color: #660066;">ENTER_FRAME</span><span style="color: #339933;">,</span> moveContentHandler<span style="color: #009900;">&#41;</span>;
				enterFrameActive <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span>;
				allowRemove <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span>;
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// this is a simple function that removes all the listeners from all the objects</span>
		<span style="color: #006600; font-style: italic;">// essentially, this function will be of much help if you want to use the same scrollbar instance</span>
		<span style="color: #006600; font-style: italic;">// for all the content that will be displayed in your project</span>
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> kill<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			content.<span style="color: #660066;">removeEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_WHEEL</span><span style="color: #339933;">,</span> mouseWheelHandler<span style="color: #009900;">&#41;</span>;
			scrollTrack.<span style="color: #660066;">removeEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_DOWN</span><span style="color: #339933;">,</span> scrollTrackMouseHandler<span style="color: #009900;">&#41;</span>;
			content.<span style="color: #660066;">removeEventListener</span><span style="color: #009900;">&#40;</span>Event.<span style="color: #660066;">ENTER_FRAME</span><span style="color: #339933;">,</span> moveContentHandler<span style="color: #009900;">&#41;</span>;
			scrollButton.<span style="color: #660066;">removeEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_DOWN</span><span style="color: #339933;">,</span> startDragHandler<span style="color: #009900;">&#41;</span>;
			scrollButton.<span style="color: #660066;">removeEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_UP</span><span style="color: #339933;">,</span> stopDragHandler<span style="color: #009900;">&#41;</span>;
			movieStage.<span style="color: #660066;">removeEventListener</span><span style="color: #009900;">&#40;</span>MouseEvent.<span style="color: #660066;">MOUSE_UP</span><span style="color: #339933;">,</span> stopDragHandler<span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// a public function responsible for updating the scrollbar, adding the event listeners again to each object,</span>
		<span style="color: #006600; font-style: italic;">// repositioning all the objects, storing new values and enabling or disabling certain scrollbar features; </span>
		<span style="color: #006600; font-style: italic;">// all this is done ONLY after we remove the current event listeners with the help of the kill(); function</span>
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> update<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
		<span style="color: #009900;">&#123;</span>
			kill<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;			
			setHeights<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			setButtonMode<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			storeTrackScaleY<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			repositionObjects<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			addListeners<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// public setter methods that will help you update the scrollbar, enable of disable features and add new values</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> set setEasing<span style="color: #009900;">&#40;</span>value<span style="color: #339933;">:</span>Number<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span> <span style="color: #009900;">&#123;</span> easing <span style="color: #339933;">=</span> value <span style="color: #009900;">&#125;</span>;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> set setScrollSpeed<span style="color: #009900;">&#40;</span>value<span style="color: #339933;">:</span>Number<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span> <span style="color: #009900;">&#123;</span> scrollSpeed <span style="color: #339933;">=</span> value <span style="color: #009900;">&#125;</span>;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> set setMouseWheel<span style="color: #009900;">&#40;</span>value<span style="color: #339933;">:</span>Boolean<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span> <span style="color: #009900;">&#123;</span> useMouseWheel <span style="color: #339933;">=</span> value <span style="color: #009900;">&#125;</span>;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> set setJumping<span style="color: #009900;">&#40;</span>value<span style="color: #339933;">:</span>Boolean<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span> <span style="color: #009900;">&#123;</span> enableJumping <span style="color: #339933;">=</span> value <span style="color: #009900;">&#125;</span>;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> set setScrollButtonMode<span style="color: #009900;">&#40;</span>value<span style="color: #339933;">:</span>Boolean<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span> <span style="color: #009900;">&#123;</span> buttonModeEnabled <span style="color: #339933;">=</span> value <span style="color: #009900;">&#125;</span>;
&nbsp;
		<span style="color: #006600; font-style: italic;">// public getter methods that you'll most likely not use very often but it's good to have them there;</span>
		<span style="color: #006600; font-style: italic;">// if you run into problems / bugs then you can try debugging your application with the help of these getter</span>
		<span style="color: #006600; font-style: italic;">// methods ( but if you are more familiar with the built-in Flash / Flex debugger then it's much better to use that instead )</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> get getEasing<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>Number <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> easing <span style="color: #009900;">&#125;</span>;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> get getScrollSpeed<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>Number <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> scrollSpeed <span style="color: #009900;">&#125;</span>;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> get getMouseWheel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>Boolean <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> useMouseWheel <span style="color: #009900;">&#125;</span>;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> get getJumping<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>Boolean <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> enableJumping <span style="color: #009900;">&#125;</span>;
		<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> get getScrollButtonMode<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>Boolean <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> buttonModeEnabled <span style="color: #009900;">&#125;</span>;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>It&#8217;s as efficient as it can get and certain features can be changed at runtime too ( with the help of the defined setter functions ).</p>
<p>Enjoy and don&#8217;t forget to report the bugs you find.</p>

<object	type="application/x-shockwave-flash"
			data="http://blog.wisebisoft.com/wp-content/uploads/CustomScrollBar.swf"
			width="535"
			height="300">
	<param name="movie" value="http://blog.wisebisoft.com/wp-content/uploads/CustomScrollBar.swf" />
</object>
]]></content:encoded>
			<wfw:commentRss>http://blog.wisebisoft.com/2008/10/25/reusable-as-30-scrollbar-class/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
