<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flash and ActionScript tutorials - flashadvanced &#187; Tooltip</title>
	<atom:link href="http://flashadvanced.com/tag/tooltip/feed/" rel="self" type="application/rss+xml" />
	<link>http://flashadvanced.com</link>
	<description>Become an advanced flash developer</description>
	<lastBuildDate>Mon, 11 Jan 2010 22:14:13 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Preloader following mouse</title>
		<link>http://flashadvanced.com/advanced-actionscript-3/preloader-following-mouse/</link>
		<comments>http://flashadvanced.com/advanced-actionscript-3/preloader-following-mouse/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 19:26:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Advanced ActionScript 3]]></category>
		<category><![CDATA[easing]]></category>
		<category><![CDATA[mouse follower]]></category>
		<category><![CDATA[preloader]]></category>
		<category><![CDATA[Tooltip]]></category>
		<category><![CDATA[tween]]></category>

		<guid isPermaLink="false">http://flashadvanced.com/?p=385</guid>
		<description><![CDATA[


In this tutorial I will show you how to create a nice tooltip preloader with easing using Flash and ActionScript 3. We&#8217;ll be loading an external SWF file.

Note: In order to complete this tutorial you need to download TweenMax library. Do it by clicking here. Unzip the downloaded file in the same directory as the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flashadvanced.com/?p=385"><br />
<img src="http://flashadvanced.com/wp-content/upload/preloader/preloader.jpg" alt="" /><br />
</a></p>
<p>In this tutorial I will show you how to create a nice <strong>tooltip preloader with easing</strong> using Flash and ActionScript 3. We&#8217;ll be loading an external SWF file.</p>
<p><span id="more-385"></span></p>
<h4>Note: In order to complete this tutorial you need to download TweenMax library. Do it by clicking <a href="http://blog.greensock.com/tweenmaxas3/">here</a>. Unzip the downloaded file in the same directory as the Flash files!</h4>
<p><span style="color: #ff0000;">1.</span> Open a new Flash document and save it under &#8220;preloader.fla&#8221;.</p>
<p><span style="color: #ff0000;">2.</span> Now we have to create our tooltip. If you don&#8217;t know how to draw a tooltip, see the &#8220;Tooltip&#8221; tutorial by clicking <a href="http://flashadvanced.com/?p=1" target="_blank">here</a>.<br />
If you are ready with the tooltip, select it and convert it to movie clip with instance name &#8220;tooltip_mc&#8221;. Set its registration point to <strong>bottom center</strong>:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/preloader/regpoint.jpg" alt="" /></p>
<p>Now, go inside &#8220;tooltip_mc&#8221; and create a dynamic text field on the top of the tooltip. For font select &#8220;Arial Black&#8221;, choose 9 for size and #FFFFFF for color. Type &#8220;percent_txt&#8221; for instance name. Don&#8217;t forget to embed the font:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/preloader/embed.jpg" alt="" /></p>
<p><span style="color: #ff0000;">3.</span> We are ready with the tooltip. Before we move to ActionScript we need to create another movie that we&#8217;ll be loading. <strong>Open a new flash document</strong> and import a photo that is larger than 100 Kb or you can drag several components to the stage. The idea is to make the compiled SWF file larger. Save this file under &#8220;content.fla&#8221; in the same directory as &#8220;preloader.fla&#8221; and compile it. We are going to <strong>load</strong> &#8220;content.swf&#8221;.</p>
<p><span style="color: #ff0000;">4.</span> Go back to &#8220;preloader.fla&#8221;, create a new layer called &#8220;actions&#8221; and open the actions panel:</p>
<pre><code>
//we hide the cursor
Mouse.hide();

//importing TweenMax classes
import gs.*;

//by default our tooltip should follow the mouse
TweenMax.to(tooltip_mc, 0.5 ,{x :mouseX, y: mouseY});

 //adding mouse move event handler
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);

function mouseMoveHandler(e:Event):void {
	//the tooltip follows the mouse when it is moved
	TweenMax.to(tooltip_mc, 0.5, {x :mouseX, y: mouseY});
}

//creating a loader
var loader:Loader = new Loader();
//adding progress event handler to our loader
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
                                                     loadContent);
//calling "contentLoaded" function if loading is over
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, contentLoaded);
//loading the content
loader.load(new URLRequest("content.swf"));

function loadContent(e:ProgressEvent):void{
	//calculating the percentage loaded
	var pcent:Number = (e.bytesLoaded / e.bytesTotal) * 100;
	//adding the percentage to the text field
	tooltip_mc.percent_txt.text = int(pcent)+"%";
}

