<?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>Blog.BitTube.com &#187; Localization</title>
	<atom:link href="http://blog.bittube.com/category/localization/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bittube.com</link>
	<description>flash examples and development for the web, PSP Flash Player, Mobile flash lite player. All mixed up with some random thoughts, photos, images and poetic words</description>
	<lastBuildDate>Mon, 01 Feb 2010 13:58:16 +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>Flash on the Beach 07 Presentation Files</title>
		<link>http://blog.bittube.com/2007/11/11/flash-on-the-beach-07-presentation-files/</link>
		<comments>http://blog.bittube.com/2007/11/11/flash-on-the-beach-07-presentation-files/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 23:32:54 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[BitTube Thoughts]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Lite]]></category>
		<category><![CDATA[Localization]]></category>
		<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[Conference]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[FOTB 07]]></category>
		<category><![CDATA[Localisation]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://blog.bittube.com/2007/11/11/flash-on-the-beach-07-presentation-files/</guid>
		<description><![CDATA[FOTB 07. What can I say. Incredible. First off let me say a very big thank you to John Davey. John did a great job, I can only guess the amount of organization involved in Flash on the beach, the speaker list and session line up were brilliant, and the shwag was top draw, both [...]]]></description>
			<content:encoded><![CDATA[<p>FOTB 07. What can I say. Incredible. First off let me say a very big thank you to John Davey. John did a great job, I can only guess the amount of organization involved in Flash on the beach, the speaker list and session line up were brilliant, and the shwag was top draw, both for attendees and speakers. It was a pleasure and an honor to have the chance to be involved in a presenting capacity. Thank you for inviting me John.<br />
<br />
At the event I presented a session that discussed the issues of Localisation, and to a lesser extent my new love, Mobilisation. This was my first time presenting at a larger event like this. Certainly I was nervous, and I am sure that there were tell tale cracks in my voice a few times as I went through my slides. As I got in to the flow of the presentation I think I settled in a little.<br />
<br />
I did have a slight issue with timing, which meant I rushed the last few slides, unfortunately, as a result I had to drop one of the examples. It also meant that I missed the opportunity to ask questions of the people that attended if they had any. So my apologies there.<br />
<br />
Any way below is the link to my speakers notes, and also the examples from my session on Localisation.<br />
<br />
<a href='http://blog.bittube.com/wp-content/uploads/2007/11/presentationexport.zip' title='Flash on the Beach 07 Presentation Files'>Flash on the Beach 07 Localisation Presentation Files</a><br />
<br />
On a related note I have uploaded to Flickr a few of the images my little lomo camera captured of the event. You can see them over on my <a href="http://flickr.com/photos/bittube/sets/72157603012165872/">Flickr stream</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bittube.com/2007/11/11/flash-on-the-beach-07-presentation-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Landrover Go Beyond, Phase 2 Launched</title>
		<link>http://blog.bittube.com/2006/08/04/landrover-go-beyond-phase-2-launched/</link>
		<comments>http://blog.bittube.com/2006/08/04/landrover-go-beyond-phase-2-launched/#comments</comments>
		<pubDate>Fri, 04 Aug 2006 10:09:51 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[BitTube Work]]></category>
		<category><![CDATA[Flash 8]]></category>
		<category><![CDATA[Localization]]></category>

		<guid isPermaLink="false">http://blog.bittube.com/2006/08/04/landrover-go-beyond-phase-2-launched/</guid>
		<description><![CDATA[Wunderman Interactive have just launched the second phase to the Land Rover Go Beyond site. The site offers user generated input to the content base and utilises a lot of Flash 8 features, with the back end being controlled through Flash Remoting. The challenges on such a flexible project are immense, it was a pleasure [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.wundermaninteractive.com">Wunderman Interactive</a> have just launched the second phase to the <a href="http://www.landrover.com/gobeyond/">Land Rover Go Beyond site</a>. The site offers user generated input to the content base and utilises a lot of Flash 8 features, with the back end being controlled through Flash Remoting. The challenges on such a flexible project are immense, it was a pleasure to be involved. Congratulations to everyone who touched the project. I imagine there have been a number of late nights in Camden recently <img src='http://blog.bittube.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bittube.com/2006/08/04/landrover-go-beyond-phase-2-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Localization &#8211; Managing Text &amp; Fonts pt.1</title>
		<link>http://blog.bittube.com/2006/08/03/flash-localization-managing-text-fonts-pt1/</link>
		<comments>http://blog.bittube.com/2006/08/03/flash-localization-managing-text-fonts-pt1/#comments</comments>
		<pubDate>Thu, 03 Aug 2006 09:43:12 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[BitTube Work]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Flash 8]]></category>
		<category><![CDATA[LFPUG]]></category>
		<category><![CDATA[Localization]]></category>

		<guid isPermaLink="false">http://blog.bittube.com/2006/08/03/flash-localization-managing-text-fonts-pt1/</guid>
		<description><![CDATA[I have had a number of emails, messenger texts, and commentâ€™s on my blog, asking for further information from my presentation notes on localizing flash. Localizing flash has such a wide scope of information, when I prepared my presentation I did take the â€˜data blastâ€™ approach of delivery. 
I had a good idea the area(s) [...]]]></description>
			<content:encoded><![CDATA[<p>I have had a number of emails, messenger texts, and commentâ€™s on my blog, asking for further information from my <a id="p133" href="http://blog.bittube.com/wp-content/uploads/2006/08/Flash%20Card.doc">presentation notes</a> on localizing flash. Localizing flash has such a wide scope of information, when I prepared my presentation I did take the â€˜data blastâ€™ approach of delivery. </p>
<p>I had a good idea the area(s) that people might like more in depth information, but I also wanted to take into account some broader work flow and process issues that I feel really need to be discussed. In this post I would like to present some more detailed information regarding one of the slides I used at the <a href="http://www.lfpug.com/">LFPUG</a> <a href="http://www.lfpug.com/presentations/2006_07_27_williamson/">presentation</a> that, as expected, has generated a lot of feed back.</p>
<p><strong>Managing Text & Fonts</strong></p>
<p><span id="more-131"></span></p>
<p>During the presentation I had split this key area of localizing flash content into two sub-headings, each sub-heading had a number of points I wanted to cover.</p>
<p>Part 1 - Fonts</p>
<ul>
<li>Understanding character sets, character maps & glyphs tables.</li>
<li>Using embedded fonts and or non-embedded fonts.</li>
<li>Flash 8 and advanced anti-aliasing.</li>
<li>File size implications of fonts in flash.</li>
</ul>
<p>Part 2 - Construction & Style</p>
<ul>
<li>Using font symbols.</li>
<li>Using dynamic text fields.</li>
<li>Shared fonts, font libraries and font symbols.</li>
<li>The TextFormatObject & CSS.</li>
</ul>
<p><strong>Understanding Character sets, character mapping and glyph tables</strong></p>
<p>Before getting into the nitty gritty of the practical side of how you go about managing the text based content in a localized flash project, I want to cover off the underlying concepts and processes that support it. Hopefully my terminology will be correct enough for the purpose of this article, feel free to leave comments correcting me where appropriate.</p>
<p>When trying to localize text based content in flash you will need to understand a little regarding Unicode, and how the fonts and applications you are using support it. So what is Unicode.</p>
<blockquote><p>Unicode provides a unique number for every character, no matter what the platform, no matter what the program, no matter what the language</p></blockquote>
<p>In addition to this Unicode characters are grouped into character sets. Within flash these can be found in the embed fonts options of the text field properties inspector.</p>
<p><a id="p132" rel="attachment" class="imagelink" href="http://blog.bittube.com/2006/08/03/flash-localization-managing-text-fonts-pt1/the-embed-fonts-palette-in-flash/" title="The Embed Fonts Palette in Flash"><img id="image132" src="http://blog.bittube.com/wp-content/uploads/2006/08/embedfonts.gif" alt="The Embed Fonts Palette in Flash" /></a></p>
<p>As flash developers we should be able publish content to pretty much any language on the planet. "we should be able". What often upsets this localization utopia is that many, many times we will find that the fonts provided, or requested within a project don't completely support Unicode. If this is the case it will result in a number of display issues within your flash production, including missing characters, or often a "?" or a square symbol, being displayed instead. Another, slightly less common problem can be a poorly constructed font that has characters incorrectly mapped. This would result, for example, in the glyph for "A" being returned and displayed as "B". </p>
<p>In actual fact there are few font faces that do fully support the whole Unicode table, and generally they are the standard system font faces for "sans", "serif", and "monospace" display, (Arial, Times, Courier on Windows). In part this is because to implement a complete Unicode font would be a time consuming and costly, production. There are around 65,000 (I think?) individual Unicode character codes to support, meaning over 65,000 characters to produce and test for some poor font maker.</p>
<p>With this in mind it is always worth checking the level of Unicode support that the fonts you are being asked to use support, you will save yourself a lot of tears as your project progresses.</p>
<p>Having assessed the support that your fonts offer for Unicode you need to find an acceptable level of Font Embedding. I have found this to be very similar in approach to deciding the compression that is applied to an image for the web. There is always going to be a trade off between the number of fonts you embed, and the final file size of a project. For example as a test, and to refresh my memory, I did an export of a flash movie that simply had a Dynamic text Field supporting Arial MS Unicode and embedding all character sets. The resultant SWF was 9.7MB uncompressed (7.8MB compressed). </p>
<p>The reason for large file size is that when flash embeds fonts for use in the player they are essentially converted to vector shapes that are embedded in your movie. When you get to some of the more exotic languages (Asian and Right to Left Languages for example) the individual glyphs are very elaborate, these results in some complex vectors, and thus larger file sizes. In addition the shear number of characters is HUGE, a number of languages have many more individual characters than us Europeans, the basic Korean character set has 3454 glyphs!</p>
<p>As of flash 8 the use of embedded fonts becomes less of an issue, with respect to visually acceptable text rendering. Making use of the advanced anti-aliasing options we are able to yield far better readability than is possible even with embedded font glyphs. However there are still some issues related to these options when trying to animate and scale text that is displayed using them. So depending on the design and visual treatment you are dealing with you will need to keep this in mind.</p>
<p>In my next post I will look at how to manage fonts within your files, it will roughly follow the structure of the 'part 2' heading above apply some of the <a href="http://blog.bittube.com/2006/07/28/notes-on-loaclizing-flash/">code examples from my brief previous post</a>.</p>
<p>References from this Article<br />
<a href="http://www.unicode.org/">Unicode.org, an invaluable source of information regarding UTF and Unicode</a><br />
<a href="http://www.atm.ox.ac.uk/user/iwi/charmap.html ">Online Unicode look up table</a><br />
<a href="http://blog.bittube.com/2006/03/31/90/">Information on Flash 8 text rendering issue in Saffron</a><br />
<a href="http://blog.bittube.com/2006/04/01/flash-8-fonttext-scaling-bug-cont/">Further information on Flash 8 text rendering issue in Saffron</a><br />
<a id="p133" href="http://blog.bittube.com/wp-content/uploads/2006/08/Flash%20Card.doc">LFPUG Presentation Running Notes</a></p>
<p>Links in this Article<br />
<a href="http://www.lfpug.com/">London Flash Platform User Group</a><br />
<a href="http://www.lfpug.com/presentations/2006_07_27_williamson/">The presentation slides I used. More details are in the running notes above.</a><br />
<a href="http://blog.bittube.com/2006/07/28/notes-on-loaclizing-flash/">Code Snippets for localizing flash</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bittube.com/2006/08/03/flash-localization-managing-text-fonts-pt1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Notes On Localizing Flash</title>
		<link>http://blog.bittube.com/2006/07/28/notes-on-loaclizing-flash/</link>
		<comments>http://blog.bittube.com/2006/07/28/notes-on-loaclizing-flash/#comments</comments>
		<pubDate>Fri, 28 Jul 2006 15:34:24 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[BitTube Work]]></category>
		<category><![CDATA[Flash 8]]></category>
		<category><![CDATA[Localization]]></category>

		<guid isPermaLink="false">http://blog.bittube.com/2006/07/28/notes-on-loaclizing-flash/</guid>
		<description><![CDATA[So itâ€™s the day after my presentation on Flash Localization. I was quite happy with how things panned out, given I had been a presentation virgin prior to last night. The presentation didn't hurt nearly as much as I was afraid of. At least it didn't hurt me  .
Thanks to AKQA for the venue, [...]]]></description>
			<content:encoded><![CDATA[<p>So itâ€™s the day after my presentation on <a href="http://www.lfpug.com/">Flash Localization</a>. I was quite happy with how things panned out, given I had been a presentation virgin prior to last night. The presentation didn't hurt nearly as much as I was afraid of. At least it didn't hurt me <img src='http://blog.bittube.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .</p>
<p>Thanks to <a href="http://www.akqa.com/">AKQA</a> for the venue, support, beer and pizza, very nice it was to. Thanks also to <a href="http://www.tink.ws/blog/">Tink</a> for the opportunity to break my cherry, so to speak. And finally thanks to every one that came along to listen to me gibbering on. It must be said this is a subject I have come to build a love-hate relationship with over the many years I have spent in the field. I love the challenge of working to localise the content. I hate the fact that Flash makes even some of the most mundane solutions or Ideas a HUGE Challenge. It would seem I am not alone in this.</p>
<p>In addition to nattering on myself, I also received some useful information as well, which was great. So thanks for correcting my terminology of Polish as a Cyrillic based Language. Apparently it's an Extended European language, which would account for me having issues with that one. <img src='http://blog.bittube.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Something I didn't do last night was to show any code. This was due to operating on a Mac (thanks again <a href="http://www.tink.ws/blog/">Tink</a>) and not being confident enough in my app switching on the alien technology. Below are some snippets I made reference to.</p>
<p><span id="more-130"></span></p>
<p>Using <code>System.capabilities.playerType</code> to allow altered path references dependent on whether you are testing through a browser.<br />
[AS]<br />
/*<br />
str_xml variable is a string appended to the SWF file name in the HTML<br />
this is used to dictate which XML language version the flash movie<br />
will load and display. If no XML variable is detected then the movie will<br />
default to the UK English version (en-GD) this allows for easy testing in the<br />
flash IDE<br />
*/<br />
var str_defaultLang:String = "en-GB";<br />
// use the playerType to asertain whether the movie is playing in the browser or not and alter the Pathing acordingly<br />
var str_siteRoot: = (System.capabilities.playerType == "External") ? "../" : "";<br />
var str_xml:String = (str_xml == undefined) ? str_defaultLang : str_xml;<br />
var str_xmlSource:String = str_siteRoot + "xml/structure" + str_xml + ".xml";<br />
[/AS]<br />
A simple (nasty) prototype to string that offers find and replace functionality. This is then shown searching for pesky windows carriage return and line feed symbols and replacing them with single <code>newline</code> statement. I hope the URL encoded values are correct; I have actually done this from memory. Please let me know it this not the case.</p>
<p>[AS]<br />
/*String object prototype adds find and replace functionality*/<br />
/*<br />
usage : str_myString.replace(str_stringToFind, str_stringToReplace);<br />
str_stringToFind: string you wish to find in 'str_myString'<br />
str_stringToReplace: string you wish to replace str_stringToFind with in 'str_myString'<br />
returns: str_myString with all occurances of str_stringToFind replaced with str_stringToReplace<br />
*/<br />
String.prototype.replace = function(str_f:String, str_r:String):String<br />
{<br />
  return (this.split(str_f).join(str_r));<br />
}<br />
var myString:String<br />
myString = escape(myString)<br />
myString = myString.replace("%0A%0D", newline);<br />
myString = unescape(myString);<br />
[/AS]</p>
<p>Finally a snippet showing how to store Country/Language code combinations in order to switch fonts to Arial MS Unicode in those more troublesome language character sets.</p>
<p>[AS]<br />
/* Array to list non supported county/language codes */<br />
var arr_nonSuportedCC:Array = new Array("gr-GR", "ru-RU", "tr-TR", "cr-CR", "kr-KR", "pl-PL", "si-SI", "cs-CZ", "da-DK", "el-GR", "sv-FI", "hu-HU");<br />
/*<br />
setFontFace loops trough an array of Values that represent Country/language codes for the<br />
current content, if the current document country code is in this list then return true to<br />
say use a default font face that supports the countries glyphs more fully.<br />
e.g Arial Unicode MS for russian/greek/cyrilic languages<br />
*/<br />
var setFontFace = function(str_CC:String, arr_CountryList:Array):Boolean<br />
{<br />
	var bln_retval:Boolean = false;<br />
	var i:Number = 0;<br />
	var iTotal:Number = arr_CountryList.length;<br />
	var str_curCC:String;<br />
	str_CC = str_CC.toLowerCase()<br />
	while(i < iTotal)<br />
	{<br />
		str_curCC = arr_CountryList[i].toLowerCase();<br />
		if (str_CC == str_curCC)<br />
		{<br />
			bln_retval = true;<br />
			i = iTotal;<br />
		}<br />
		++i;<br />
	}<br />
	return bln_retval;<br />
}<br />
/* switch to determin if the font glyphs are supported*/<br />
var bln_useArial:Boolean = setFontFace(str_xml, arr_nonSuportedCC);<br />
var str_defaultDisplayFont:String<br />
str_defaultDisplayFont = bln_useArial ? "Arial Unicode MS" : "HelveticaNeueLT Pro 43 LtEx";<br />
// Text Formating object that will use the 'default' or 'switched' font<br />
__tf_navigationDefault = new TextFormat()<br />
__tf_navigationDefault.font = str_defaultDisplayFont<br />
__tf_navigationDefault.size = 14;<br />
__tf_navigationDefault.color = 0x102C4A;<br />
[/AS]</p>
<p>This last Snippet could also be extended to switch Font Size based on Asian Language or country codes as well. In addition I have used a similar script to check for 'preferred' fonts based on </code><code>TextField.getFontList()</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bittube.com/2006/07/28/notes-on-loaclizing-flash/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ford Multilingual Micro Site</title>
		<link>http://blog.bittube.com/2006/01/16/ford-multilingual-micro-site/</link>
		<comments>http://blog.bittube.com/2006/01/16/ford-multilingual-micro-site/#comments</comments>
		<pubDate>Mon, 16 Jan 2006 10:38:25 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[BitTube Work]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Localization]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://blog.bittube.com/?p=51</guid>
		<description><![CDATA[So I have been pretty busy of late with development of a simple Ford Micro Site. This is certainly one of the most interesting projects i have been able to work on in a while, and I have to say seems to be showing a trend towards flexible, yet visually strong multilingual sites.
Previously i had [...]]]></description>
			<content:encoded><![CDATA[<p>So I have been pretty busy of late with development of a simple <a href="http://www.fordeumicrosites.com/sav06/sav_microsite.asp?xml=nl-nl">Ford Micro Site</a>. This is certainly one of the most interesting projects i have been able to work on in a while, and I have to say seems to be showing a trend towards flexible, yet visually strong multilingual sites.<br />
Previously i had noticed that if a Flash site or presentation was required in multiple languages then the likelihood was that the creative would be paired down. The main thinking in this seemed to be a direct result of font issues, and also some of the limitations with regard to non-embedded text.</p>
<p>The Ford SAV site will be presented in 16 languages. The content and structure is stored and managed via external XML documents. All images and audio are managed via the xml along with limited control over the colours and 'skin' elements such as the background tints and locations.<br />
<span id="more-51"></span><br />
There are a number of components that I produced specifically for the project; one manages the ‘sproingy’ navigation for example. Other components/classes were developed with less specific implementation in mind. For example the initial development made use of the combination <a target="_blank" title="LoaderClasss Link" href="http://www.bokelberg.de/cgi-bin/mt-search.cgi?IncludeBlogs=1&search=loaderclass">LoaderClass</a>,  <a target="_blank" title="LoaderQueueManager" href="http://tinlion.com/blog/2004/03/11/loader-queue-manager-v15-mx/#more-6">LoaderQueueManager</a>, <a target="_blank" title="LoaderQueue Link" href="http://www.v-i-a.net/blog/archives/000021.html">LoaderQueue</a>. However somewhere between the need for 4 class files, the mixed of AS 1.0/AS 2.0, the 3 different authors across the files, a modified folder structure and the French only comments in some places. I decided to re-factor this simple but effective idea into a simple LoadQueueManger AS2.0 class that simply implements the inbuilt EventDispatcher Class.<br />
Presented is only a partial implementation of this great set of files as I only needed a basic Queue and Priority functionality but once the other methods are fleshed out I will update the code here.</p>
<p>The following code is provided as is.<br />
[as]/*=====================================================<br />
LoadQueueManager<br />
var myLoadQueManager:LoadQueueManager = new LoadQueueManager();<br />
var myLoadItemID:Number = myLoadQueManager.load(targetObject, URL, [listenerObject]);<br />
myLoadQueManager.addListener(listenerObject);</p>
<p>TODO:<br />
	complete accessors for: </p>
<p>	loadDuration<br />
	steps<br />
	loadTime</p>
<p>	implement loadObjectType rather than trying to work out what we are loading autoMagically</p>
<p>	seperate object listeners, currently all loading objects listeners all listen<br />
	to all loading objects, there should be a smarter event modle that allows<br />
	individual listeners to just listen to their specific loading objects. Not all loading objects<br />
	Allthought e abillity to listen to all objects does allow for a global loading control to<br />
	listen to the entire load queue progress</p>
<p>Development Based on:<br />
=====================================================<br />
LoaderItem Class author Ralf Bokelberg http://www.helpqlodhelp.com/blog/<br />
LoaderQueue Class author Bryan Ledford<br />
LoaderQueue Class author erixtekila copyleft http://www.v-i-a.net </p>
<p> *  @class LoaderClass<br />
 *  Implements Colin Moock's Preloading Api as proposed<br />
 *  at http://www.moock.org/blog/archives/000010.html<br />
 *<br />
 *  This code is supplied as is, use it at your own risk<br />
 *  and please don't remove this header.<br />
 *<br />
 *  If you plan to use the code on a commercial site,<br />
 * 	we would happily receive a donation to<br />
 *  paypal@helpqlodhelp.com. See the docs for the details<br />
 *<br />
 *  Version 1.02<br />
 *	Date 2003/06/16<br />
 *  Author Ralf Bokelberg<br />
 *<br />
 *  Version 1.2<br />
 *  Date 2003/10/27<br />
 *  Author Bryan Ledford<br />
 *  Rewrote for AS 2.0<br />
 *	Added Alex Uhlmann's Priority methods [setPriority, getPriority]<br />
 *</p>
<p> i Hope this information is complete enough not please advise.<br />
=====================================================*/</p>
<p>import mx.events.EventDispatcher;<br />
class LoadQueueManager<br />
{<br />
	private static var symbolName:String = "LoadQueueManager";<br />
	private static var className:String = "LoadQueueManager";<br />
	private static var _instance:LoadQueueManager;</p>
<p>	private static var __int_defaultTimeoutMS:Number = 10000;<br />
	private static var __int_defaultIntervalMS:Number = 100;<br />
	private static var __int_defaultMinSteps:Number = 5;</p>
<p>	private var __arr_curQueue:Array;</p>
<p>	private var __bln_autoLoad:Boolean = true;<br />
	private var __bln_isLoading:Boolean = false;<br />
	private var __bln_isPaused:Boolean = false;<br />
	private var __bln_hasTimedOut:Boolean = false;</p>
<p>	private var __int_loadDurationCurrent:Number = 0;<br />
	private var __int_loadDurationTotal:Number = 0;<br />
	private var __int_loadSpeed:Number = 0;<br />
	private var __int_loadTimeCurrent:Number = 0;<br />
	private var __int_loadTimeTotal:Number = 0;<br />
	private var __int_percentLoadedCurrent:Number = 0;<br />
	private var __int_percentLoadedTotal:Number = 0;<br />
	private var __int_bytesLoaded:Number = 0;<br />
	private var __int_bytesTotal:Number = 0;<br />
	private var __int_timeOutMS:Number = 10000;<br />
	private var __int_loadIntervalMS:Number = 100;<br />
	private var __int_steps:Number = 1;<br />
	private var __int_loadInterval:Number;<br />
	private var __int_timeInterval:Number;<br />
	private var __int_timeCurrent:Number = 0;</p>
<p>	private var __obj_target:Number;<br />
	private var __obj_targetObject:Number;<br />
	private var __obj_currentLoadTarget:Object;<br />
	private var __obj_currentLoadListener:Object;<br />
	private var __obj_currentLoadObject:Object;</p>
<p>	private var __mc_mcLoadSnapShot:MovieClip;</p>
<p>	private var __str_currentLoadURL:String = "";</p>
<p>	function dispatchEvent(){};<br />
 	function addEventListener(){};<br />
 	function removeEventListener(){};</p>
<p>	public function LoadQueueManager(int_timeoutMs:Number, int_intervalMs:Number, int_minSteps:Number)<br />
	{<br />
		EventDispatcher.initialize(this);<br />
		__arr_curQueue = new Array();<br />
	}</p>
<p>	/*=====================================================<br />
	LoadQueueManager.addListener();<br />
	used to associate a listener to all displatched events</p>
<p>	onLoadStarted<br />
	onLoadProcess<br />
	onLoadItemComplete<br />
	onLoadComplete<br />
	onLoadPause<br />
	onLoadResume<br />
	onLoadInvalidObject<br />
	onTimeOutMSSet<br />
	onIntervalMSSet<br />
	onLoadItmeTimedOut<br />
	=====================================================*/<br />
	public function addListener(obj_listner:Object):Void<br />
	{<br />
		addEventListener("onLoadStarted", obj_listner);<br />
		addEventListener("onLoadObserveStarted", obj_listner);<br />
		addEventListener("onLoadProgress", obj_listner);<br />
		addEventListener("onLoadItemComplete", obj_listner);<br />
		addEventListener("onLoadComplete", obj_listner);<br />
		addEventListener("onLoadPause", obj_listner);<br />
		addEventListener("onLoadResume", obj_listner);<br />
		addEventListener("onLoadInvalidObject", obj_listner);<br />
		addEventListener("onTimeOutMSSet", obj_listner);<br />
		addEventListener("onIntervalMSSet", obj_listner);<br />
		addEventListener("onLoadItmeTimedOut", obj_listner);<br />
	}</p>
<p>	/*=====================================================<br />
	LoadQueueManager.removeListener();<br />
	used to associate a listener to all displatched events</p>
<p>	onLoadStarted<br />
	onLoadProcess<br />
	onLoadItemComplete<br />
	onLoadComplete<br />
	onLoadPause<br />
	onLoadResume<br />
	onLoadInvalidObject<br />
	onTimeOutMSSet<br />
	onIntervalMSSet<br />
	onLoadItmeTimedOut<br />
	=====================================================*/<br />
	public function removeListener(obj_listner:Object):Void<br />
	{<br />
		removeEventListener("onLoadStarted", obj_listner);<br />
		removeEventListener("onLoadObserveStarted", obj_listner);<br />
		removeEventListener("onLoadProgress", obj_listner);<br />
		removeEventListener("onLoadItemComplete", obj_listner);<br />
		removeEventListener("onLoadComplete", obj_listner);<br />
		removeEventListener("onLoadPause", obj_listner);<br />
		removeEventListener("onLoadResume", obj_listner);<br />
		removeEventListener("onLoadInvalidObject", obj_listner);<br />
		removeEventListener("onTimeOutMSSet", obj_listner);<br />
		removeEventListener("onIntervalMSSet", obj_listner);<br />
		removeEventListener("onLoadItmeTimedOut", obj_listner);<br />
	}<br />
	/*=====================================================<br />
	Que Manager Control Methods<br />
	=====================================================*/</p>
<p>	/*=====================================================<br />
	LoadQueueManager.load();<br />
	@param obj_target		a reference to the object that will hold the loaded asset<br />
	@param str_URl			the url to the asset that will be loaded<br />
	@param obj_listener		[option] a listener object specifically for this load item<br />
	@return					the index of the item in teh load queue array of the loadManager<br />
	=====================================================*/<br />
	public function load(obj_target:Object, str_URl:String, obj_listener:Object):Number<br />
	{<br />
		var int_retVal:Number = -1;<br />
		var bln_validLoadObject:Boolean = (locationToTarget(obj_target) != undefined);<br />
		if(obj_listener != undefined) addListener(obj_listener);</p>
<p>		if(!bln_validLoadObject)<br />
		{<br />
			dispatchEvent({type:"onLoadInvalidObject",target:this});<br />
			return int_retVal;<br />
		}</p>
<p>		var obj_loadObj:Object = new Object();<br />
		obj_loadObj._target = locationToTarget(obj_target);<br />
		obj_loadObj._url = str_URl;<br />
		obj_loadObj._listener = obj_listener;<br />
		obj_loadObj._priority = ((loadQueue.push(obj_loadObj)) -1);</p>
<p>		int_retVal = obj_loadObj._priority;<br />
		if (!isLoading && autoLoad)<br />
		{<br />
			dispatchEvent({type:"onLoadStarted",target:this, loadObject:currentLoadObject});<br />
			startLoading();<br />
		}</p>
<p>		return int_retVal;<br />
	}</p>
<p>	/*=====================================================<br />
	LoadQueueManager.loadAtPriority();<br />
	pauses the current load operation if the priority is 0, any partially loaded asset will be unloaded and lost.<br />
	adds the target clip at the priority specified by int_priority<br />
	Then restarts the load que manager if it was paused, or resarts the load queue is it is not loading.<br />
	@param obj_target		a reference to the object that will hold the loaded asset<br />
	@param str_URl			the url to the asset that will be loaded<br />
	@param int_priority		an integer that represents the priority the object should be loaded at<br />
	@param obj_listener		[option] a listener object specifically for this load item<br />
	@return					the index of the item in teh load queue array of the loadManager<br />
	=====================================================*/<br />
	public function loadAtPriority(obj_target:Object, str_URl:String, int_priority:Number, obj_listener:Object):Number<br />
	{<br />
		if((int_priority === 0) && isLoading)pause();</p>
<p>		var int_retVal:Number = -1;<br />
		var bln_validLoadObject:Boolean = (locationToTarget(obj_target) != undefined);<br />
		if(obj_listener != undefined) addListener(obj_listener);</p>
<p>		if(!bln_validLoadObject)<br />
		{<br />
			dispatchEvent({type:"onLoadInvalidObject",target:this});<br />
			return int_retVal;<br />
		}</p>
<p>		var obj_loadObj:Object = new Object();<br />
		obj_loadObj._target = locationToTarget(obj_target);<br />
		obj_loadObj._url = str_URl;<br />
		obj_loadObj._listener = obj_listener;<br />
		obj_loadObj._priority = int_priority;<br />
		loadQueue.splice(int_priority, 0, obj_loadObj);</p>
<p>		trace("load queue ==  "+ loadQueue + " -- " + isPaused + " --  " + isLoading);</p>
<p>		int_retVal = obj_loadObj._priority;</p>
<p>		if (!isLoading && autoLoad)<br />
		{<br />
			dispatchEvent({type:"onLoadStarted",target:this, loadObject:currentLoadObject});<br />
			startLoading();<br />
		}<br />
		else if (isPaused)<br />
		{<br />
			resume();<br />
		}</p>
<p>		return int_retVal;<br />
	}</p>
<p>	/*=====================================================<br />
	LoadQueueManager.stop();<br />
	stops the load manager and resets the current load queue<br />
	similar to clear in teh old load queu manager<br />
	=====================================================*/<br />
	public function stop():Void<br />
	{<br />
		endInterval();<br />
		__arr_curQueue.length = 0;<br />
		__arr_curQueue = undefined;<br />
		delete __arr_curQueue;<br />
		__arr_curQueue = new Array();<br />
		__bln_isPaused = __bln_isLoading = false;<br />
	}</p>
<p>	/*=====================================================<br />
	LoadQueueManager.observe();<br />
	pauses the current load operation any partially loaded asset will be unloaded and lost.<br />
	Then and adds the target clip as a priority 0 object to the load queue<br />
	Then restarts the load que manager.<br />
	@param obj_target		a reference to the object that will hold the loaded asset<br />
	@param obj_listener		[option] a listener object specifically for this load item<br />
	=====================================================*/<br />
	public function observe(obj_target:Object, obj_listener:Object):Void<br />
	{<br />
		if(isLoading)pause();<br />
		var bln_validLoadObject:Boolean = (locationToTarget(obj_target) != undefined);<br />
		if(obj_listener != undefined) addListener(obj_listener);</p>
<p>		if(!bln_validLoadObject)<br />
		{<br />
			dispatchEvent({type:"onLoadInvalidObject",target:this});<br />
			return;<br />
		}</p>
<p>		var obj_loadObj:Object = new Object();<br />
		obj_loadObj._target = locationToTarget(obj_target);<br />
		obj_loadObj._url = undefined;<br />
		obj_loadObj._listener = obj_listener;<br />
		obj_loadObj._priority = undefined;</p>
<p>		loadQueue.splice(0, 0, obj_loadObj);</p>
<p>		if(isPaused)<br />
		{<br />
			resume();<br />
		}<br />
		else<br />
		{<br />
			startLoading();<br />
		}<br />
		dispatchEvent({type:"onLoadObserveStarted",target:this, loadObject:currentLoadObject});<br />
	}</p>
<p>	/*=====================================================<br />
	LoadQueueManager.pause();<br />
	pauses the current load operation any partially loaded asset will be unloaded and lost.<br />
	=====================================================*/<br />
	public function pause():Boolean<br />
	{<br />
		if(isPaused) return false;</p>
<p>		pauseLoading();</p>
<p>		dispatchEvent({type:"onLoadPause",target:this, loadObject:currentLoadObject});<br />
		return true;<br />
	}</p>
<p>	/*=====================================================<br />
	LoadQueueManager.resume();<br />
	resumes the current load operation from the point at wich it<br />
	was paused. Any parially loaded assets will begin to load from<br />
	scratch<br />
	=====================================================*/<br />
	public function resume():Boolean<br />
	{<br />
		if(!isPaused) return false;<br />
		if(isLoading) return false;</p>
<p>		resumeLoading();</p>
<p>		dispatchEvent({type:"onLoadResume",target:this, loadObject:currentLoadObject});<br />
		return true;<br />
	}</p>
<p>	/* unused methods for removing items from the queue<br />
	public function removeItem()<br />
	{<br />
	}<br />
	public function removeItemAt(int_i:Number)<br />
	{<br />
	}<br />
	public function removeItems(arr_i:Array)<br />
	{<br />
	}<br />
	*/</p>
<p>	/*=====================================================<br />
	LoadQueueManager.setPriority();<br />
	pauses the current load operation any partially loaded asset will be unloaded and lost.<br />
	alters the order of the load queue and then resstarts the load manager from priority 0.<br />
	@param int_priority		the desired target priority (0 - loadQueue.length, 0 is highest priority)<br />
	@param obj_targetItem	the target objects current priority, or the URL of the asset that is<br />
							associated with the loadItem<br />
	@return					success or error code as an integer<br />
	=====================================================*/<br />
	public function setPriority(int_priority:Number, obj_targetItem):Number<br />
	{<br />
		var int_retVal:Number = -1;<br />
		var int_qLength = loadQueue.length;<br />
		var obj_tItem:Object;<br />
		// return an eror code as the queue has no items in<br />
		if(!int_qLength) return int_retVal;<br />
		// return an eror code as the target priority is outside the bounds of the current queue<br />
		if(int_priority < 0 || int_priority > int_qLength) return -2;</p>
<p>		obj_tItem = getTargetItemObject(obj_targetItem);<br />
		// return an eror code as the target item is not in the queue<br />
		if(obj_tItem == undefined) return -3;<br />
		// return an eror code as the target priority is the current item priority<br />
		if(obj_tItem._priority == int_priority) return -4</p>
<p>		pauseLoading();<br />
		moveQueueItem(obj_tItem.index, int_priority)<br />
		resumeLoading();</p>
<p>		int_retVal = obj_tItem.index;<br />
		return int_retVal;<br />
	}</p>
<p>	/*=====================================================<br />
	LoadQueueManager.getPriority();<br />
	@return					priority (id) of the currently loading item<br />
	=====================================================*/<br />
	public function getPriority():Number<br />
	{<br />
		return currentLoadObject._priority;<br />
	}</p>
<p>	public function getTargetItemObject(_val):Object<br />
	{<br />
		var obj_retVal:Object;<br />
		var int_findByPriority:Boolean = (typeof(_val) == "number");</p>
<p>		obj_retVal = int_findByPriority ? findObjectByPriority(_val) : findObjectByURL(_val);</p>
<p>		return obj_retVal;<br />
	}</p>
<p>	public function setPriorityAt(obj_i, int_i:Number, int_priority:Number)<br />
	{<br />
		var int_qLength = loadQueue.length;<br />
	}<br />
	public function getPriorityAt(obj_i, int_i:Number, int_priority:Number):Number<br />
	{<br />
		return currentLoadObject._priority;<br />
	}</p>
<p>	public function getBytesLoaded():Number<br />
	{<br />
		return bytesLoaded;<br />
	}<br />
	public function getBytesTotal():Number<br />
	{<br />
		return bytesTotal;<br />
	}</p>
<p>	/*=====================================================<br />
	Read Only Properties<br />
	=====================================================*/<br />
	public function get isLoading():Boolean<br />
	{<br />
		return __bln_isLoading;<br />
	}<br />
	public function get isPaused():Boolean<br />
	{<br />
		return __bln_isPaused;<br />
	}<br />
	public function get loadSpeed():Number<br />
	{<br />
		return __int_loadSpeed;<br />
	}<br />
	public function get loadDurationCurrent():Number<br />
	{<br />
		return __int_loadDurationCurrent;<br />
	}</p>
<p>	public function get loadTimeCurrent():Number<br />
	{<br />
		return __int_loadTimeCurrent;<br />
	}<br />
	public function get percentLoaded():Number<br />
	{<br />
		return __int_percentLoadedCurrent;<br />
	}</p>
<p>	public function get bytesLoaded():Number<br />
	{<br />
		return __int_bytesLoaded;<br />
	}<br />
	public function get bytesTotal():Number<br />
	{<br />
		return __int_bytesTotal;<br />
	}<br />
	public function get target():Object<br />
	{<br />
		return currentLoadObject._target;<br />
	}<br />
	public function get targetPath():String<br />
	{<br />
		return typeof target == "movieclip" ? targetPath (target) : target;<br />
	}<br />
	public function get targetURL():String<br />
	{<br />
		return currentLoadObject._url;<br />
	}<br />
	public function get currentLoadObject():Object<br />
	{<br />
		return __obj_currentLoadObject;<br />
	}<br />
	public function get loadQueue():Array<br />
	{<br />
		return __arr_curQueue;<br />
	}</p>
<p>	/* unused read only properties<br />
	public function get loadDurationTotal():Number<br />
	{<br />
		return __int_loadDurationTotal;<br />
	}<br />
	public function get loadTimeTotal():Number<br />
	{<br />
		return __int_loadTimeTotal;<br />
	}<br />
	*/	</p>
<p>	/*=====================================================<br />
	Read and Write Properties<br />
	=====================================================*/<br />
	public function set autoLoad(bln_i:Boolean)<br />
	{<br />
		__bln_autoLoad = bln_i;<br />
	}<br />
	public function get autoLoad():Boolean<br />
	{<br />
		return __bln_autoLoad;<br />
	}</p>
<p>	public function set intervalMS(int_i:Number)<br />
	{<br />
		var bln_useDefaultInterval:Boolean = (int_i < 0 || int_i == 0);<br />
		__int_loadIntervalMS = bln_useDefaultInterval ? __int_defaultIntervalMS : int_i;<br />
		dispatchEvent({type:"onIntervalMSSet",target:this, value:bln_useDefaultInterval});<br />
	}<br />
	public function get intervalMS():Number<br />
	{<br />
		return __int_loadIntervalMS;<br />
	}</p>
<p>	public function set timeOutMS(int_i:Number)<br />
	{<br />
		var bln_useDefaultTimeout:Boolean = (int_i < 0 || int_i == 0);<br />
		__int_timeOutMS = bln_useDefaultTimeout ? __int_defaultTimeoutMS : int_i;<br />
		dispatchEvent({type:"onTimeOutMSSet",target:this, value:bln_useDefaultTimeout});<br />
	}<br />
	public function get timeOutMS():Number<br />
	{<br />
		return __int_timeOutMS;<br />
	}</p>
<p>	/* unused read & write properties<br />
	public function set loadQueue(arr_i:Array)<br />
	{<br />
		__arr_curQueue = arr_i;<br />
	}</p>
<p>	public function set steps(int_i:Number)<br />
	{<br />
		__int_steps = int_i;<br />
	}<br />
	public function get steps():Number<br />
	{<br />
		return __int_steps;<br />
	}<br />
	*/</p>
<p>	/*=====================================================<br />
	private methods and functions<br />
	=====================================================*/<br />
	private function startLoading()<br />
	{<br />
		var int_targetLoadType:Number;<br />
		var curLoadObject:Object = loadQueue[0];<br />
		__bln_hasTimedOut = false;<br />
		__obj_currentLoadObject = curLoadObject;</p>
<p>		__obj_currentLoadObject = curLoadObject;<br />
		__obj_currentLoadTarget = curLoadObject._target;<br />
		__obj_currentLoadListener = curLoadObject._listener;<br />
		__str_currentLoadURL = curLoadObject._url;<br />
		__bln_isLoading = true;</p>
<p>		int_targetLoadType = targetLoadType(locationToTarget(__obj_currentLoadTarget));<br />
		if(locationIsLevel(__obj_currentLoadTarget)) int_targetLoadType = 4;<br />
		if(__str_currentLoadURL == undefined) int_targetLoadType = -1;<br />
		switch(int_targetLoadType)<br />
		{<br />
			case -1:<br />
				// the load object is an observe not a load<br />
				__bln_isLoading = true;<br />
				break;<br />
			case 4:<br />
				// load target in to level<br />
				loadMovie( __str_currentLoadURL, __obj_currentLoadTarget);<br />
				__bln_isLoading = true;<br />
				break;<br />
			case 3:<br />
				// load target into movieclip<br />
				__obj_currentLoadTarget.loadMovie(__str_currentLoadURL);<br />
				__bln_isLoading = true;<br />
				break;<br />
			case 2:<br />
				// load target into sound<br />
				__obj_currentLoadTarget.loadSound(__str_currentLoadURL);<br />
				__bln_isLoading = true;<br />
				break;<br />
			case 1:<br />
				// load target into mxl, or load vars object<br />
				__obj_currentLoadTarget.load(__str_currentLoadURL);<br />
				__bln_isLoading = true;<br />
				break;<br />
			default:<br />
				// load target is not a valid location<br />
				__bln_isLoading = false;<br />
				break;<br />
		}<br />
		if(isLoading) startInterval();<br />
	}</p>
<p>	private function pauseLoading()<br />
	{<br />
		var int_targetLoadType:Number = targetLoadType(locationToTarget(__obj_currentLoadTarget));<br />
		if(locationIsLevel(__obj_currentLoadTarget)) int_targetLoadType = 4;</p>
<p>		switch(int_targetLoadType)<br />
		{<br />
			case 4:<br />
				// load target in to level<br />
				loadMovie(undefined, __obj_currentLoadTarget);<br />
				unloadMovie(__obj_currentLoadTarget);<br />
				break;<br />
			case 3:<br />
				// load target into movieclip<br />
				__obj_currentLoadTarget.loadMovie(undefined);<br />
				break;<br />
			case 2:<br />
				// load target into sound<br />
				__obj_currentLoadTarget.loadSound(undefined);<br />
				break;<br />
			case 1:<br />
				// load target into mxl, or load vars object<br />
				__obj_currentLoadTarget.load(undefined);<br />
				break;<br />
		}</p>
<p>		__bln_isPaused = true;<br />
		__bln_isLoading = false;<br />
		endInterval();<br />
	}</p>
<p>	private function resumeLoading()<br />
	{<br />
		__bln_isPaused = false;<br />
		startLoading();<br />
	}<br />
	/*<br />
	set the loading interval<br />
	*/<br />
	private function startInterval():Void<br />
	{<br />
		if (__int_loadInterval != undefined)<br />
		{<br />
			endInterval();<br />
		}<br />
		__int_loadInterval = setInterval(this, "onInterval", intervalMS);<br />
		__int_timeInterval = setInterval(this, "startTimeOut", 1);<br />
	}<br />
	/*<br />
	set the timeout interval<br />
	*/<br />
	private function startTimeOut():Void<br />
	{<br />
		if(++__int_timeCurrent >= timeOutMS && !checkBytesTotal() && !checkBytesLoaded())<br />
		{<br />
			__bln_hasTimedOut = true;<br />
			endTimeOut();<br />
		}<br />
	}<br />
	/*<br />
	remove the timeout interval<br />
	*/<br />
	private function endTimeOut():Void<br />
	{<br />
		clearInterval ();<br />
		__int_timeInterval = undefined;<br />
		__int_timeCurrent = 0;<br />
	}<br />
	/*<br />
	remove loading interval<br />
	*/<br />
	private function endInterval():Void<br />
	{<br />
		if (__int_loadInterval != undefined)<br />
		{<br />
			clearInterval (__int_loadInterval);<br />
			__int_loadInterval<br />
		}<br />
	}</p>
<p>	/*<br />
	the loading progress interval function<br />
	*/<br />
	private function onInterval():Void<br />
	{<br />
		var currentLoc = targetToLoc(target);<br />
		if (! checkBytesTotal (currentLoc)) return;<br />
		if (! checkBytesLoaded (currentLoc)) return;</p>
<p>		// check to see if the item has loaded<br />
		if(checkComplete(currentLoc))<br />
		{<br />
			dispatchEvent({type:"onLoadItemComplete",target:this, loadObject:currentLoadObject});<br />
			if(currentLoadObject._listener != undefined) removeListener(currentLoadObject._listener);<br />
			endInterval();<br />
			loadQueue.splice(0, 1);<br />
			loadNext();<br />
			return;<br />
		}<br />
		// check to see if the item has timed out<br />
		else if(__bln_hasTimedOut)<br />
		{<br />
			endInterval();<br />
			__arr_curQueue = loadQueue.splice(0, 1);<br />
			dispatchEvent({type:"onLoadItmeTimedOut",target:this, loadObject:currentLoadObject});<br />
			loadNext();<br />
			return;<br />
		}</p>
<p>		dispatchEvent({type:"onLoadProgress",target:this});<br />
	}</p>
<p>	/*<br />
	checks to see if there are any other items to load in the load queue<br />
	if there are not then the queue is loaded, other wise load the next<br />
	item in teh queue<br />
	*/<br />
	private function loadNext():Void<br />
	{<br />
		if(checkLoadQueue())<br />
		{<br />
			startLoading();<br />
		}<br />
		else<br />
		{<br />
			__bln_isLoading = false;<br />
			__bln_isPaused = false;</p>
<p>			dispatchEvent({type:"onLoadComplete",target:this});<br />
		}<br />
	}</p>
<p>	private function targetLoadType(_val):Number<br />
	{<br />
		var int_retVal:Number = 0;</p>
<p>		if(typeof(_val.load) == "function")<br />
		{<br />
			int_retVal = 1;<br />
		}<br />
		else if(typeof(_val.loadSound) == "function")<br />
		{<br />
			int_retVal = 2;<br />
		}<br />
		else if(typeof(_val.loadMovie) == "function")<br />
		{<br />
			int_retVal = 3;<br />
		}<br />
		if(typeof(_val) == "string" || locationIsLevel(_val))<br />
		{<br />
			int_retVal = 4;<br />
		}<br />
		return int_retVal;<br />
	}</p>
<p>	private function targetToLoc(_val)<br />
	{<br />
		return ( typeof(_val) == 'string') ? eval(String(_val)) : _val;<br />
	}</p>
<p>	private function targetToString(_val):String<br />
	{<br />
		return String(_val);<br />
	}</p>
<p>	private function locationToTarget(_val):Object<br />
	{<br />
		var int_loactionType:Number = getLocationType(_val);<br />
		var obj_retval:Object;</p>
<p>		switch(int_loactionType)<br />
		{<br />
			case 1:<br />
				obj_retval = "_level" + _val;<br />
				break;<br />
			case 0:<br />
			case 2:<br />
			case 3:<br />
			case 4:<br />
				obj_retval = _val;<br />
				break;<br />
			case 5:<br />
				if(locationIsLevelPath(_val))<br />
				{<br />
					obj_retval = eval(String(_val));<br />
					break;<br />
				}<br />
				else if(typeof(_val) == "string" && _val.length > 0)<br />
				{<br />
					obj_retval = _val;<br />
				}<br />
				break;<br />
			default:<br />
				obj_retval = undefined;<br />
		}</p>
<p>		return obj_retval;<br />
	}</p>
<p>	private function getLocationType(_val):Number<br />
	{<br />
		var int_retVal:Number = -1;<br />
		if(!locationIsLoadable(_val))</p>
<p>		var str_valType:String = typeof(_val);<br />
		switch(str_valType)<br />
		{<br />
			case "number":<br />
				int_retVal = 1;<br />
				break;<br />
			case "movieclip":<br />
				int_retVal = 2;<br />
				break;<br />
			case "xml":<br />
				int_retVal = 3;<br />
				break;<br />
			case "sound":<br />
				int_retVal = 4;<br />
				break;<br />
			case "string":<br />
				int_retVal = 5;<br />
				break;<br />
			default:<br />
				int_retVal = 0;<br />
				break;<br />
		}</p>
<p>		return int_retVal;<br />
	}</p>
<p>	private function locationIsLoadable(_val):Boolean<br />
	{<br />
		var bln_retVal:Boolean = typeof(_val.getBytesTotal) == "function" && typeof(_val.getBytesLoaded) == "function";</p>
<p>		return bln_retVal;<br />
	}</p>
<p>	private function locationIsLevelPath(_val):Boolean<br />
	{<br />
		var bln_retVal:Boolean = false;</p>
<p>		bln_retVal = (locationIsLevel (_val) && locationIsPath (_val));</p>
<p>		return bln_retVal;<br />
	}</p>
<p>	private function locationIsLevel(_val):Boolean<br />
	{<br />
		var bln_retVal:Boolean = _val.indexOf("_level") == 0 && ! isNaN(_val.substring(6));</p>
<p>		return bln_retVal;<br />
	}</p>
<p>	private function locationIsPath(_val):Boolean<br />
	{<br />
		var bln_retVal:Boolean = (typeof(_val) == "string") && (typeof(eval(String(_val))) == "movieclip") && (eval(String(_val)) != _level0 || _val == "_level0");</p>
<p>		return bln_retVal<br />
	}</p>
<p>	private function checkBytesTotal (_val):Boolean<br />
	{<br />
		var int_BytesTotal:Number = _val.getBytesTotal();<br />
		if (isNaN(int_BytesTotal))<br />
		{<br />
			__int_bytesTotal = null;<br />
			return false;<br />
		}<br />
		__int_bytesTotal = int_BytesTotal;<br />
		return true;<br />
	}</p>
<p>	private function checkBytesLoaded (_val):Boolean<br />
	{<br />
		var int_BytesLoaded:Number = _val.getBytesLoaded();<br />
		if (isNaN(int_BytesLoaded))<br />
		{<br />
			__int_bytesLoaded = null;<br />
			return false;<br />
		}<br />
		__int_bytesLoaded = int_BytesLoaded;<br />
		return true;<br />
	}</p>
<p>	private function checkComplete (_val):Boolean<br />
	{<br />
		var bln_retVal:Boolean = false;<br />
		var int_bTotal = bytesTotal;<br />
		var int_bLoaded = bytesLoaded;<br />
		var int_bPercentLoaded = __int_percentLoadedCurrent = Math.ceil((bytesLoaded / bytesTotal)*100);</p>
<p>		if(int_bTotal == null) trace("item total is null");<br />
		if(int_bLoaded == null) trace("item loaded is null");</p>
<p>		if(int_bTotal === int_bLoaded)<br />
		{<br />
			// item is loaded<br />
			bln_retVal = true;<br />
		}<br />
		else if(!isNaN(int_bPercentLoaded))<br />
		{<br />
			// item is still loading<br />
			bln_retVal = false;<br />
		}<br />
		return bln_retVal;<br />
	}</p>
<p>	private function checkLoadQueue():Boolean<br />
	{<br />
		var bln_qLength:Boolean = (loadQueue.length > 0);<br />
		return bln_qLength;<br />
	}</p>
<p>	private function findObjectByPriority(int_i:Number):Object<br />
	{<br />
		var int_qLength = loadQueue.length;<br />
		var obj_curLoadObject:Object;<br />
		var obj_retVal:Object;<br />
		var i:Number = 0;</p>
<p>		while(i < int_qLength)<br />
		{<br />
			obj_curLoadObject = loadQueue[i];<br />
			if(obj_curLoadObject._priority === int_i)<br />
			{<br />
				obj_retVal = {target:loadQueue[i], index:i};<br />
				i = int_qLength;<br />
			}<br />
			++i;<br />
		}</p>
<p>		return obj_retVal;<br />
	}</p>
<p>	private function findObjectByURL(str_i:String):Object<br />
	{<br />
		var int_qLength = loadQueue.length;<br />
		var obj_curLoadObject:Object;<br />
		var obj_retVal:Object;<br />
		var i:Number = 0;</p>
<p>		while(i < int_qLength)<br />
		{<br />
			obj_curLoadObject = loadQueue[i];<br />
			if(obj_curLoadObject._url.toLowerCase() === str_i.toLowerCase() )<br />
			{<br />
				obj_retVal = {target:loadQueue[i], index:i};<br />
				i = int_qLength;<br />
			}<br />
			++i;<br />
		}</p>
<p>		return obj_retVal;<br />
	}</p>
<p>	private function moveQueueItem(int_curIndex:Number, int_newIndex:Number):Boolean<br />
	{<br />
		var bln_retVal:Boolean = true;<br />
		loadQueue.splice(int_newIndex, 0, loadQueue.splice(int_curIndex, 1)[0]);<br />
		return bln_retVal;<br />
	}<br />
}[/as]</p>
<p>Currently the Ford micro site is live in the following languages.<br />
<a href="http://www.fordeumicrosites.com/sav06/sav_microsite.asp?xml=de-de">German<br />
<a href="http://www.fordeumicrosites.com/sav06/sav_microsite.asp?xml=nl-nl">Netherlands</a><br />
<a href="http://www.fordeumicrosites.com/sav06/sav_microsite.asp?xml=es-es">Spanish</a><br />
<a href="http://www.fordeumicrosites.com/sav06/sav_microsite.asp?xml=it-it">Italian</a><br />
<a href="http://www.fordeumicrosites.com/sav06/sav_microsite.asp?xml=fr-be">Belgium French</a><br />
<a href="http://www.fordeumicrosites.com/sav06/sav_microsite.asp?xml=nl-be">Belgium Dutch</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bittube.com/2006/01/16/ford-multilingual-micro-site/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
