<?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</title>
	<atom:link href="http://neo-archaic.ie/blog/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>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AS3 Tooltip</title>
		<link>http://neo-archaic.ie/blog/2009/05/as3-tooltip/</link>
		<comments>http://neo-archaic.ie/blog/2009/05/as3-tooltip/#comments</comments>
		<pubDate>Tue, 19 May 2009 12:56:48 +0000</pubDate>
		<dc:creator>Karina</dc:creator>
				<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://neo-archaic.ie/blog/?p=64</guid>
		<description><![CDATA[At last, I got around to porting my Tooltip Class to Actionscript  3.  Well, when I say &#8220;porting&#8221;, that&#8217;s not quite accurate: this is a complete rewrite.  As such, alot of property names in the options have been changed, some of the defaults are different, and there are a few more public methods.  So if you&#8217;ve been [...]]]></description>
			<content:encoded><![CDATA[<p>At last, I got around to porting my Tooltip Class to Actionscript  3.  Well, when I say &#8220;porting&#8221;, that&#8217;s not quite accurate: this is a complete rewrite.  As such, alot of property names in the options have been changed, some of the defaults are different, and there are a few more public methods.  So if you&#8217;ve been using the old AS2 Tooltip, don&#8217;t just copy and paste your code, first have a look at the Class, which is fully documented. </p>
<p><a href="http://neo-archaic.ie/blog/wp-content/uploads/2009/05/tooltip.zip">Get The Tooltip Class Here.</a></p>
<p>If you&#8217;re not familiar with the old AS2 Tooltip: this is a customizable static Singleton Class for generating and displaying Tooltips from anywhere in your code.   There are no assests for the library, since the tooltip is created and drawn dynamically, by invoking the static methods:</p>
<blockquote><p>Tooltip.show(tooltip:String = &#8220;&#8221;, localOptions:Object = null, target:DisplayObject = null) <br />
Tooltip.hide()</p></blockquote>
<p>But now there&#8217;s another way to invoke the Tooltip:   DisplayObject instances can now subscribe and unsubscribe themselves from the tooltip for automatic handling:</p>
<blockquote><p>Tooltip.subscribe(target:DisplayObject, tooltip:String = &#8220;&#8221;, options:Object = null)</p></blockquote>
<pre><span id="more-64"></span></pre>
<p>This will register the ROLL_OVER, ROLL_OUT, MOUSE_DOWN, and CLICK events of your target with listeners in the Tooltip, to show and hide the passed tooltip string at the appropriate times.  This is great when your target&#8217;s tooltip string doesn&#8217;t need to change much, but if you do need to change it,  just call the subscribe() method again with the new arguments.   For example, if you have a custom button class with a String property called &#8221;tooltip&#8221;, you can use accessor methods to set or change the tooltip, and inside the accessor call Tooltip.subscribe().</p>
<p>And, of course, to unsubscribe:</p>
<blockquote><p>Tooltip.unsubscribe(target:DisplayObject)</p></blockquote>
<p>You may have noticed that there&#8217;s a third argument in the original Tooltip.show() method.    This is entirely optional, and it&#8217;s one of the ways to make sure that the Tooltip is registered with the stage. Since Actionscript3 limits stage access to DisplayObject instances that are already on it, you have to make sure that the stage reference is passed to the Tooltip at least once in the programme&#8217;s lifetime.  This is done by passing a DisplayObject instance that&#8217;s already registered with the stage, and you can chose one of several ways to do so:</p>
<ol>
<li>Subscribe a target DisplayObject to the tooltip &#8211; this will automatically attach the tooltip to the Stage the moment the target becomes a child of the Stage (via an Event.ADDED_TO_STAGE listener).</li>
<li> Pass an optional &#8220;target&#8221; parameter to the Tooltip.show() method.</li>
<li> Call Tooltip.getInstance(target) once before using the Tooltip.</li>
</ol>
<p> </p>
<p><strong>Formatting and Customisation:</strong></p>
<p>All the Tooltip&#8217;s options can be customised both globally and locally.  For global customisation, use the static get/set options accessors to pass an object containing one or more options, or set them one at a time using the static setOption () method. </p>
<blockquote><p>Tooltip.options = newOptions:Object<br />
Tooltip.setOption(optionName:String, optionValue:*)</p></blockquote>
<p>For local customisation of individual tooltips, pass an options object to the static Tooltip.show () method, or register local options with the subscribe(method). It&#8217;s not necessary to pass all the options &#8211; Each default option is applied unless overridden by a global option, which can in turn be overriden by a local option. So only pass the options you want to override with your object.</p>
<p>The text is rendered using html and styled with CSS (it&#8217;s no longer necessary or possible to switch html on or off).  The body text is wrapped with  XML &lt;tooltip&gt;&lt;/tooltip&gt; tags  and the main stylesheet uses the &#8220;tooltip&#8221; xml selector to format the text,  but additional selectors can be used to format various html entities, by passing a styleSheet property with the options.<br />
 <br />
The Tooltip uses a fadeIn/fadeOut animation by default, so fonts are also embedded by default - but only if the font corresponding to the fontFamily option is embedded in the Flash file.  The class checks for existance of the Font and switches the embed on or off accordingly. But you can always switch embedFonts off completely.</p>
<p>When a CSS-style comma separated list of fonts is used for fontFamily, the code uses the first located font and ingores all others. However, overriding or additional fonts in the styleSheet option are not checked by the code, so you need to make sure that all those fonts are embedded or turn off the automatic embedding using the embedFonts option.<br />
 <br />
By default, the Tooltip&#8217;s background is a rounded rectangle, with customisable corner rounding. The backgroundColor, lineColor, alpha transparacy, and dropShadow are all customisable using the options.   To use a different background, for example a Symbol in the library, you can pass a customBackground option.  This attaches a MovieClip or other DisplayObject from the library as the tooltip&#8217;s background property.   The custom background is then streched to the default dimensions (text width and height plus margins), but for extra control you can also access the Tooltip&#8217;s instance properties from within the background instance or anywhere else using:</p>
<blockquote><p>Tooltip.getInstance().getDimensions();<br />
Tooltip.getInstance.getLocalOptions();</p></blockquote>
<p>For non-rectangular custom backgrounds, you may need to play around with margins. To set all the margins at once, use the margin property. To override specific margins, use marginLeft, marginRight, marginTop, or marginBottom.  </p>
<p>For non standard implementations, if you want the tooltip displayed in a fixed spot on the stage (eg, for a status bar or speech bubble), you can use offsetX and offsetY together with fixedPosition &#8211; inn this case, the offset will be relative to the stage instead of the mouse. You can also use fixedWidth to prevent the tooltip from shrinking to fit a single line, and boundingRect to constrain it to an area other than the stage.</p>
<p>    <br />
<strong>List of Tooltip Options:</strong></p>
<blockquote><p>delay:Number (default: 0.5 seconds) delay in seconds</p>
<p>width:Number (defalut: 200) maximum width of the tooltip rectangle (default: 200px)</p>
<p>alpha:Number (default: 0.8) Alpha transparency of the tooltip&#8217;s background </p>
<p>corner:Number (default: 10) The diameter for the rounded corner. For sharp corners pass 0)</p>
<p>margin:Number (default: 4) Overall margin</p>
<p>marginLeft:Number (default: Tooltip.MARGIN) Left margin. Defaults to the overall margin value</p>
<p>marginRight:Number (default: Tooltip.MARGIN) Left margin. Defaults to the overall margin value</p>
<p>marginTop:Number (default: Tooltip.MARGIN) Left margin. Defaults to the overall margin value</p>
<p>marginBottom:Number (default: Tooltip.MARGIN) Left margin. Defaults to the overall margin value</p>
<p>color:Color Text and line color, can also accept a string hex value (default 0&#215;000000)  </p>
<p>backgroundColor:int Background color of the tooltip (default: 0xFFFFDD &#8211; light yellow)</p>
<p>shadowColor:int (default: Tooltip.COLOR_TEXT) Drop shadow colour. By default duplicates the color property.</p>
<p>shadowType:int (default: Tooltip.SHADOW_HOLLOW), )</p>
<p>lineColor:Color (default: Tooltip.COLOR_TEXT) COLOR_TEXT uses same colour as the options.color. For no line use COLOR_NONE.</p>
<p>customBackground:DisplayObject (defult:null) If true overrides background and line colour settings and inserts a custom class as background. The mc is automatically stretched to fit the dimensions, but can use getDimensions() and getLocalOptions() methods of the Tooltip instance to adjust itself.</p>
<p>styleSheet:TextField.StyleSheet (default: null) Use to extend the default stylesheet.</p>
<p>fontFamily:String (default: &#8220;Verdana,Helvetica,_sans&#8221;) Can be a single font or a comma separated list of fonts (no spaces between commas allowed).</p>
<p>fontSize:Number Font size (default: 11)</p>
<p>fontWeight:String (default: &#8220;normal&#8221;)</p>
<p>leading:Number line spacing (default: 2)</p>
<p>textAlign:String (default: TextFormatAlign.LEFT)</p>
<p>embedFonts:Boolean (default: true) If true, will first check if the embedded font passed in the fontFamily option is available (if it&#8217;s a list of fonts, it will use the first available font in the list). If set to false, it will not embed the fonts regardles of availability.</p>
<p>followMouse:Boolean (default: true) If true the tooltip will follow mouse</p>
<p>duration:Number or Boolean (default:1) The duration of the fadeIn/fadeOut animation. </p>
<p>offsetX:Number (default 20) Horizontal distance from mouse.</p>
<p>offsetY:Number (default 25) Vertical distance from mouse.</p>
<p>fixedPosition:Boolean (default: false) &#8211; If true, the tooltip will appear in a fixed position on the stage, instead of at the mouse position. A fixed tooltip will not adjust to Stage dimensions or follow the mouse.</p>
<p> fixedWidth:Boolean (default: false) don&#8217;t adjust the width of a single line tooltip.</p>
<p>boundingRect:Object (default: Tooltip.STAGE_RECT) set the constraining bounds to other than the stage (x, y, width, height);</p></blockquote>
<p><strong>Usage Example:</strong></p>
<blockquote><p> import com.neoarchaic.ui.Tooltip;<br />
Tooltip.options = {width: 500, margin:10}<br />
Tooltip.subscribe(this, &#8220;I&#8217;m a subscribed tooltip&#8221;, {backgroundColor:0&#215;000000, color:&#8221;#FFFFFF&#8221;});<br />
Tooltip.show(&#8221;I&#8217;m a tooltip. &amp;lt;br/&amp;gt;I&#8217;m 500 pixels wide and have a 10 pixel margin&#8221;);<br />
Tooltip.show(&#8221;I&#8217;m a delayed tooltip.&#8221;, {delay: 2});<br />
Tooltip.hide(); <br />
Tooltip.unsubscribe(this); </p></blockquote>
<p> </p>
<p><strong>Download:</strong></p>
<p><a href="http://neo-archaic.ie/blog/wp-content/uploads/2009/05/tooltip.zip"> Get The Tooltip Class Here.</a> </p>
<p>Do let me know if there are any problems with it, any ideas for improvement, and of course if you managed to use it successfully.</p>
]]></content:encoded>
			<wfw:commentRss>http://neo-archaic.ie/blog/2009/05/as3-tooltip/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>More IE Madness &amp; Object Swap Goes OOP</title>
		<link>http://neo-archaic.ie/blog/2008/02/more-ie-madness-object-swap-goes-oop/</link>
		<comments>http://neo-archaic.ie/blog/2008/02/more-ie-madness-object-swap-goes-oop/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 18:25:10 +0000</pubDate>
		<dc:creator>Karina</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.neo-archaic.net/2008/02/06/more-ie-madness-object-swap-goes-oop.htm</guid>
		<description><![CDATA[A couple of days ago, having just installed a new version of the Flash player in Internet Explorer, I tested recent updates to an ongoing Flash project. Imagine my amazement when, instead of an interactive Flash exhibition, I got a notice that my Flash version was not up to date. Thinking that maybe something went [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago, having just installed a new version of the Flash player in Internet Explorer, I tested recent updates to an ongoing Flash project. Imagine my amazement when, instead of an interactive Flash exhibition, I got a notice that my Flash version was not up to date. Thinking that maybe something went wrong with the recent installation, I went to the Adobe website and reinstalled. Still, no luck.<br />
ObjectSwap has a nifty param line for version checking, and in this project it looks like this:</p>
<blockquote><p><code>&lt;param name="flashVersion" value="8" /&gt; </code></p></blockquote>
<p>The current flash version in my browser is: 9,0,115,0, and up until now, the version checking code worked in such a way that if the version declared in the param is lower than or equal to the installed version, the Flash content will be displayed, and otherwise you get the alternate content &#8211; in this case, a request to download the latest player. After playing around with it, I saw that either I had to change the version to 9 in the param, or remove it altogether. In other words, all of a sudden, IE requires the exact flash version of the <strong>player</strong>, rather than the version of the <strong>movie</strong>. Madness&#8230;<br />
<span id="more-30"></span></p>
<p>The workaround for that, was to include an iteration of version checking in the script &#8211; first, you check for the movie&#8217;s version, as defined in the param, if that fails, you increase the version three times, until you either get a success, or all four attempts fail.</p>
<blockquote>
<pre>} else if (this.ie &amp;&amp; typeof (ActiveXObject) == "function"){
   //IE flash detection.
   //Try 3 versions higher than specified
   var maxCount = Number(version) + 3;
   for(var i=version; i&lt;=maxCount; i++){
      try{
         var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
         return true;
      }
      catch(e){
        //continue
     }
  }
  return false;
}</pre>
</blockquote>
<p>Unfortunately, this is not one hundred percent future proof. If you&#8217;re publishing for 8, you might want to keep an eye on it after version 11. Unless, of course, IE recognises it as a bug and fixes it for later updates. Shall we all have a breath-holding competition?</p>
<p>In the meantime, this fix seems to work for IE7 and amazingly didn&#8217;t break in IE6 when I was showing the aforementioned project on a client&#8217;s PC. Miracles do happen.</p>
<p>Ok, so this is the bugfix issue. The second subject of this conversation, is the complete redesign of the ObjectSwap script, so it now uses objects, prototype functions, namespaces, and general best practices of OOP. Perhaps even more importantly, it now uses DOM event listeners instead of window.onload event.</p>
<p>The new code was written in July, and together with the latest bug fix, I feel it&#8217;s about time to release the update.</p>
<p>So here it is: <a id="p31" href="http://blog.neo-archaic.ie/wp-content/uploads/2008/02/ObjectSwap_download_080206.zip">Object Swap Updates</a></p>
]]></content:encoded>
			<wfw:commentRss>http://neo-archaic.ie/blog/2008/02/more-ie-madness-object-swap-goes-oop/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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 not [...]]]></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>XHTML Definition List Tree</title>
		<link>http://neo-archaic.ie/blog/2007/02/definition-list-tree/</link>
		<comments>http://neo-archaic.ie/blog/2007/02/definition-list-tree/#comments</comments>
		<pubDate>Mon, 19 Feb 2007 23:15:09 +0000</pubDate>
		<dc:creator>Karina</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.neo-archaic.net/2007/02/19/definition-list-tree.htm</guid>
		<description><![CDATA[Seeing as the Neo-Archaic logo is a tree, I just couldn&#8217;t resist adding a JavaScript tree component to the GrannySmith blog.
The need for a tree-view arose when I was adding a FAQ page to the Pediatric Center website. I didn&#8217;t want a long scrolling page, and it appeared to be a tedious affair to create [...]]]></description>
			<content:encoded><![CDATA[<p>Seeing as the Neo-Archaic logo is a tree, I just couldn&#8217;t resist adding a JavaScript tree component to the GrannySmith blog.</p>
<p>The need for a tree-view arose when I was adding a <a href="http://www.belilovskypediatrics.com/en/faq.htm">FAQ page</a> to the Pediatric Center website. I didn&#8217;t want a long scrolling page, and it appeared to be a tedious affair to create all those internal links and anchors. A treeview structure seemed ideal for a FAQ, but then I couldn&#8217;t find anything usable on google (At this point you might say that my google skills could do with some polishing, and come up with a list of wonderful scripts that I completely overlooked&#8230;), and besides, good clean dynamic xhtml is still not that easy to come by.</p>
<p>The result is a Definition List Tree component &#8211; That is, a bit of JavaScript code that you can add to your page to create a treeview component out of a humble DL.<br />
<span id="more-27"></span><br />
<strong>The Definition List xhtml:</strong></p>
<p>The script will operate on any definition list on the page that has the class attribute &#8220;tree&#8221;, and ignore all others. If you&#8217;d rather use a differnt className or operate on all DLs regardless of class, you could change the init() function so it either uses another className, or passes a null &#8211; in which case all definition trees on the page will be affected. You can call your tree a &#8220;spade&#8221; if you like, but I call my tree a &#8220;tree&#8221;.</p>
<p>Each term/definitions pair should only have one &lt;dt&gt; tag with its text enclosed in a hyperlink, and a single &lt;dd&gt; tag.</p>
<p>The &lt;dd&gt; tag can then include other html structures, such as paragraphs, tables, other lists etc.</p>
<p>The resulting tree structure can be used for multiple purposes, such as FAQs, sitemaps, menus, directories and other listings.</p>
<p><strong>For example:</strong></p>
<blockquote>
<pre>&lt;dl class="tree"&gt;
&lt;dt&gt;&lt;a href="#"&gt;Are you open on the weekends? &lt;/a&gt;&lt;/dt&gt;
&lt;dd&gt;The Brooklyn (Brighton) office is open all weekends, all holidays,
and in all weather conditions.&lt;/dd&gt;
&lt;dt&gt;&lt;a href="#"&gt;Do you accept my insurance?&lt;/a&gt;&lt;/dt&gt;
&lt;dd&gt;If we do NOT accept your insurance, it is either (a) because it is
very rarely seen in the areas we cover, or (b) because it endangers the
health of the patients it covers by making essential services difficult
to obtain. &lt;a href="insurances.htm"&gt;Click here for a partial
listing of insurances we accept&lt;/a&gt;.&lt;/dd&gt;
&lt;/dl&gt;</pre>
</blockquote>
<p><strong>The JavaScript:</strong></p>
<p>The DLTree script needs to be linked at the head of the html page in the usual manner:</p>
<blockquote>
<pre>&lt;script language="JavaScript" type="text/javascript"
src="scripts/DLTree.js"&gt;&lt;/script&gt;</pre>
</blockquote>
<p>Â &#8230;and is executed with the window.onLoad event, using a function that works without conflicting with the window.onload event of any preceding scripts.</p>
<p>At the top of the script, there are a few customisable variables:</p>
<blockquote>
<pre>//Icon images
var plus = "url(images/plus.gif)"
var minus = "url(images/minus.gif)"
//Padding for the icons
var padding = "14px"</pre>
</blockquote>
<p>These variables refer to the plus and minus icons that display the state of each node &#8211; <em>plus</em> to expand a collapsed node, and <em>minus</em> to collapse it. You need to create your own graphics here and place them in the images folder. The url for images can be changed here to suit your own folder structure, and is relative to the <em>html document</em>, rather than the javaScript. The images can be safely omitted, or designed to look like anything that indicates tree nodes. The <code>padding</code> variable corresponds to the space that the image takes up, including a bit of horizontal padding (for example, padding of 14 for an image of 12 pixels).</p>
<p><strong>Expand All / Collapse All:</strong></p>
<p>To expand &amp; collapse all the nodes in the tree, you can add two links to the top or bottom of your page:</p>
<blockquote>
<pre>&lt;p&gt;&lt;a href="#" onclick="expandDLTree('tree')"&gt;
Expand All&lt;/a&gt;&amp;nbsp; &amp;#8226; &amp;nbsp; &lt;a href="#"
onclick="initDLTree('tree')"&gt; Collapse All&lt;/a&gt;&lt;/p&gt;</pre>
</blockquote>
<p><strong>Examples and Download:</strong></p>
<p>The downloadable example contains a simplified excerpt from the <a href="http://www.belilovskypediatrics.com/en/faq.htm">Belilovsky Pediatric Center FAQ</a> page, and contains all the xhtml and JavaScript mentioned above, including the treeview icons.</p>
<p><a id="p28" href="http://blog.neo-archaic.ie/wp-content/uploads/2007/02/DLTree.zip">Download the DLTree code and examples</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://neo-archaic.ie/blog/2007/02/definition-list-tree/feed/</wfw:commentRss>
		<slash:comments>0</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>14</slash:comments>
		</item>
		<item>
		<title>NavSwap: Semantic XHTML Menus into Designer Images</title>
		<link>http://neo-archaic.ie/blog/2006/07/navswap-semantic-xhtml-menus-into-designer-images/</link>
		<comments>http://neo-archaic.ie/blog/2006/07/navswap-semantic-xhtml-menus-into-designer-images/#comments</comments>
		<pubDate>Sat, 29 Jul 2006 16:10:40 +0000</pubDate>
		<dc:creator>Karina</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.neo-archaic.net/2006/07/29/navswap-semantic-xhtml-menus-into-designer-images.htm</guid>
		<description><![CDATA[The Problem:
If you are a web designer who tries to combine high standard graphic design with top-notch web-standards xhtml, you can&#8217;t escape a certain degree of conflict of interests. This can be especially acute when it comes to designing a menu. You want it to have a strong graphic look, elegant and glossy, and yet [...]]]></description>
			<content:encoded><![CDATA[<p><strong>The Problem:</strong><br />
If you are a web designer who tries to combine high standard graphic design with top-notch web-standards xhtml, you can&#8217;t escape a certain degree of conflict of interests. This can be especially acute when it comes to designing a menu. You want it to have a strong graphic look, elegant and glossy, and yet you&#8217;d rather use a semantic xhtml list with text links.</p>
<p>Your life might get somewhat easier when it comes to headings, with various <a href="http://www.alistapart.com/articles/fir/">CSS Image Replacement techniques.</a> But they&#8217;re not perfect either, and for menus you need be able to hyperlink the image.</p>
<p><strong>Available Solutions</strong></p>
<ol>So what can you do?</p>
<li>Use CSS to format your textual menu to it&#8217;s best abilities, using the same old fonts and maybe a background image to make it look nicer. Don&#8217;t even think about using an interesting font like Arcitectura, or adding some layer effects in PhotoShop, because then you&#8217;ll have to use images.</li>
<li>Employ images, which is not very semantic and requires you to add lots of additional markup, such as <em>img </em>and <em>alt</em> tags, and then you&#8217;ll need to add JavaScript calls for rollovers, and change the image of the current menu item on each page. What&#8217;s next? Design with tables&#8230;?</li>
<li>Design a Flash navigation bar, which is again not very semantic, SO friendly, or accessible. I&#8217;ve nothing against Flash, in fact, I I&#8217;m a huge fan. It can be used to great effect to add an extra dimension to the website with animation and interactivity. But just like salt and pepper, you need to know when to <em>stop </em>adding it. Graphics or drop down menus are not a good enough reason for a Flash menu &#8211; these can always be accomplished by dhtml. A Flash navigation needs to be exceptional (or at least quite interesting) to justify itself, and even then you&#8217;ll need to add textual navigation somewhere on the page, at least for the search engines.</li>
</ol>
<p>Most of my xhtml websites up to date have been achieved with the first method. Take a look at <a href="http://www.neo-archaic.net">my own website</a>, for example &#8211; it uses CSS and background images for formatting, and the font defaults to a generic serif. Even then, it took a lot of work and a bit of extra markup to achieve the look.</p>
<p><strong>NavSwap:</strong><br />
My latest website project (not yet published as this goes to &#8220;print&#8221;, but soon to come) is for a glossy fashion wholesaler, and that meant top-notch graphics, even for the menu. For this I came up with option #4 &#8211; NavSwap, which happens to be the object of this article. It took some code wrangling to write, but is quite easy to implement.<br />
<a id="p25" href="http://blog.neo-archaic.net/wp-content/uploads/2006/07/navSwap.zip">You can download the script and examples here&#8230;</a></p>
<p>NavSwap serves two functions:</p>
<ol>
<li>Swaps semantic xhtml into images, using unobtrusive JavaScript. That is, if JavaScript is unsupported, you get an xhtml text menu, otherwise you get images, complete with alt tags generated on the fly.</li>
<li>Automatically swaps images on rollovers and swaps the current menu item with an active state item on each page.</li>
</ol>
<p><span id="more-23"></span><br />
<strong>The html markup:</strong></p>
<blockquote><p><code>&lt;ul class="nav" id="nav"&gt;<br />
&lt;li&gt;&lt;a href="index.htm"&gt;Home&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="about.htm"&gt;About&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="awards.htm"&gt;Awards&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="emporium.htm"&gt;Emporium&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="suppliers.htm"&gt;Suppliers&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="contact.htm"&gt;Contact&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;</code></p></blockquote>
<p>This is mostly all the html you will require. The script will cycle through the menu items and use each item&#8217;s text value for the name of the image that will be replaced (converted to lowercase, with extension and directory path added), and also uses it to generate the alt text.<br />
If, however, your menu item&#8217;s text requires spaces, characters or markup unsuitable for file names, or is duplicated across menus (with different images), or for any other reason, you can assign a className to the item&#8217;s to override it. For example:</p>
<blockquote><p><code>&lt;li&gt;&lt;a href="joinus.htm" class="joinus" &gt;Join Us &lt;/a&gt;&lt;/li&gt;</code></p></blockquote>
<p>You can also add an <em>id</em>to the <em>body </em>tag. The id&#8217;s value should correspond to the text of the menu item, or the overriding className. This will mark the page as active, and the script will automatically change the image of the corresponding item to the active state:</p>
<blockquote><p><code>&lt;body id="home"&gt;</code></p></blockquote>
<p><strong>Organising The Images:</strong><br />
Next, you&#8217;ll need to prepare the images using PhotoShop or your favourite image editing software. You will need to create images for two or three different states, using the same file names (home.jpg, about.jpg etc.) but organised in different directories:</p>
<ol>
<li><strong>Up:</strong> The images as they appear in their normal, or &#8220;up&#8221; state.<br />
Default directory: &#8220;<strong>images/nav_up/</strong>&#8220;.</li>
<li><strong>Over:</strong> The rollover images.<br />
Default directory: &#8220;<strong>images/nav_over/</strong>&#8220;.</li>
<li><strong>Active:</strong> The active images for each page. By default, the script uses the Over images for the Active state. But it is possible to create separate images for this purpose, by switching a variable in the script.<br />
Default directory: &#8220;<strong>images/nav_over/</strong>&#8221; &#8211; but can be changed, for example, to: &#8220;images/nav_active/&#8221;.</li>
</ol>
<p>These paths are user-customisable by passing the through the following variables in the navSwap.js file:</p>
<blockquote><p><code>var navUpPath = "images/nav_up/";<br />
var navOverPath = "images/nav_over/";<br />
var navActivePath = "images/nav_over/";<br />
</code></p></blockquote>
<p>- Or by passing the new directory paths to the <em>navSwap()</em> method (see below).</p>
<p>The names of the images should be the same throughout the directories, and consistent with the text of the menu items. For example:</p>
<blockquote><p><code>&lt;li&gt;&lt;a href="index.htm"&gt;Home&lt;/a&gt;&lt;/li&gt;<br />
--&gt; home.jpg<br />
&lt;li&gt;&lt;a href="about.htm"&gt;About&lt;/a&gt;&lt;/li&gt;<br />
--&gt; about.jpg<br />
</code></p></blockquote>
<p><strong>The JavaScript:</strong><br />
The text menu will be swapped for the images using JavaScript. To do this, you need to add the link to the external script to the head of the page:</p>
<blockquote><p><code>&lt;script type="text/javascript"<br />
src="scripts/navSwap.js"&gt;&lt;/script&gt; </code></p></blockquote>
<p>And place a call to the method right after the menu:</p>
<blockquote><p><code>&lt;script type="text/javascript"&gt;<br />
navSwap("nav", 90, 30, "jpg", "images/nav_up/", "images/nav_over/");<br />
&lt;/script&gt;</code></p></blockquote>
<p>For each menu or submenu in your document you need to use a separate call to the navSwap method, passing the following optional parameters: (id, w, h, suffix, upPath, overPath, activePath):</p>
<ol>
<li><strong>id:</strong> The id of the menu &lt;ul&gt; that is to be replaced. If this parameter is not passed it defaults to &#8220;nav&#8221;. However, it can be particularly useful if you have multiple menus or submenus. Each of these will need its own id.</li>
<li><strong>w:</strong> Width of the images that replace the menu. The images should all be the same width if this parameter is used.</li>
<li><strong>h:</strong> Height of the images that replace the menu. The images should all be the same height if this parameter is used.</li>
<li><strong>suffix:</strong> The default is &#8220;.jpg&#8221;, but could be changed to &#8220;.gif&#8221; or &#8220;.png&#8221;.</li>
<li><strong>upPath:</strong> The up state images path.</li>
<li><strong>overPath:</strong> The over state images path.</li>
<li><strong>activePath:</strong> The active state images path.</li>
</ol>
<p>The script works with multiple menus, as long as each has it&#8217;s own id, so you could combine this method with <a href="http://www.alistapart.com/articles/dropdowns/">drop-down menus</a> and other techniques.</p>
<p><strong>Design Issues</strong><br />
Of course, menus don&#8217;t always come in the shape of a list, so you will need some CSS formatting to finish off the look. You can use CSS to position the menu, add margins or padding, and maybe change it from vertical to horizontal ( <code>.nav li {display:inline}</code>).</p>
<p>Also, since we&#8217;re adding the JavaScript unobtrusively, you could add a bit of extra styling to the menu with CSS, to make it look as good as it can when JavaScript is disabled.</p>
<p>Unfortunately, I couldn&#8217;t find a way to detect if images are disabled in the browser. If anyone knows how to do that, please let me know. If, however, images are disabled, this technique at least ensures that you see their alt tag replacements instead. This looks better in Firefox than in IE, but at least it&#8217;s still useable.</p>
<p><strong>Examples and download:</strong><br />
<a href="http://blog.neo-archaic.ie/wp-content/uploads/2006/07/navSwap.htm">You can see the example in action here.</a></p>
<p><a id="p25" href="http://blog.neo-archaic.ie/wp-content/uploads/2006/07/navSwap.zip">The script, example and all supporting files can be downloaded here.</a>. If you want to have a look under the hood, the script is commented throughout.</p>
<p>I hope you find it useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://neo-archaic.ie/blog/2006/07/navswap-semantic-xhtml-menus-into-designer-images/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>ObjectSwap Revisited</title>
		<link>http://neo-archaic.ie/blog/2006/06/objectswap-revisited/</link>
		<comments>http://neo-archaic.ie/blog/2006/06/objectswap-revisited/#comments</comments>
		<pubDate>Wed, 14 Jun 2006 09:56:26 +0000</pubDate>
		<dc:creator>Karina</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.neo-archaic.net/blog/2006/06/14/objectswap-revisited.htm</guid>
		<description><![CDATA[Hi everyone,
Since the ObjectSwap article appeared on this blog in April, the code has changed a number of times. To reflect those changes, and give you a bit more insight on how to use it, I bundled up a few ObjectSwap Examples together with the script:
In addition to that, I sent an updated version of the [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everyone,</p>
<p>Since the <a href="http://www.neo-archaic.ie/blog/2006/04/objectswap/">ObjectSwap article</a> appeared on this blog in April, the code has changed a number of times. To reflect those changes, and give you a bit more insight on how to use it, I bundled up a few <a id="p21" href="http://www.neo-archaic.ie/blog/wp-content/uploads/2006/06/ObjectSwap_download.zip">ObjectSwap Examples</a> together with the script:</p>
<p>In addition to that, I sent an updated version of the article to SitePoint, and I&#8217;m happy to announce that it&#8217;s been recently published: <a title="Link to 'ObjectSwap: Bypassing the ActiveX Activation Issue in IE'" href="http://www.sitepoint.com/article/1535" target="_blank">ObjectSwap: Bypassing the ActiveX Activation Issue in IE</a>.</p>
<p>I hope this script has been as useful to you as it has been to me. Thank you for your great feedback and for your patience with all the changes and bugfixes. I hope that no more will be necessary, but if there are, please let me know.</p>
<p>Karina</p>
]]></content:encoded>
			<wfw:commentRss>http://neo-archaic.ie/blog/2006/06/objectswap-revisited/feed/</wfw:commentRss>
		<slash:comments>7</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>
		<item>
		<title>ObjectSwap: Bypassing the ActiveX Activation Issue in Internet Explorer</title>
		<link>http://neo-archaic.ie/blog/2006/04/objectswap/</link>
		<comments>http://neo-archaic.ie/blog/2006/04/objectswap/#comments</comments>
		<pubDate>Tue, 25 Apr 2006 13:56:48 +0000</pubDate>
		<dc:creator>Karina</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.neo-archaic.net/blog/2006/04/25/objectswap.htm</guid>
		<description><![CDATA[The Problem: 
Microsoft&#8217;s decision to change the way ActiveX objects are handled in Internet Explorer, following the patent law suit by EOLAS, has left the developer community in uproar. Soon all the ActiveX controls in Internet Explorer, among them Flash and Shockwave, will need to be activated by a click or a tab and an [...]]]></description>
			<content:encoded><![CDATA[<p><strong>The Problem: </strong></p>
<p>Microsoft&#8217;s decision to change the way ActiveX objects are handled in Internet Explorer, following the patent law suit by EOLAS, has left the developer community in uproar. Soon all the ActiveX controls in Internet Explorer, among them Flash and Shockwave, will need to be activated by a click or a tab and an enter key before they can interact with the control. This is bound to impair the user experience of any website that embeds Flash &#8211; and there are many such sites out there - and make a good deal of trouble for the Flash developers, who are left to clean up the mess.</p>
<p><strong>Available Solutions: </strong></p>
<p>You can bypass the activation requirement by using an externally linked script, such as JavaScript, to embed the ActiveX content. There are currently available solutions for Flash, such as <a href="http://blog.deconcept.com/swfobject">SWFObject</a> and <a href="http://www.bobbyvandersluis.com/ufo">UFO</a>. These work well for embedding new Flash content using JavaScript. But what about existing &lt;object&gt; tags, which will need to be rewritten, or browsers with disabled JavaScript? These would require an alternative solution.</p>
<p><strong>ObjectSwap: </strong></p>
<p>Neo-Archaic&#8217;s ObjectSwap solution (downloadable from <a href="http://www.neo-archaic.net/scripts/objectSwap.js">www.neo-archaic.net/scripts/objectSwap.js</a>) takes all these issues into account. It captures all existing &lt;object&gt; tags and replaces them with themselves. This forces an automatic activation in Internet Explorer, while leaving other browsers alone. <a href="http://www.unfocus.com/projects/PatentMagic/)">Similar solutions</a> have been developed in parallel, but this article will only concern itself with ObjectSwap. Although this solution was developed primarily with Flash in mind, it should also work with other ActiveX controls, such as Shockwave. The script affects all the &lt;object&gt; tags in the page, but the user can exclude specific objects by setting their class name to  &#8221;noswap&#8221;.</p>
<p><span id="more-12"></span></p>
<p><strong>Implementation: </strong></p>
<p>ObjectSwap was written with a view to make implementation as easy as possible, with minimum disruption to existing code. The only change needed to your html page is placing the script in the &lt;head&gt; tag for every page that includes ActiveX objects, like this:</p>
<blockquote>
<pre>&lt;script type="text/javascript" src="scripts/objectSwap.js"&gt; &lt;/script&gt;</pre>
</blockquote>
<p>After that, you can keep on using your favourite technique for embedding ActiveX content. For Flash it&#8217;s either the Adobe/Macromedia default setting using object/embed tags, or the standards compliant technique that uses only the object tag (better known as <a href="http://www.alistapart.com/articles/flashsatay/">Flash Satay</a>).</p>
<p><strong>How it Works: </strong></p>
<p>First, the script cycles through all the &lt;object&gt; tags in the html source code and retrieves their outerHTML value:</p>
<blockquote>
<pre>var objects = document.getElementsByTagName ('object');
for (var i=0; i&lt;objects.length; i++){
  var o = objects[i];
  var h = o.outerHTML;</pre>
</blockquote>
<p>Since Internet Explorer does not include any of the Object&#8217;s param tags in its outerHTML (or innerHTML), they need to be extracted separately into a string:</p>
<blockquote>
<pre>var params = "";
for (var j = 0; ji&lt;o.childNodes.length; j++) {
	var p = o.childNodes[j];
	if (p.tagName == "PARAM"){
			....
		params += p.outerHTML;
	}
}</pre>
</blockquote>
<p>The generated  &#8220;params&#8221; string is spliced into the outerHTML code:</p>
<blockquote>
<pre>var tag = h.split("&gt;")[0] + "&gt;";
var newObject = tag + params + o.innerHTML + " ";</pre>
</blockquote>
<p>And, finally, the new generated html replaces the original:</p>
<blockquote>
<pre>o.outerHTML = newObject;</pre>
</blockquote>
<p><strong>Hiding The Objects: </strong></p>
<p>There are still a few things to be done. First of all, we want to prevent the objects from loading twice - once when they are initiated in the html code, and again after they are swapped. This is achieved by writing a new stylesheet to the document before the page loads. The style uses display:none to take the object out of the document&#8217;s flaw and delay their loading until the swap is complete:</p>
<blockquote>
<pre>document.write ("&lt;style id='hideObject'&gt; object {display:none;} &lt;/style&gt;");</pre>
</blockquote>
<p>After the swap, the style is disabled and the objects are allowed to load:</p>
<blockquote>
<pre>document.getElementById("hideObject").disabled = true;</pre>
</blockquote>
<p><strong>Initiating The ObjectSwap: </strong></p>
<p>The function must be called after all the objects have loaded by binding the objectSwap() function to the window.onload event. The catch, however, is that other linked scripts in your page might have their functions bound to the same event; the last script to do so will override all the earlier bindings, causing other scripts to fail. This is resolved by catching existing functions bound to the event, and calling them as well:</p>
<blockquote>
<pre>var tempFunc = window.onload;
window.onload = function(){
	if (typeof (tempFunc) == "function"){
		try{
			tempFunc();
		} catch(e){}
	}
	objectSwap();
}</pre>
</blockquote>
<p>This will naturally fail if following scripts use window.onload, so you must ensure that either this script comes last, or the following scripts use a similar technique.</p>
<p><strong>Flash Detection: </strong></p>
<p>So far, so good. But since we&#8217;re already using JavaScript, why not avail of the opportunity to add some Flash Detection to the mix? This can be achieved by adding a new param definition to the flash object, for example:</p>
<blockquote>
<pre>&lt;param name="flashVersion" value="6" /&gt;</pre>
</blockquote>
<p>As it cycles through the parameters list, the script checks for the existence of this param and, if it finds it, calls the flash detection method. If it doesn&#8217;t find the Flash plugin, or the installed version number is less than the one required, the code turns the object into a simple &lt;div&gt; and displays the alternative content. This content must already reside inside the &lt;object&gt; tag, and display alternative text, images, links to the Flash installer, and so forth. The object tag normally ignores this content if Flash is present. Of course, you can also chose to ignore the flash detection option or use Adobe&#8217;s express installation for Flash 8 instead.</p>
<p><strong>Browser Support: </strong></p>
<p>The activation issue of ActiveX objects affects only Internet Explorer, and so most of the code will only affect IE. The flash detection code, however, needs to work with other browsers as well. This means that the objectSwap() function will be called for all the browsers, perform the flash detection service if required, but will only execute the Object Swap on IE, leaving other browsers unaffected.</p>
<p><strong>Examples and Download: </strong></p>
<p>You can find an example of this code in use on <a href="http://www.neo-archaic.net/">the Neo-Archaic home page</a> and the <a href="http://www.neo-archaic.net/images.htm">images page in the gallery</a>. Both pages use the Flash Satay method to embed Flash. The script is located here: <a href="http://www.neo-archaic.net/scripts/objectSwap.js">http://www.neo-archaic.net/scripts/objectSwap.js </a>.</p>
<p>A new examples bundle (<em>last updated in Februray 2008</em>) can be found here:<a id="p21" href="http://blog.neo-archaic.net/wp-content/uploads/2008/02/ObjectSwap_download_080206.zip"> ObjectSwap Update</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://neo-archaic.ie/blog/2006/04/objectswap/feed/</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
	</channel>
</rss>