function contentLoaded(e:Event):void{
	//when the movie is loaded we remove the preloader
	removeChild(tooltip_mc);
	//then we add the loader
	addChild(loader);
	//and finally we show the cursor again
	Mouse.show();
}
</code></pre>
<h4>Here is the final result. Move your mouse over the movie:</h4>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://flashadvanced.com/wp-content/upload/preloader/sitever.swf" /><embed type="application/x-shockwave-flash" width="500" height="350" src="http://flashadvanced.com/wp-content/upload/preloader/sitever.swf"></embed></object></p>
<h4>You can test your preloader by compiling the movie and then going to View -&gt; Simulate Download</h4>
<p style="text-align: left; margin: 40px 40px 40px 0;"><a href="http://www.flashadvanced.com/wp-content/upload/preloader/preloader.zip"><img src="http://flashadvanced.com/wp-content/upload/other/download.jpg" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://flashadvanced.com/advanced-actionscript-3/preloader-following-mouse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActionScript 3 Tooltips</title>
		<link>http://flashadvanced.com/actionscript-3-basics/hello-world/</link>
		<comments>http://flashadvanced.com/actionscript-3-basics/hello-world/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 07:59:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0 Basics]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Tooltip]]></category>

		<guid isPermaLink="false">http://flashadvanced.com/?p=1</guid>
		<description><![CDATA[


Tooltips are very useful and easy to create. You can use them to improve your application&#8217;s functionality. Their main purpose is to show up when the mouse is over an object and when the mouse is moving over the object the tooltip should follow it. Today I will show you how to create tooltips with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flashadvanced.com/?p=1"><br />
<img src="http://flashadvanced.com/wp-content/upload/tooltips/tooltip.jpg" alt="Tooltip with AS 3" /><br />
</a><br />
<strong>Tooltips</strong> are very useful and easy to create. You can use them to improve your application&#8217;s functionality. Their main purpose is to show up when the mouse is over an object and when the <strong>mouse</strong> is moving over the object the tooltip should follow it. Today I will show you how to create tooltips with <strong>Actionscript 3.0</strong>.</p>
<p><span id="more-1"></span></p>
<p>Let&#8217;s get started.</p>
<p><span style="color: #ff0000;"><strong>1.</strong></span> Create a new Flash CS3 document with size 300 x 150 and background color #000000.<br />
<span style="color: #ff0000;"><strong>2.</strong></span> Take the rectangle tool and draw a rectangle. Convert it to Button symbol and give it an <strong>instance</strong> name &#8220;btn&#8221;. That will be the object for our tooltip.<br />
<span style="color: #ff0000;"><strong>3.</strong></span> Now we have to draw our tooltip. Take the rectangle tool again and draw another rectangle. Use #FFFFFF for stroke color and #000000 for the fill. We will be using it for our tooltip. Now take the Selection tool and select a part of the rectangle like shown in the picture. Cut this part and take the line tool to complete the figure. Take the Paint Bucket tool to fill the holes with color #000000. Now select the fill inside the figure, open the Color panel and set the alpha to 50%. Convert the figure to Movie Clip with registration point center. Here it is step by step:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/tooltips/steps.jpg" alt="" /></p>
<p><strong>Linkage</strong> the Movie Clip to class with name Tooltip:</p>
<p><img src="http://www.flashadvanced.com/wp-content/upload/tooltips/tooltips1.jpg" alt="" /></p>
<p><span style="color: #ff0000;"><strong>4.</strong></span> Now double click on the tooltip and inside it create a new dynamic text field. Give it &#8220;descr&#8221; for instance name and embed the font. While the text is still selected click the &#8220;Embed&#8221; button and embed lowercase and uppercase characters. Well, our tooltip is ready and now we have to move to actionscript. Remove the tooltip from stage and rename its layer to actions.<br />
<strong><span style="color: #ff0000;">5.</span> </strong>Select the first frame on the &#8220;actions&#8221; layer and press F9 to open the Actions panel.</p>
<pre><code>
//First we create a variable to hold our tooltip
var holder:MovieClip = new MovieClip();

//Next we add the event listeners to our button
btn.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
btn.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
btn.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);

function mouseOverHandler(e:MouseEvent):void{
	//creating a new tooltip instance
	var tooltip:Tooltip = new Tooltip();
	//we tell the holder to hold our tooltip
	holder = tooltip;
	//adding text to the tooltip
	holder.descr.text = "completed projects";
	//positioning the tooltip on the stage
	holder.x = stage.mouseX;
	holder.y = stage.mouseY - 15;
	//adding the tooltip to the stage
	addChild(tooltip);
}

function mouseOutHandler(e:MouseEvent):void{
	//we remove the holder when the cursor is outside our button
	removeChild(holder);
}

//we create this function to move the tooltip everytime the cursor is moved
function mouseMoveHandler(e:MouseEvent):void{
	holder.x = stage.mouseX;
	holder.y = stage.mouseY - 15;
}
</code></pre>
<h4>This is the end result:</h4>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="150" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://flashadvanced.com/wp-content/upload/tooltips/tooltip.swf" /><embed type="application/x-shockwave-flash" width="300" height="150" src="http://flashadvanced.com/wp-content/upload/tooltips/tooltip.swf"></embed></object></p>
<p style="text-align: left; margin: 40px 40px 40px 0;"><a href="http://www.flashadvanced.com/wp-content/upload/tooltips/tooltips.zip"><img src="http://flashadvanced.com/wp-content/upload/other/download.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://flashadvanced.com/actionscript-3-basics/hello-world/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
