<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: How to Jump Randomly to Frame Labels without Repeats</title>
	<link>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats</link>
	<description>Luck is the residue of good design.</description>
	<pubDate>Mon, 06 Sep 2010 16:42:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: Joe</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-417079</link>
		<pubDate>Sun, 04 Oct 2009 22:35:32 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-417079</guid>
					<description>Hello David --

First I want to say thanks for this script. I have looked high and low over the past couple of weeks for script that will do exactly this. I am using Flash CS4, though, and ActionScript 3 has a problem with the AS2 code. When I test the script in the Actions window I get &quot;This script contains no errors.&quot; But when I test the movie I get this message in the Compiler Errors window:

1152: A conflict exists with inherited definition flash.display:MovieClip.currentLabel in namespace public.

I can't really interpret this--I'm new to Flash in general--and I wonder if there's any way to make this code work in AS3?

Many thanks from a newbie -- Joe</description>
		<content:encoded><![CDATA[<p>Hello David &#8211;</p>
<p>First I want to say thanks for this script. I have looked high and low over the past couple of weeks for script that will do exactly this. I am using Flash CS4, though, and ActionScript 3 has a problem with the AS2 code. When I test the script in the Actions window I get &#8220;This script contains no errors.&#8221; But when I test the movie I get this message in the Compiler Errors window:</p>
<p>1152: A conflict exists with inherited definition flash.display:MovieClip.currentLabel in namespace public.</p>
<p>I can&#8217;t really interpret this&#8211;I&#8217;m new to Flash in general&#8211;and I wonder if there&#8217;s any way to make this code work in AS3?</p>
<p>Many thanks from a newbie &#8212; Joe
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Alan</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-294311</link>
		<pubDate>Thu, 30 Oct 2008 22:04:51 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-294311</guid>
					<description>Thanks so much for sharing this code, it works a treat!!</description>
		<content:encoded><![CDATA[<p>Thanks so much for sharing this code, it works a treat!!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Tom</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-290609</link>
		<pubDate>Thu, 23 Oct 2008 14:45:36 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-290609</guid>
					<description>Hiya David,

Great script.

I've got a question. I'm creating a screenasver that scrolls some text panels across the screen. Is there a way to get multipul panels scrolling across, but in a random order.

6 types of text, need to scroll seamlessly

Cheers
t</description>
		<content:encoded><![CDATA[<p>Hiya David,</p>
<p>Great script.</p>
<p>I&#8217;ve got a question. I&#8217;m creating a screenasver that scrolls some text panels across the screen. Is there a way to get multipul panels scrolling across, but in a random order.</p>
<p>6 types of text, need to scroll seamlessly</p>
<p>Cheers<br />
t
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-269394</link>
		<pubDate>Thu, 11 Sep 2008 12:20:54 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-269394</guid>
					<description>Thad,

Glad to hear that!  :)</description>
		<content:encoded><![CDATA[<p>Thad,</p>
<p>Glad to hear that!  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Thad</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-269342</link>
		<pubDate>Thu, 11 Sep 2008 05:58:25 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-269342</guid>
					<description>This method worked great for a game I'm making based on the animal kingdom for children.  Perhaps I'll post a link when I'm finished.  Thanks for taking time to share your knowledge, you saved my butt and I learned something.</description>
		<content:encoded><![CDATA[<p>This method worked great for a game I&#8217;m making based on the animal kingdom for children.  Perhaps I&#8217;ll post a link when I&#8217;m finished.  Thanks for taking time to share your knowledge, you saved my butt and I learned something.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-190399</link>
		<pubDate>Thu, 29 May 2008 14:40:07 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-190399</guid>
					<description>&lt;strong&gt;To Guillaume ...&lt;/strong&gt;

&lt;blockquote&gt;... instead of jumping to different labels, I’d like to load external movies. How would I achieve this?&lt;/blockquote&gt;

There are numerous ways to load content in Flash.  In AS2, my personal favorite is the &lt;code&gt;MovieClipLoader&lt;/code&gt; class, because it dispatches events to let you know when content has loaded.  Assuming the same &lt;code&gt;shuffle()&lt;/code&gt; function already in place, you could replace the &lt;code&gt;gotoNextLabel()&lt;/code&gt; function with something like this (note the addition of a variable for the &lt;code&gt;MovieClipLoader&lt;/code&gt; class, and the changes to some of the variable names to suite the new usage):

&lt;pre&gt;&lt;code&gt;var movies:Array = [&quot;a.swf&quot;, &quot;b.swf&quot;, &quot;c.swf&quot;, &quot;d.swf&quot;, &quot;e.swf&quot;];
shuffle(movies);

var mcl:MovieClipLoader = new MovieClipLoader();

var currentMovie:Number = 0;
function loadNextMovie():Void {
  if (currentMovie &lt; movies.length) {
    mcl.loadClip(movies[currentLabel], containerClip);
    currentMovie++;
  } else {
    stop();
  }
}
loadNextMovie();&lt;/code&gt;&lt;/pre&gt;

Check out the &lt;code&gt;MovieClipLoader&lt;/code&gt; class entry in the ActionScript 2.0 Language Reference for details &amp;#8212; but you'll see that it features a &lt;code&gt;loadClip()&lt;/code&gt; method, which accepts the two parameters shown: a) a file to load (here taken from the shuffled &lt;code&gt;movies&lt;/code&gt; array) and b) a movie clip container to load it into.  In my sample code, the movie clip container's instance name is &lt;code&gt;containerClip&lt;/code&gt;, but that would be whatever you want.  In fact, you could load SWFs or images directly into the main timeline by replacing &lt;code&gt;containerClip&lt;/code&gt; with &lt;code&gt;this&lt;/code&gt;.

&lt;strong&gt;To Ezra ...&lt;/strong&gt;

Cool approach!  Thanks for sharing your solution, too.

This is exactly the sort of thing that makes ActionScript (actually, programming in general) so much fun to me &amp;#8212; figuring out handy solutions to problems as they crop up.</description>
		<content:encoded><![CDATA[<p><strong>To Guillaume &#8230;</strong></p>
<blockquote><p>&#8230; instead of jumping to different labels, I’d like to load external movies. How would I achieve this?</p></blockquote>
<p>There are numerous ways to load content in Flash.  In AS2, my personal favorite is the <code>MovieClipLoader</code> class, because it dispatches events to let you know when content has loaded.  Assuming the same <code>shuffle()</code> function already in place, you could replace the <code>gotoNextLabel()</code> function with something like this (note the addition of a variable for the <code>MovieClipLoader</code> class, and the changes to some of the variable names to suite the new usage):</p>
<pre><code>var movies:Array = ["a.swf", "b.swf", "c.swf", "d.swf", "e.swf"];
shuffle(movies);

var mcl:MovieClipLoader = new MovieClipLoader();

var currentMovie:Number = 0;
function loadNextMovie():Void {
  if (currentMovie < movies.length) {
    mcl.loadClip(movies[currentLabel], containerClip);
    currentMovie++;
  } else {
    stop();
  }
}
loadNextMovie();</code></pre>
<p>Check out the <code>MovieClipLoader</code> class entry in the ActionScript 2.0 Language Reference for details &mdash; but you&#8217;ll see that it features a <code>loadClip()</code> method, which accepts the two parameters shown: a) a file to load (here taken from the shuffled <code>movies</code> array) and b) a movie clip container to load it into.  In my sample code, the movie clip container&#8217;s instance name is <code>containerClip</code>, but that would be whatever you want.  In fact, you could load SWFs or images directly into the main timeline by replacing <code>containerClip</code> with <code>this</code>.</p>
<p><strong>To Ezra &#8230;</strong></p>
<p>Cool approach!  Thanks for sharing your solution, too.</p>
<p>This is exactly the sort of thing that makes ActionScript (actually, programming in general) so much fun to me &mdash; figuring out handy solutions to problems as they crop up.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Ezra</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-184257</link>
		<pubDate>Thu, 15 May 2008 21:22:04 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-184257</guid>
					<description>Hi David,

Wanted to send you an update about my question, as I found a solution. Comments included in the code for other users to understand what's going on.

First, I changed the array &quot;labels&quot; to &quot;labels1&quot;, including the list of frame titles/numbers the same as your example. This creates an array with all possibilities. I removed the following code from the list, as it will be incorporated later:

shuffle(labels);

Then added:

var j.Number = new Number(); //creates a variable that the user chooses later
var k.Number = new Number(); // dito
var labels:Array = new Array(); // creates a new array, which is used below.

Then to a start button I tied the below code, using the array slice function:

labels=labels1.slice(j-1,k); 
shuffle(labels);
gotoNextLabel();

// .slice populates the &quot;labels&quot; array with a portion of the full &quot;labels1&quot; array. 
//&quot;j-1&quot; dictates the beginning slice position in the array, adjusted one position to account for arrays starting thier count at 0. 
// &quot;k&quot; dictates the end of the slice, AND IS EXCLUSIVE so doesn't need to be adjusted.
// search &quot;.slice&quot; in Flash help for a more thorough discussion/understanding
// NOTE: the variables &quot;j&quot; and &quot;k&quot; need to match the position IN THE ARRAY that you want to pull from, not the frame numbers on the timeline (which you can include in the array &quot;labels1&quot;.

The other 2 lines are just initiating the code you had; shuffling the sliced array, and sending the user down their path. then &quot;Next&quot; buttons after that have &quot;gotoNextLabel();&quot; attached, which cycles through the sliced array. Note that I changed the full array to &quot;labels1&quot; so I didn't have to worry about the references to &quot;labels&quot; in the &quot;gotoNextLabel();&quot; function section.</description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>Wanted to send you an update about my question, as I found a solution. Comments included in the code for other users to understand what&#8217;s going on.</p>
<p>First, I changed the array &#8220;labels&#8221; to &#8220;labels1&#8243;, including the list of frame titles/numbers the same as your example. This creates an array with all possibilities. I removed the following code from the list, as it will be incorporated later:</p>
<p>shuffle(labels);</p>
<p>Then added:</p>
<p>var j.Number = new Number(); //creates a variable that the user chooses later<br />
var k.Number = new Number(); // dito<br />
var labels:Array = new Array(); // creates a new array, which is used below.</p>
<p>Then to a start button I tied the below code, using the array slice function:</p>
<p>labels=labels1.slice(j-1,k);<br />
shuffle(labels);<br />
gotoNextLabel();</p>
<p>// .slice populates the &#8220;labels&#8221; array with a portion of the full &#8220;labels1&#8243; array.<br />
//&#8221;j-1&#8243; dictates the beginning slice position in the array, adjusted one position to account for arrays starting thier count at 0.<br />
// &#8220;k&#8221; dictates the end of the slice, AND IS EXCLUSIVE so doesn&#8217;t need to be adjusted.<br />
// search &#8220;.slice&#8221; in Flash help for a more thorough discussion/understanding<br />
// NOTE: the variables &#8220;j&#8221; and &#8220;k&#8221; need to match the position IN THE ARRAY that you want to pull from, not the frame numbers on the timeline (which you can include in the array &#8220;labels1&#8243;.</p>
<p>The other 2 lines are just initiating the code you had; shuffling the sliced array, and sending the user down their path. then &#8220;Next&#8221; buttons after that have &#8220;gotoNextLabel();&#8221; attached, which cycles through the sliced array. Note that I changed the full array to &#8220;labels1&#8243; so I didn&#8217;t have to worry about the references to &#8220;labels&#8221; in the &#8220;gotoNextLabel();&#8221; function section.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Ezra</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-182322</link>
		<pubDate>Tue, 13 May 2008 00:30:32 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-182322</guid>
					<description>Hi David,

I'm looking to add some functionality to this where I can restrict the array that gets shuffled to certain frame numbers.

For instance, there are up to 20 frames that could populate the array. The user selects the min and max and an inclusive array is generated appropriately to use with shuffle(labels); and gotoNextLabel(); commands.</description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>I&#8217;m looking to add some functionality to this where I can restrict the array that gets shuffled to certain frame numbers.</p>
<p>For instance, there are up to 20 frames that could populate the array. The user selects the min and max and an inclusive array is generated appropriately to use with shuffle(labels); and gotoNextLabel(); commands.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Guillaume</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-181428</link>
		<pubDate>Sun, 11 May 2008 18:40:27 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-181428</guid>
					<description>Hi Dave, 
I really apreciate the clarity of your tutorial and am impressed with the control over randomness using the shuffle method. I'm working on a project at the moment which would have to react in the very same way, except instead of jumping to different labels, I'd like to load external movies. How would I achieve this? I am not too sure of how to customise your code to what I'd like to happen.

-Guillaume</description>
		<content:encoded><![CDATA[<p>Hi Dave,<br />
I really apreciate the clarity of your tutorial and am impressed with the control over randomness using the shuffle method. I&#8217;m working on a project at the moment which would have to react in the very same way, except instead of jumping to different labels, I&#8217;d like to load external movies. How would I achieve this? I am not too sure of how to customise your code to what I&#8217;d like to happen.</p>
<p>-Guillaume
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-145704</link>
		<pubDate>Mon, 10 Mar 2008 17:50:08 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-jump-randomly-to-frame-labels-without-repeats#comment-145704</guid>
					<description>Zai,

Glad to hear that!  Good for you!  :)</description>
		<content:encoded><![CDATA[<p>Zai,</p>
<p>Glad to hear that!  Good for you!  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
