<?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>Neo-Archaic Blog &#187; actionscript2</title>
	<atom:link href="http://neo-archaic.ie/blog/category/actionscript2/feed/" rel="self" type="application/rss+xml" />
	<link>http://neo-archaic.ie/blog</link>
	<description></description>
	<lastBuildDate>Mon, 25 May 2009 19:07:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Back to the Tooltip</title>
		<link>http://neo-archaic.ie/blog/2007/02/back-to-the-tooltip/</link>
		<comments>http://neo-archaic.ie/blog/2007/02/back-to-the-tooltip/#comments</comments>
		<pubDate>Sat, 24 Feb 2007 16:36:06 +0000</pubDate>
		<dc:creator>Karina</dc:creator>
				<category><![CDATA[actionscript2]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://blog.neo-archaic.net/2007/02/24/back-to-the-tooltip.htm</guid>
		<description><![CDATA[I love my Tooltip, I really do. There isn&#8217;t a project where I haven&#8217;t used, abused and made it do unspeakable deeds. In fact, I&#8217;m surprised it hasn&#8217;t filed a lawsuit against me, for unpaid overtime. But I&#8217;ll be the first to admit that the original version was just a little bit flawed. Ok, maybe [...]]]></description>
			<content:encoded><![CDATA[<p>I love my <a href="http://blog.neo-archaic.net/2006/05/09/tooltip.htm">Tooltip</a>, I really do. There isn&#8217;t a project where I haven&#8217;t used, abused and made it do unspeakable deeds. In fact, I&#8217;m surprised it hasn&#8217;t filed a lawsuit against me, for unpaid overtime. But I&#8217;ll be the first to admit that the original version was just a little bit flawed.</p>
<p>Ok, maybe not the first to admit it &#8211; quite a few of you noticed the strange wrapping bug when used with short strings, and I recieved many requests to have it move with the mouse, fade-in and out, and even support custom shapes.</p>
<p>Well, now it does all that, and more&#8230;<br />
<a id="p21" href="http://www.neo-archaic.ie/blog/wp-content/uploads/2007/02/Tooltip_demo.htm">View Demo</a><br />
<span id="more-29"></span></p>
<p>Aside from the bug fixes, I added a bunch of new features to improve the tooltip&#8217;s functionality, fexibility and general look-feel.</p>
<p><strong>Follow me!</strong><br />
The main feature that everyone was asking for, was to allow the tooltip to follow the mouse. This can now be controlled by setting the following option: <code>follow:true</code></p>
<p><strong>Distance Control</strong><br />
In addition to being allowed to follow the mouse, the tooltip also allows you to control it&#8217;s distance from the mouse, by passing an offset object with the following optional properties in the form of an Object: <code>{x:Number, y:Number, fixed:Boolean}</code>. The default is set to: <code>{x:20, y:25}</code>.<br />
The <code>fixed</code> option causes the tooltip to appear in a fixed location on the stage, instead of relative to the mouse. For example: <code>{x:0, y:0, fixed:true}. </code>This can be handy if you want to simulate a whiteboard or status bar. Note that a fixed tooltip will not adjust to Stage dimensions.</p>
<p><strong>Looking Good&#8230;</strong><br />
A number of fixes and new features were added to improve the overall appearance. These include fixing the bug that caused premature <strong>wrapping </strong>of short strings, a <strong>smoother cornering </strong>and also the <strong>alpha</strong> option now only applies to the background, but not the text itself. Passing <code>alpha:0</code> will even make the tooltip appear entirely without a background &#8211; for example, to achieve that whiteboard / status bar effect, combined with a fixed position.<br />
The <strong>margins</strong> have also been updated, and now apply all around the tooltip, not just left and right. For example, <code>margin:10</code> will display the tooltip with a lovely wide margin all around it.<br />
Two new formatting options are <strong>leading </strong>and <strong>align</strong>. The former allows you to control the line spacing (default is <code>leading:2</code>) and the latter controls the text alignment (defult <code>align:"left"</code>).<br />
And finally, if you want to make the <strong>lineColor</strong> different from the text colour, you can pass a different Color object. For example, <code>color:0x37735B,</code> and <code>lineColor:0x000000,</code>. Will create a tooltip with green text and a black border line.</p>
<p><strong>Fade Animation</strong><br />
Instead of just popping onto your screen, the tooltip can now be animated to fade in and out by setting the <code>fade:Number/Boolean</code> option. By default it&#8217;s set to <code>fade:0</code>. Setting it to <code>fade:true</code> will cause the tooltip to fade-in and out, in chunks of 10. Setting it to a number (larger than 0) will change the speed of the animation. For example, <code>fade:20</code> will speed it up.</p>
<p><strong>All Singing &amp; Dancing Backgrounds</strong><br />
By default, the tooltip Is a square with rounded or straight corners and a drop shadow. But all this can be changed by assigning the <code>bgClip:String</code> option. The string points to a linked library symbol, which can be used as a custom shape, bitmap graphic, a background with a glow effect applied to it (Flash 8 ), or even an animated or scripted movie clip. The new movie clip background will be stretched to the movie clip&#8217;s dimensions, but the resulting image can also be controlled in Flash 8 by setting it&#8217;s 9Slice grid in the library. If the background clip has ActionScript attached to it, you can pass it the following method: <code>setOptions(options)</code>. This passes the entire options object to the clip, and you can then write some more code to make it do even more stuff.<br />
So what else could you possibly need?</p>
<p><strong>Add a Bit of Style&#8230;</strong><br />
A custom StyleSheet can be applied to the tooltip in <strong>html</strong> mode. To remind you, <code>html:true</code> allows the tooltip to be displayed as html. These days, I have the html option permanently on (it can do anything that plain text can do, better&#8230;) but I kept it off by deafult, to maining backwards compatibility.<br />
Passing a custom StyleSheet: <code>styleSheet:styleObject</code> allows you to change the look of specified elements, such as hyperlinks, spans and other elements, including the entire tooltip.</p>
<p><strong>For Example:</strong></p>
<blockquote>
<pre>var style:TextField.StyleSheet = new TextField.StyleSheet ();
style.setStyle(".emphasised", {color:'#37735B',
textDecoration:'underline', fontWeight:'bold'});
Tooltip.show("New options introduced in Version 2 are: lineColor, leading,
align, <span class="emphasised">styleSheet</span>, follow, fade, bgClip and offset,
as well as improved handling of margins\n\nBy embedding the font and setting
the fade option, you can get the tooltip to fade in and out.",
{html:true, font:"Verdana", embedFonts:true, fade:true, lineColor:0x37735B,
 leading:6, align:"right", styleSheet:style,fade:20,
offset:{x:20, y:50}, margin:20})</pre>
</blockquote>
<p><strong>Enough Already!</strong><br />
So where can you get this Amazing Tooltip?</p>
<p><a id="p15" href="http://www.neo-archaic.ie/blog/wp-content/uploads/2007/02/Tooltip.zip">Download Tooltip Files</a><br />
<a id="p21" href="http://www.neo-archaic.ie/blog/wp-content/uploads/2007/02/Tooltip_demo.htm">View Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://neo-archaic.ie/blog/2007/02/back-to-the-tooltip/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>NoCache for JavaScript and Flash</title>
		<link>http://neo-archaic.ie/blog/2006/08/nocache-for-javascript-and-flash/</link>
		<comments>http://neo-archaic.ie/blog/2006/08/nocache-for-javascript-and-flash/#comments</comments>
		<pubDate>Wed, 02 Aug 2006 22:55:46 +0000</pubDate>
		<dc:creator>Karina</dc:creator>
				<category><![CDATA[actionscript2]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.neo-archaic.net/2006/08/02/nocache-for-javascript-and-flash.htm</guid>
		<description><![CDATA[I just spent a very frustrating day wrangling with cached images. Both JavaScript and Flash have trouble updating dymanic images, when these are cached by the browser. This can be a problem if, for example, your website has sets of images, such as catalogues, that could be updated at any time. Or if the website [...]]]></description>
			<content:encoded><![CDATA[<p>I just spent a very frustrating day wrangling with cached images. Both JavaScript and Flash have trouble updating dymanic images, when these are cached by the browser. This can be a problem if, for example, your website has sets of images, such as catalogues, that could be updated at any time. Or if the website needs to constantly reload a single image with the same filename, such as a self-updating webcam image.</p>
<p>In my case, it was both. After delving into numerous Internet sources, with some trial and even more error, I finally distilled a solution that, with slight adjustments, works for both JavaScript and Flash.<br />
<span id="more-26"></span></p>
<p><strong>The basic principle</strong> is to trick the browser into thinking that a different image, with a different name, is being loaded. This can be achieved by appending a constantly changing variable into the url of the loaded image:</p>
<blockquote><p><code>myImage.jpg?nocache=" + new Date().getTime();</code></p></blockquote>
<p>The <code>getTime() </code>method of the Date object returns the number of milliseconds since January 1, 1970 to this date, (or another date specified in the instance). This is perfect for us, because this means that you get a unique number, each time &#8211; unless you can refresh faster than a speeding millisecond&#8230;</p>
<p>You could also play with the Date object&#8217;s methods and exchange <code>getTime() </code>for <code>getHours() </code>or <code>getDate()</code>. This would refresh the images every hour or every day, keeping them in the cache for the current session, which could be useful in some instances.</p>
<p><strong>In JavaScript</strong> all you need now is to assign this to the src property of an image, for example:</p>
<blockquote><p><code>var cam1 = document.getElementById("cam1");<br />
cam1.src = "../images/cam1.jpg?nocache="<br />
+new Date().getTime();</code></p></blockquote>
<p>If you trace out the resulting src or nameProp of the image (I tend to use alerts for this), the returned string will include the url encoding &#8211; but will display the correct image, fresh from the HTTP oven.</p>
<p><strong>In Flash </strong>you&#8217;d use essentially the same syntax, but it&#8217;s slightly more complicated. If you attempt to load an image with this url from the IDE, it won&#8217;t find the image and will return an error instead. However, it will work fine when embedded in a browser.</p>
<p>To make it work in both, you need to test for the playerType first, before adding the url encoded variable:</p>
<blockquote>
<div></div>
<p><code></p>
<pre>var loader:MovieClipLoader;
var viewLoader:MovieClip;
var url:String = "images/catalogue/collection/cat1.jpg";
if (System.capabilities.playerType == "PlugIn"
|| System.capabilities.playerType == "ActiveX"){
      url+="?nocache="+new Date().getTime();
}
loader.loadClip (url, viewLoader);</pre>
<p> </p>
<p> </p>
<p></code></p></blockquote>
<p><strong>This solution </strong>is not only limited to images &#8211; it can also be used when loading other file types that you wouldn&#8217;t like cached, such as XML, SWFs and other files or assets.</p>
]]></content:encoded>
			<wfw:commentRss>http://neo-archaic.ie/blog/2006/08/nocache-for-javascript-and-flash/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Tooltip</title>
		<link>http://neo-archaic.ie/blog/2006/05/tooltip/</link>
		<comments>http://neo-archaic.ie/blog/2006/05/tooltip/#comments</comments>
		<pubDate>Tue, 09 May 2006 15:13:00 +0000</pubDate>
		<dc:creator>Karina</dc:creator>
				<category><![CDATA[actionscript2]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.neo-archaic.net/blog/2006/05/09/tooltip.htm</guid>
		<description><![CDATA[This article explains some of the uses, properties, and customisation of the Rich Text Tooltip for Flash (versions 7 and higher). A tooltip can be very helpful for the user interface of applications, development tools, websites, multimedia, interactive maps, and games. It&#8217;s a great way to keep your interface free of clutter, and still supply [...]]]></description>
			<content:encoded><![CDATA[<p>This article explains some of the uses, properties, and customisation of the Rich Text Tooltip for Flash (versions 7 and higher). A tooltip can be very helpful for the user interface of applications, development tools, websites, multimedia, interactive maps, and games. It&#8217;s a great way to keep your interface free of clutter, and still supply information at a glance about any one of the elements. The demo flash movie shows how the tooltip can be used as it&#8217;s own tutorial â€“ just roll over any of the items in the demo to see what the tooltip can do:</p>
<p><a id="p21" href="http://www.neo-archaic.ie/blog/wp-content/uploads/2007/02/Tooltip_demo.htm">View Demo</a></p>
<p>The tooltip comes in the form of static class methods and does not require any assets on the stage or in the library, as it is created and destroyed on the fly. It needs to reside in your global or local classpath, in a folder structure corresponding to the package com.neoarchaic.ui. After the package has been imported, you create the tooltip simply by calling the static show() method:</p>
<blockquote>
<pre>import com.neoarchaic.ui.Tooltip;
Tooltip.show(â€œHi, I'm the tooltip, see what I can do!â€);</pre>
</blockquote>
<p>And destroy it by calling the static hide() method:</p>
<blockquote>
<pre>Tooltip.hide();</pre>
</blockquote>
<p><span id="more-13"></span></p>
<p><strong>Calling the Tooltip: </strong></p>
<p>The tooltip methods can be called form anywhere in your ActionScript code, either in your own classes or from the timeline. Normally, you would bind them to an event generated by a button, movieclip, or component, displaying the tooltip on a rollover event and hiding it again on rollout. For example:</p>
<blockquote>
<pre>button1.onRollOver = function(){
	Toolitp.show(â€œIâ€™m a simple tooltipâ€);
}
button1.onRollOut = function(){
	Toolitp.hide();
}</pre>
</blockquote>
<p>In the following example, the tooltip is bound to the events of a List component. The data property of each list item is used for the tooltip text:</p>
<blockquote>
<pre>listListener = new Object();
listListener.itemRollOver = function(e:Object){
	 Tooltip.show(e.target.getItemAt(e.index).data);
}
listListener.itemRollOut = function(e:Object){
	Tooltip.hide();
}

list.addEventListener("itemRollOver", listListener);
list.addEventListener("itemRollOut", listListener);</pre>
</blockquote>
<p>That&#8217;s all you need to create a standard tooltip with a yellow background and black verdana font. But your tooltip doesn&#8217;t have to be standard at all. There are many ways in which it can be customised, both locally and globally, as shown in the demo.</p>
<p><strong>Customising the Tooltip: </strong></p>
<p>First of all, you can set global options at any time from your code. You can set one or more options at once with the static options property:</p>
<blockquote>
<pre>Tooltip.options= ({color: 0xFFFFFF, bgColor: 0x37735B,
   font:"_serif", size: 16});</pre>
</blockquote>
<p>Or one at a time using the method:</p>
<blockquote>
<pre>Tooltip.setOption("bold", true);</pre>
</blockquote>
<p>And reset all the global options back to default:</p>
<blockquote>
<pre>Tooltip.resetOptions();</pre>
</blockquote>
<p>You can also customise a particular tooltip locally by passing an object that contains one or more options with the show() method. This will override the default or global settings for that tooltip, but will not change any global settings:</p>
<blockquote>
<pre>Tooltip.show("I'm a tooltip with locally passed optionsâ€,
   {alpha: 70, bold:true, color: 0x663333, bgColor:0xFFFFFF,
    size:10, font:"Verdana"});</pre>
</blockquote>
<p>Here is a list of all the available customisation options:</p>
<ul>
<li>delay:Number &#8211; delay in seconds (default: 0.5 second)</li>
<li>width:Number &#8211; maximum width of the tooltip window (default: 200px)</li>
<li>bgColor:Color &#8211; Background color of the tooltip (default: 0xFFFFDD &#8211; light yellow)</li>
<li>alpha:Number &#8211; Transparency of the tooltip (default: 85)</li>
<li>corner:Number &#8211; The diameter for the rounded corner (default: 5, for sharp corners pass 0)</li>
<li>margin:Number (default: 2)</li>
<li>font:String (default: &#8220;Verdana&#8221;)</li>
<li>color:Color &#8211; Text and line color, can also accept a string hex value (default 0&#215;000000)</li>
<li>size:Number &#8211; Font size (default: 10)</li>
<li>bold:Boolean (default: false)</li>
<li>embedFonts:Boolean (default: false)</li>
<li>html:Boolean (default: false)</li>
</ul>
<p>The html option is especially interesting, as it allows you the greatest flexibility in formatting your text, as much as the native support of html in flash allows you to do so. This means you can make some text bold and some italic or underlined, display bulleted list items, and even inline images:</p>
<blockquote>
<pre>Tooltip.show("&lt;p&gt;&lt;img src='Internet' width='19' height='17'
   hspace='5' vspace='5'/&gt; With html enabled, you can
   control the display to show inline images, &lt;/p&gt;
   &lt;ul&gt;&lt;li&gt;List Items&lt;/li&gt;&lt;li&gt;&lt;b&gt;Bold Text&lt;/b&gt;&lt;/li&gt;
   &lt;li&gt;&lt;i&gt;Italic Text&lt;/i&gt;&lt;/li&gt;&lt;/ul&gt;
   &lt;p&gt;Multiple paragraphs, and any html tags &lt;u&gt;natively
   supported&lt;/u&gt; by the TextField.&lt;/p&gt;" ,
   {html: true, size:12});</pre>
</blockquote>
<p>To show an image inside a tooltip, you need to include an img tag in your html text, and have it&#8217;s src propery pointing to an external jpeg, flash movie, or an internal symbol&#8217;s linkage id inside the html text, as shown in the above example.</p>
<p><strong>Examples and Download: </strong></p>
<p>You can download all the source files for the tooltip here. These include the Tooltip class, documentation and demo. This tooltip is currently used by two open source Flash initiatives on <a href="http://www.osflash.org" target="_blank">osflash.org</a>: <a href="http://www.osflash.org/xray">Xray</a> (Flash debugger) and <a href="http://www.osflash.org/red5">Red5</a> (Flash server). A more customised example can be found on the homepage of a <a href="http://www.belilovskypediatrics.com/">Pediatric Center</a> website in Brooklyn , NY.</p>
<p><strong><em>A new version of the Tooltip is now available:</em></strong></p>
<p><a id="p15" href="http://www.neo-archaic.ie/blog/wp-content/uploads/2007/02/Tooltip.zip">Download New Tooltip Files</a><br />
<a id="p21" href="http://www.neo-archaic.ie/blog/wp-content/uploads/2007/02/Tooltip_demo.htm">View Demo</a></p>
<p>You can still download <a id="p15" href="http://www.neo-archaic.ie/blog/wp-content/uploads/2006/05/Tooltip.zip">the old tooltip (version 1)</a>, but the new version is fully backwards-compatible.</p>
]]></content:encoded>
			<wfw:commentRss>http://neo-archaic.ie/blog/2006/05/tooltip/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
	</channel>
</rss>
