﻿<?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>Keith Hair &#187; JSFL</title>
	<atom:link href="http://keith-hair.net/blog/category/jsfl/feed/" rel="self" type="application/rss+xml" />
	<link>http://keith-hair.net/blog</link>
	<description>Scripting is fun like any other hobby</description>
	<lastBuildDate>Sat, 28 Jan 2012 05:04:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Concatenation Tool</title>
		<link>http://keith-hair.net/blog/2012/01/08/concatenation-tool/</link>
		<comments>http://keith-hair.net/blog/2012/01/08/concatenation-tool/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 09:41:13 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSFL]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[CAML]]></category>
		<category><![CDATA[combo]]></category>
		<category><![CDATA[Concatenation]]></category>
		<category><![CDATA[Jquery]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[videogames]]></category>
		<category><![CDATA[XUL]]></category>

		<guid isPermaLink="false">http://keith-hair.net/blog/?p=393</guid>
		<description><![CDATA[String'n together combos isn't always as fun as doing them in a fighting videogame. If you write script that has a lot String content mixed with variables, I'm sure you're doing a lot of heavy concatenation. Building string combos with quotes and apostrophes sprinkled all over a script gets confusing. The way I like to [...]]]></description>
			<content:encoded><![CDATA[<p>String'n together combos isn't always as fun as doing them in a fighting videogame.<a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/Tekken-Street-2-Piki_thumb.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/Tekken-Street-2-Piki_thumb-150x150.jpg" alt="" title="Tekken-Street-2-Piki_thumb" width="150" height="150" class="alignleft size-thumbnail wp-image-431" /></a><a href="http://keith-hair.net/works/2011/concatenator/" target="_blank"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/concatenatorUI1-150x150.jpg" alt="" title="concatenatorUI" width="150" height="150" class="alignright size-thumbnail wp-image-441" /></a></p>
<p>If you write script that has a lot String content mixed with variables, I'm sure you're doing a lot of heavy concatenation.<br />
Building string combos with quotes and apostrophes sprinkled all over a script gets confusing. The way I like to keep this confusion to a minimum is to write my static markup separately. This allows me to make sure it shows up as intended. Then I concatenate my variables in all the places that need to have dynamic content.</p>
<p>Taking static markup or script and wrapping quotes around every line is a chore so I made this <a href="http://keith-hair.net/works/2011/concatenator/" title="Concatenation Tool" target="_blank">Concatenation Tool</a> to help with that.</p>
<p>Currently I've only made this support languages I'm using mostly. If I have to use a new language I'd just add it in.<br />
<span id="more-393"></span></p>
<p>Below are some basic use case examples of where a concatenation tool can be useful. </p>
<hr></hr>
<p><strong>JavaScript</strong><br />
<em>Concatenating a content to add to a Jquery UI Dialog.<br />
In this example I purposely used he "text()" method to show the XML content instead of "html()".</em></p>
<pre class="brush: jscript; title: ; notranslate">
    &lt;script type=&quot;text/javascript&quot;&gt;
                $(document).ready(function(){
                var ns = &quot;&quot;;
                ns += &quot;&lt;LIBRARY&gt;&quot;;
                ns += &quot;    &lt;BOOK&gt;&quot;;
                ns += &quot;        &lt;TITLE id=\&quot;2356\&quot;&gt;Charlotte's Web&lt;/TITLE&gt;&quot;;
                ns += &quot;        &lt;AUTHOR&gt;E. B. White&lt;/AUTHOR&gt;&quot;;
                ns += &quot;        &lt;FAMOUS_SAYING&gt;\&quot;Always be on the lookout for the presence of wonder.\&quot;&lt;/FAMOUS_SAYING&gt;&quot;;
                ns += &quot;    &lt;/BOOK&gt;&quot;;
                ns += &quot;    &lt;BOOK&gt;&quot;;
                ns += &quot;        &lt;TITLE id=\&quot;95\&quot;&gt;Scuffy the Tugboat&lt;/TITLE&gt;&quot;;
                ns += &quot;        &lt;AUTHOR&gt;Gertrude Crampton&lt;/AUTHOR&gt;&quot;;
                ns += &quot;        &lt;FAMOUS_SAYING&gt;\&quot;Toot, tooot!\&quot; cried the frightened tugboat.&lt;/FAMOUS_SAYING&gt;&quot;;
                ns += &quot;    &lt;/BOOK&gt;&quot;;
                ns += &quot;&lt;/LIBRARY&gt;&quot;;
                $(&quot;#myDialog&quot;).dialog({width:400, height:400});
                $(&quot;#myDialog p&quot;).text(ns);
                });
    &lt;/script&gt;
</pre>
<p><a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/jqueryui_sample.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/jqueryui_sample.jpg" alt="" title="jqueryui_sample" width="462" height="427" class="alignnone size-full wp-image-409" /></a></p>
<hr></hr>
<p><strong>Python</strong><br />
<em>Concatenating with qoutes</em></p>
<pre class="brush: python; title: ; notranslate">
ns = &quot;&quot;
ns += &quot;&lt;LIBRARY&gt;&quot;
ns += &quot;    &lt;BOOK&gt;&quot;
ns += &quot;        &lt;TITLE id=\&quot;2356\&quot;&gt;Charlotte's Web&lt;/TITLE&gt;&quot;
ns += &quot;        &lt;AUTHOR&gt;E. B. White&lt;/AUTHOR&gt;&quot;
ns += &quot;        &lt;FAMOUS_SAYING&gt;\&quot;Always be on the lookout for the presence of wonder.\&quot;&lt;/FAMOUS_SAYING&gt;&quot;
ns += &quot;    &lt;/BOOK&gt;&quot;
ns += &quot;    &lt;BOOK&gt;&quot;
ns += &quot;        &lt;TITLE id=\&quot;95\&quot;&gt;Scuffy the Tugboat&lt;/TITLE&gt;&quot;
ns += &quot;        &lt;AUTHOR&gt;Gertrude Crampton&lt;/AUTHOR&gt;&quot;
ns += &quot;        &lt;FAMOUS_SAYING&gt;\&quot;Toot, tooot!\&quot; cried the frightened tugboat.&lt;/FAMOUS_SAYING&gt;&quot;
ns += &quot;    &lt;/BOOK&gt;&quot;
ns += &quot;&lt;/LIBRARY&gt;&quot;
print(ns)
</pre>
<p><em>Python concatenation with triple quotes to preserve the carriage returns</em></p>
<pre class="brush: python; title: ; notranslate">
ns=&quot;&quot;&quot;&lt;LIBRARY&gt;
    &lt;BOOK&gt;
        &lt;TITLE id=&quot;2356&quot;&gt;Charlotte's Web&lt;/TITLE&gt;
        &lt;AUTHOR&gt;E. B. White&lt;/AUTHOR&gt;
        &lt;FAMOUS_SAYING&gt;&quot;Always be on the lookout for the presence of wonder.&quot;&lt;/FAMOUS_SAYING&gt;
    &lt;/BOOK&gt;
    &lt;BOOK&gt;
        &lt;TITLE id=&quot;95&quot;&gt;Scuffy the Tugboat&lt;/TITLE&gt;
        &lt;AUTHOR&gt;Gertrude Crampton&lt;/AUTHOR&gt;
        &lt;FAMOUS_SAYING&gt;&quot;Toot, tooot!&quot; cried the frightened tugboat.&lt;/FAMOUS_SAYING&gt;
    &lt;/BOOK&gt;
&lt;/LIBRARY&gt;&quot;&quot;&quot;
print(ns)
</pre>
<p><em>Concatenation with regular quotes</em><br />
<a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/samplepy2.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/samplepy2.jpg" alt="" title="Concatenation of blocks of text with triple quotes" width="682" height="358" class="alignnone size-full wp-image-413" /></a></p>
<p><em>Concatenation of blocks of text with triple quotes</em><br />
<a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/samplepy1.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/samplepy1.jpg" alt="" title="Concatenation with regular quotes" width="698" height="357" class="alignnone size-full wp-image-412" /></a></p>
<hr></hr>
<p><strong>JSFL</strong><br />
<em>Concatenating a XUL markup string for building Flash IDE Panel with JSFL.</em></p>
<pre class="brush: jscript; title: ; notranslate">
if(fl.documents.length == 0){
	fl.createDocument(&quot;timeline&quot;);
}
//------------------------------------------------------------
//An existing folder for the panel's source to be written to.
//------------------------------------------------------------
var appFolderName=&quot;jsflUI_sample&quot;;
var date=new Date();
function writePanelSource()
{
	var code = '';
	code += '&lt;overlay&gt;';
	code += '	&lt;dialog id=&quot;app&quot; title=&quot;Sample UI&quot;&gt;';
	code += '		&lt;hbox&gt;';
	code += '			&lt;spacer/&gt;';
	code += '			&lt;button id=&quot;b0&quot; label=&quot;Button&quot;/&gt;';
	code += '		&lt;/hbox&gt;';
	code += '		&lt;separator/&gt;';
	code += '		&lt;vbox&gt;';
	code += '			&lt;label control=&quot;f0&quot; value=&quot;Field 1&quot; align=&quot;left&quot;/&gt;';
	code += '			&lt;textbox id=&quot;f0&quot; size=&quot;50&quot; value=&quot;'+date.toString()+'&quot;/&gt;';
	code += '			&lt;label control=&quot;f1&quot; value=&quot;Field 2:&quot; align=&quot;left&quot;/&gt;';
	code += '			&lt;textbox id=&quot;f1&quot; size=&quot;50&quot; value=&quot;&quot;/&gt;';
	code += '		&lt;/vbox&gt;';
	code += '		&lt;checkbox id=&quot;cb0&quot; label=&quot;Checkbox 1&quot; checked=&quot;false&quot; /&gt;';
	code += '		&lt;checkbox id=&quot;cb1&quot; label=&quot;Checkbox 2&quot; checked=&quot;false&quot; /&gt;';
	code += '	&lt;/dialog&gt;';
	code += '&lt;/overlay&gt;';
	FLfile.write(fl.configURI + &quot;Commands/&quot;+appFolderName+&quot;/panelsource.xml&quot;, code);
	return code;
}

//----------------------------------------------------------------
//Writes the markup to &quot;appFolderName&quot; of Flash's &quot;Commands folder
//----------------------------------------------------------------
writePanelSource();

//-------------------------------
//Open the Panel in Flash's IDE
//-------------------------------
fl.getDocumentDOM().xmlPanel(fl.configURI + &quot;Commands/&quot;+appFolderName+&quot;/panelsource.xml&quot;);
</pre>
<p><em>Panel UI dialog from JSFL</em><br />
<a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/jsflUI_sample.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/jsflUI_sample.jpg" alt="" title="jsflUI_sample" class="alignnone"/></a></p>
<hr></hr>
<p><strong>SharePoint</strong><br />
<em>Concatenating CAML querys.</em></p>
<pre class="brush: jscript; title: ; notranslate">
function getListData()
{
	var clientContext = new SP.ClientContext.get_current();
	var web = clientContext.get_web();
	var userInfoList = web.get_lists().getByTitle('user_list')
	var camlQuery = new SP.CamlQuery();
	var caml = '';
	caml += '&lt;View&gt;';
	caml += '	&lt;Query&gt;';
	caml += '		&lt;OrderBy&gt;';
	caml += '			&lt;FieldRef Name=&quot;Title&quot; Ascending=&quot;False&quot; /&gt;';
	caml += '		&lt;/OrderBy&gt;';
	caml += '	&lt;/Query&gt;';
	caml += '&lt;/View&gt;';
	camlQuery.set_viewXml(caml);
	collListItem = userInfoList.getItems(camlQuery);
	clientContext.load(collListItem);
	var onQuerySucceeded=function(sender, args)
	{
		var oitem;
		var s='';
		var n=0;
		var len=collListItem.get_count();
		var results=[];
		while(n &lt; len)
		{
			oitem = collListItem.itemAt(n);
			s+=&quot;Title:&quot;+oitem.get_item(&quot;Title&quot;)+&quot;&lt;br&gt;&lt;/br&gt;&quot;;
			n++;
		}
		$(&quot;#output&quot;).append(s);
	}
	var onQueryFailed=function(sender, args)
	{
		alert(&quot;Failed getting data.&quot;)
	}
	clientContext.executeQueryAsync
        (
        Function.createDelegate(this, onQuerySucceeded),
        Function.createDelegate(this, onQueryFailed)
        );
}
</pre>
<p><em>Output of Title column from a SharePoint 2010 list.</em><br />
<a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/sharepoint_sample.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/sharepoint_sample.jpg" alt="" title="SharePoint output" width="427" height="376" class="alignnone size-full wp-image-423" /></a></p>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2012/01/08/concatenation-tool/&ztz=Concatenation Tool'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2012/01/08/concatenation-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resizing Flash Documents to Fit Contents in JSFL</title>
		<link>http://keith-hair.net/blog/2010/03/21/resizing-flash-documents-to-fit-contents-in-jsfl/</link>
		<comments>http://keith-hair.net/blog/2010/03/21/resizing-flash-documents-to-fit-contents-in-jsfl/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 20:04:56 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash 9]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[JSFL]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[Resize]]></category>

		<guid isPermaLink="false">http://keith-hair.net/blog/?p=219</guid>
		<description><![CDATA[I use Flex for the majority of my Flash related work, even for writing plain ActionScript. Lately I've barely even used the Flash authoring environment to create stuff. When I do use the Flash authoring environment, it's mostly for automation and prep work of content. If you are like me, you write JSFL to do [...]]]></description>
			<content:encoded><![CDATA[<p>I use Flex for the majority of my Flash related work, even for writing plain ActionScript. Lately I've barely even used the Flash authoring environment to create stuff. When I do use the Flash authoring environment, it's mostly for automation and prep work of content. If you are like me, you write JSFL to do that stuff.</p>
<p>I love automating redundant tasks. One thing that bugs me when importing graphical assets to Flash's stage is having to resize the document to what I imported. I like that I can do this by going to the Document Properties and setting the document to match the content size, but if I have to do this each time I import/export content it becomes a irksome chore. I write JSFL scripts that run tasks on multiple files, having a "match contents"  function would be useful to me in my case...maybe to you as well. I do not see a JSFL way to do this. (Maybe there is and I had a brain fart?). Until then, here is a script I wrote to do it in JSFL...<br />
<span id="more-219"></span></p>
<pre class="brush: jscript; title: ; notranslate">
/*****************************************************************************************
What:	Document_to_Content_Size.jsfl
		JSFL Command for Flash (8+) that will resize the document to fit the content
		that is on the stage in the authoring environment.

Why:		Yep, this action can also be done by going to the Document Properties
		and setting &quot;match&quot; to &quot;contents&quot;. However, I have not
		found a way to do this same action within JSFL script
		If you know a JSFL way to do this same action easier contact me.		

Date:		March 21, 2010
Author:	Keith Hair
Contact	khos2007@gmail.com
Web:		keith-hair.net		

INSTALL:
		If you deal with JSFL you probably know what to do, but anyway...
		Save this script with a &quot;.jsfl&quot; extension and put in:
		&quot;Your Flash installation folder\en\First Run\Commands&quot; folder
		Or just put it anywhere and double-click the file.

LEGAL STUFF:
		This script is free for whatever, just improve it or say hello! 		

NOTE:
		This is primarily for resizing the Flash
		document to fit content that is imported to the stage.
		Resizing is buggy with Component instances.

******************************************************************************************/
fl.outputPanel.clear();
runApp();
function runApp()
{
	var doc=fl.getDocumentDOM();
	var element;
	var docw=1;
	var doch=1;
	var fn=0;
	var ln=0;
	var en=0;
	var tframes;
	var layer;
	var frame;
	var ox;
	var oy;
	var left=null;
	var right=null;
	var top=null;
	var bottom=null;
	var cf=doc.getTimeline().currentFrame;
	while(ln &lt; doc.getTimeline().layerCount)
	{
		layer=doc.getTimeline().layers[ln];
		tframes=layer.frameCount;
		fn=0;
		while(fn &lt; tframes)
		{
			doc.getTimeline().currentFrame = fn;
			frame=layer.frames[fn];
			en=0;
			while(en &lt; frame.elements.length)
			{
				element = frame.elements[en];
				ox=element.x;
				oy=element.y;
				if(left == null){
					left=ox;
				}
				if(right == null){
					right=ox+element.width;
				}
				if(top == null){
					top=oy;
				}
				if(bottom == null){
					bottom=oy+element.height;
				}

				left=Math.min(ox,left);
				right=Math.max(ox+element.width,right);
				top=Math.min(oy,top);
				bottom=Math.max(oy+element.height,bottom);
				en++;
			}
			fn++;
		}
		ln++;
	}
	fl.trace(&quot;CURRENT SIZE--&gt;\t&quot;+doc.width+&quot; x &quot;+doc.height);
	docw=Math.round(right-left);
	doch=Math.round(bottom-top);
	moveAllElementsBy(-left,-top);
	doc.width=docw;
	doc.height=doch;
	fl.trace(&quot;NEW SIZE--&gt;\t\t\t&quot;+doc.width+&quot; x &quot;+doc.height);
	doc.getTimeline().currentFrame=cf;
}

function moveAllElementsBy(tx,ty)
{
	doc=fl.getDocumentDOM();
	var element;
	var fn=0;
	var ln=0;
	var en=0;
	var tframes;
	var layer;
	var frame;
	var otp;
	while(ln &lt; doc.getTimeline().layerCount)
	{
		layer=doc.getTimeline().layers[ln];
		tframes=layer.frameCount;
		fn=0;
		while(fn &lt; tframes)
		{
			doc.getTimeline().currentFrame = fn;
			frame=layer.frames[fn];
			en=0;
			while(en &lt; frame.elements.length)
			{
				element=frame.elements[en];
				element.x+=tx;
				element.y+=ty;
				if(element.elementType.search(/instance|text/mig) == -1){
					element.x+=element.width/2;
					element.y+=element.height/2;
				}

				en++;
			}
			fn++;
		}
		ln++;
	}

}
</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2010/03/21/resizing-flash-documents-to-fit-contents-in-jsfl/&ztz=Resizing Flash Documents to Fit Contents in JSFL'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2010/03/21/resizing-flash-documents-to-fit-contents-in-jsfl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rename all instances with their library names</title>
		<link>http://keith-hair.net/blog/2008/07/08/rename-all-instances-with-their-library-names/</link>
		<comments>http://keith-hair.net/blog/2008/07/08/rename-all-instances-with-their-library-names/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 02:19:40 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[JSFL]]></category>

		<guid isPermaLink="false">http://keith-hair.com/blog/?p=13</guid>
		<description><![CDATA[When creating a new symbol for MovieClips and other instances you must give them a name a second time again in the Properties panel. For me this can be annoying sometimes. (I name my instances the name I plan to later identify them with actionscript.) Here is a modification of the "findObjects" I posted earlier. [...]]]></description>
			<content:encoded><![CDATA[<p>When creating a new symbol for MovieClips and other instances you must give them a name a second time again in the Properties panel. For me this can be annoying sometimes. (I name my instances the name I plan to later identify them with actionscript.) </p>
<p>Here is a modification of the "<a href="http://keith-hair.com/blog/2008/06/05/finding-elements-with-jsfl/">findObjects</a>" I posted earlier. This is handy if you are the type of person that names your symbol items with names you intend to use as their instance name as well. </p>
<p>Maybe you will find this useful or know improvements, either way let me know your thoughts.<br />
<span id="more-13"></span></p>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">/*========================================================================
selfNameAllInstances(true)
&nbsp;
Renames all symbol instance names on the stage of in FLA document with
the symbol's library Name.
&nbsp;
Instances that already have a name will be skipped...
If the argument &quot;force_rename&quot; is true, the element will be renamed
regardless if it already had a instance name or not.
&nbsp;
The renaming process is recursive to each
for each MovieClip's timeline as well.
&nbsp;
(Unfortunately symbols that are grouped are ignored.)
=========================================================================*/</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> selfNameAllInstances <span style="color: #66cc66;">&#40;</span>force_rename<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	fl.<span style="color: #006600;">outputPanel</span>.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> instanceName;
	<span style="color: #000000; font-weight: bold;">var</span> inInstance;
	<span style="color: #000000; font-weight: bold;">var</span> instances = <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> cnt=<span style="color: #cc66cc;">0</span>;
	<span style="color: #000000; font-weight: bold;">var</span> findObjectInTimeline = <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span>instance, <span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> timeline;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>instance.<span style="color: #0066CC;">toString</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;[object SymbolInstance]&quot;</span> || instance.<span style="color: #0066CC;">toString</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;[object Frame]&quot;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			timeline = instance.<span style="color: #006600;">timeline</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>instance.<span style="color: #0066CC;">toString</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;[object Document]&quot;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			timeline = instance;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>instance.<span style="color: #0066CC;">toString</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;[object Timeline]&quot;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			timeline = instance;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>instance == fl.<span style="color: #006600;">getDocumentDOM</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			timeline = instance.<span style="color: #006600;">getTimeline</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>timeline == <span style="color: #0066CC;">undefined</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">var</span> checked = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000000; font-weight: bold;">var</span> currentLayers = timeline.<span style="color: #006600;">layers</span>;
		<span style="color: #000000; font-weight: bold;">var</span> layObj;
		<span style="color: #000000; font-weight: bold;">var</span> frm;
		<span style="color: #000000; font-weight: bold;">var</span> found;
		<span style="color: #000000; font-weight: bold;">var</span> i = <span style="color: #cc66cc;">0</span>;
&nbsp;
		<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>i &lt; currentLayers.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> layObj = currentLayers <span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> frms = layObj.<span style="color: #006600;">frames</span>;
			<span style="color: #000000; font-weight: bold;">var</span> k = <span style="color: #cc66cc;">0</span>;
			<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>k &lt; frms.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> selArry = frms <span style="color: #66cc66;">&#91;</span>k<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">elements</span>;
				<span style="color: #000000; font-weight: bold;">var</span> n = <span style="color: #cc66cc;">0</span>;
				<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>n &lt; selArry.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span>
				<span style="color: #66cc66;">&#123;</span>
					<span style="color: #000000; font-weight: bold;">var</span> obj = selArry <span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>;
<span style="color: #808080; font-style: italic;">//=================================================================================</span>
<span style="color: #808080; font-style: italic;">//IF THE OBJECT HAS A &quot;name&quot; PROPERTY, ASSIGN IT TO &quot;found&quot; VARIABLE.</span>
<span style="color: #808080; font-style: italic;">//&quot;found&quot; VARIABLE will be returned from this recusive function.</span>
<span style="color: #808080; font-style: italic;">//---------------------------------------------------------------------------------</span>
					<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #0066CC;">name</span> != <span style="color: #ff0000;">&quot;undefined&quot;</span><span style="color: #66cc66;">&#41;</span>
					<span style="color: #66cc66;">&#123;</span>
						found = obj;
						instances.<span style="color: #0066CC;">push</span> <span style="color: #66cc66;">&#40;</span>obj<span style="color: #66cc66;">&#41;</span>;
					<span style="color: #66cc66;">&#125;</span>
					<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">libraryItem</span> != <span style="color: #0066CC;">undefined</span><span style="color: #66cc66;">&#41;</span>
					<span style="color: #66cc66;">&#123;</span>
						<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">libraryItem</span>.<span style="color: #0066CC;">name</span> != <span style="color: #0066CC;">undefined</span><span style="color: #66cc66;">&#41;</span>
						<span style="color: #66cc66;">&#123;</span>
							<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>checked <span style="color: #66cc66;">&#91;</span>obj.<span style="color: #006600;">libraryItem</span>.<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
							<span style="color: #66cc66;">&#123;</span>
								n ++;
								<span style="color: #b1b100;">continue</span>;
							<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span>
							<span style="color: #66cc66;">&#123;</span>
								checked <span style="color: #66cc66;">&#91;</span>obj.<span style="color: #006600;">libraryItem</span>.<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #000000; font-weight: bold;">true</span>;
							<span style="color: #66cc66;">&#125;</span>
<span style="color: #808080; font-style: italic;">//=================================================================================</span>
<span style="color: #808080; font-style: italic;">//RENAME INSTANCE ON STAGE WITH IT'S LIBRARY NAME</span>
<span style="color: #808080; font-style: italic;">//...also take of &quot;slashes&quot; in path.</span>
<span style="color: #808080; font-style: italic;">//---------------------------------------------------------------------------------</span>
<span style="color: #000000; font-weight: bold;">var</span> CHANGE_NAME=obj.<span style="color: #006600;">libraryItem</span>.<span style="color: #0066CC;">name</span>;
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj.<span style="color: #0066CC;">name</span>==<span style="color: #ff0000;">&quot;&quot;</span> || force_rename<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
	CHANGE_NAME=CHANGE_NAME.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span>CHANGE_NAME.<span style="color: #0066CC;">lastIndexOf</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #cc66cc;">+1</span>,CHANGE_NAME.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span>;
	obj.<span style="color: #0066CC;">name</span>=CHANGE_NAME;
	cnt++;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #808080; font-style: italic;">//=================================================================================</span>
						<span style="color: #66cc66;">&#125;</span>
						obj = findObjectInTimeline <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">libraryItem</span>, <span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span>;
						<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
						<span style="color: #66cc66;">&#123;</span>
							found = obj
						<span style="color: #66cc66;">&#125;</span>
						obj = selArry <span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>;
						<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">libraryItem</span>.<span style="color: #006600;">timeline</span> != <span style="color: #0066CC;">undefined</span><span style="color: #66cc66;">&#41;</span>
						<span style="color: #66cc66;">&#123;</span>
							obj = findObjectInTimeline <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">libraryItem</span>.<span style="color: #006600;">timeline</span>, <span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span>;
							<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
							<span style="color: #66cc66;">&#123;</span>
								found = obj
							<span style="color: #66cc66;">&#125;</span>
						<span style="color: #66cc66;">&#125;</span>
					<span style="color: #66cc66;">&#125;</span>
					n ++;
				<span style="color: #66cc66;">&#125;</span>
				k ++;
			<span style="color: #66cc66;">&#125;</span>
			i ++;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #b1b100;">return</span> found;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>inInstance == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		inInstance = fl.<span style="color: #006600;">getDocumentDOM</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	findObjectInTimeline <span style="color: #66cc66;">&#40;</span>inInstance, instanceName<span style="color: #66cc66;">&#41;</span>;
	alert<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Renamed &quot;</span>+cnt+<span style="color: #ff0000;">&quot; symbols.&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2008/07/08/rename-all-instances-with-their-library-names/&ztz=Rename all instances with their library names'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2008/07/08/rename-all-instances-with-their-library-names/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Finding elements with JSFL</title>
		<link>http://keith-hair.net/blog/2008/06/05/finding-elements-with-jsfl/</link>
		<comments>http://keith-hair.net/blog/2008/06/05/finding-elements-with-jsfl/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 18:31:03 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[JSFL]]></category>
		<category><![CDATA[CS3]]></category>
		<category><![CDATA[Flash 8]]></category>

		<guid isPermaLink="false">http://keith-hair.com/blog/?p=11</guid>
		<description><![CDATA[Here's a JSFL function for returning an Array of all elements with a given instance name in whole Flash Document. I was trying to make something like JavaScript's "getElementsById()" method. My intent was to make this compatible with both Flash 8 and CS3 IDEs. Note: Unfortunately, this method will not find elements that are grouped. [...]]]></description>
			<content:encoded><![CDATA[<p>Here's a JSFL function for returning an Array of all elements with a given instance name in whole Flash Document.<br />
I was trying to make something like JavaScript's "getElementsById()" method.<br />
My intent was to make this compatible with both Flash 8 and CS3 IDEs.</p>
<p><em>Note: Unfortunately, this method will not find elements that are grouped.</em><br />
Let me know if this is helpful or if there is a better way to do this.</p>
<p>Example:</p>
<pre class="javascript">&nbsp;
fl.<span style="color: #006600;">outputPanel</span>.<span style="color: #006600;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #003366; font-weight: bold;">var</span> items=findObjects<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;mybox&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #003366; font-weight: bold;">var</span> n=<span style="color: #CC0000;">0</span>;
<span style="color: #000066; font-weight: bold;">while</span><span style="color: #66cc66;">&#40;</span>n &lt; items.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
	items<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">rotation</span>=<span style="color: #CC0000;">45</span>;
	n++;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Found &quot;</span>+items.<span style="color: #006600;">length</span>+<span style="color: #3366CC;">&quot; items.&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p><span id="more-11"></span></p>
<pre class="javascript">&nbsp;
<span style="color: #009900; font-style: italic;">/*-------------------------------------------------------------------
findObjects
&nbsp;
Returns an Array of elements in FLA document that match instanceName.
If nothing matches instanceName, an Array with a length of 0 is returned.
--------------------------------------------------------------------*/</span>
<span style="color: #003366; font-weight: bold;">function</span> findObjects <span style="color: #66cc66;">&#40;</span>instanceName, inInstance<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> instances = <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;
	<span style="color: #003366; font-weight: bold;">var</span> groups = <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;
	<span style="color: #003366; font-weight: bold;">var</span> findObjectInTimeline = <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span>instance, <span style="color: #000066;">name</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> timeline;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>instance.<span style="color: #006600;">toString</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #3366CC;">&quot;[object SymbolInstance]&quot;</span> || instance.<span style="color: #006600;">toString</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #3366CC;">&quot;[object Frame]&quot;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			timeline = instance.<span style="color: #006600;">timeline</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>instance.<span style="color: #006600;">toString</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #3366CC;">&quot;[object Document]&quot;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			timeline = instance;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>instance.<span style="color: #006600;">toString</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #3366CC;">&quot;[object Timeline]&quot;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			timeline = instance;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>instance == fl.<span style="color: #006600;">getDocumentDOM</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			timeline = instance.<span style="color: #006600;">getTimeline</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>timeline == undefined<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">null</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #003366; font-weight: bold;">var</span> checked = <span style="color: #003366; font-weight: bold;">new</span> Object <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #003366; font-weight: bold;">var</span> currentLayers = timeline.<span style="color: #006600;">layers</span>;
		<span style="color: #003366; font-weight: bold;">var</span> layObj;
		<span style="color: #003366; font-weight: bold;">var</span> frm;
		<span style="color: #003366; font-weight: bold;">var</span> found;
		<span style="color: #003366; font-weight: bold;">var</span> i = <span style="color: #CC0000;">0</span>;
&nbsp;
		<span style="color: #000066; font-weight: bold;">while</span> <span style="color: #66cc66;">&#40;</span>i &lt; currentLayers.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> layObj = currentLayers <span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
			<span style="color: #003366; font-weight: bold;">var</span> frms = layObj.<span style="color: #006600;">frames</span>;
			<span style="color: #003366; font-weight: bold;">var</span> k = <span style="color: #CC0000;">0</span>;
			<span style="color: #000066; font-weight: bold;">while</span> <span style="color: #66cc66;">&#40;</span>k &lt; frms.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #003366; font-weight: bold;">var</span> selArry = frms <span style="color: #66cc66;">&#91;</span>k<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">elements</span>;
				<span style="color: #003366; font-weight: bold;">var</span> n = <span style="color: #CC0000;">0</span>;
				<span style="color: #000066; font-weight: bold;">while</span> <span style="color: #66cc66;">&#40;</span>n &lt; selArry.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#41;</span>
				<span style="color: #66cc66;">&#123;</span>
					<span style="color: #003366; font-weight: bold;">var</span> obj = selArry <span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>;
					<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #000066;">name</span> == <span style="color: #000066;">name</span><span style="color: #66cc66;">&#41;</span>
					<span style="color: #66cc66;">&#123;</span>
						found = obj;
						instances.<span style="color: #006600;">push</span> <span style="color: #66cc66;">&#40;</span>obj<span style="color: #66cc66;">&#41;</span>;
					<span style="color: #66cc66;">&#125;</span>
					<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">libraryItem</span> != undefined<span style="color: #66cc66;">&#41;</span>
					<span style="color: #66cc66;">&#123;</span>
						<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">libraryItem</span>.<span style="color: #000066;">name</span> != undefined<span style="color: #66cc66;">&#41;</span>
						<span style="color: #66cc66;">&#123;</span>
							<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>checked <span style="color: #66cc66;">&#91;</span>obj.<span style="color: #006600;">libraryItem</span>.<span style="color: #000066;">name</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
							<span style="color: #66cc66;">&#123;</span>
								n ++;
								<span style="color: #000066; font-weight: bold;">continue</span>;
							<span style="color: #66cc66;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span>
							<span style="color: #66cc66;">&#123;</span>
								checked <span style="color: #66cc66;">&#91;</span>obj.<span style="color: #006600;">libraryItem</span>.<span style="color: #000066;">name</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #003366; font-weight: bold;">true</span>;
							<span style="color: #66cc66;">&#125;</span>
						<span style="color: #66cc66;">&#125;</span>
						obj = findObjectInTimeline <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">libraryItem</span>, <span style="color: #000066;">name</span><span style="color: #66cc66;">&#41;</span>;
						<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>obj != <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
						<span style="color: #66cc66;">&#123;</span>
							found = obj
						<span style="color: #66cc66;">&#125;</span>
						obj = selArry <span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>;
						<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">libraryItem</span>.<span style="color: #006600;">timeline</span> != undefined<span style="color: #66cc66;">&#41;</span>
						<span style="color: #66cc66;">&#123;</span>
							obj = findObjectInTimeline <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">libraryItem</span>.<span style="color: #006600;">timeline</span>, <span style="color: #000066;">name</span><span style="color: #66cc66;">&#41;</span>;
							<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>obj != <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
							<span style="color: #66cc66;">&#123;</span>
								found = obj
							<span style="color: #66cc66;">&#125;</span>
						<span style="color: #66cc66;">&#125;</span>
					<span style="color: #66cc66;">&#125;</span>
					n ++;
				<span style="color: #66cc66;">&#125;</span>
				k ++;
			<span style="color: #66cc66;">&#125;</span>
			i ++;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">return</span> found;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>inInstance == <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		inInstance = fl.<span style="color: #006600;">getDocumentDOM</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	findObjectInTimeline <span style="color: #66cc66;">&#40;</span>inInstance, instanceName<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">return</span> instances;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2008/06/05/finding-elements-with-jsfl/&ztz=Finding elements with JSFL'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2008/06/05/finding-elements-with-jsfl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

