<?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: Making Buttons Work in Flash CS3 (A Reply)</title>
	<link>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply</link>
	<description>Luck is the residue of good design.</description>
	<pubDate>Thu, 09 Sep 2010 10:59:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: NICOLE</title>
		<link>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-467227</link>
		<pubDate>Fri, 02 Jul 2010 14:59:06 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-467227</guid>
					<description>YOU'RE MY HERO! Got in over my head with this stuff. Not exactly my expertise and I have been searching for a clear, WORKING answer. Can be so frustrating! Then I found this! THANK YOU! THANK YOU! THANK YOU!</description>
		<content:encoded><![CDATA[<p>YOU&#8217;RE MY HERO! Got in over my head with this stuff. Not exactly my expertise and I have been searching for a clear, WORKING answer. Can be so frustrating! Then I found this! THANK YOU! THANK YOU! THANK YOU!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Efren</title>
		<link>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-404523</link>
		<pubDate>Wed, 22 Jul 2009 21:03:11 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-404523</guid>
					<description>Thanks for the info.  Was having lots of difficulties with setting up a gotoAndStop using the new ActionScript.  Just wanted to move from one frame to another using a button. Did quite a bit of searching and finally found your info.  Thanks a lot.
Added a button from the common libraries, moved it onto my library, moved it onto my scene into a frame, clicked on button, clicked on properties, gave it an instance name &quot;playbutton&quot;, and right-clicked same frame to add Actions and put in the following code, to go to frame 120, based on your instructions.  Thanks A Lot :-)

stop ();
playbutton.addEventListener(
  MouseEvent.MOUSE_UP,
  function(evt:MouseEvent):void {
    gotoAndPlay(120);
  }
);</description>
		<content:encoded><![CDATA[<p>Thanks for the info.  Was having lots of difficulties with setting up a gotoAndStop using the new ActionScript.  Just wanted to move from one frame to another using a button. Did quite a bit of searching and finally found your info.  Thanks a lot.<br />
Added a button from the common libraries, moved it onto my library, moved it onto my scene into a frame, clicked on button, clicked on properties, gave it an instance name &#8220;playbutton&#8221;, and right-clicked same frame to add Actions and put in the following code, to go to frame 120, based on your instructions.  Thanks A Lot <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>stop ();<br />
playbutton.addEventListener(<br />
  MouseEvent.MOUSE_UP,<br />
  function(evt:MouseEvent):void {<br />
    gotoAndPlay(120);<br />
  }<br />
);
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-394080</link>
		<pubDate>Mon, 25 May 2009 14:00:08 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-394080</guid>
					<description>Skit,

Sounds like you want &lt;code&gt;gotoAndStop()&lt;/code&gt; instead of &lt;code&gt;gotoAndPlay()&lt;/code&gt;.  If you want to write your function directly into the &lt;code&gt;addEventListener()&lt;/code&gt; method, it would look like this:

&lt;pre&gt;&lt;code&gt;skitButton.addEventListener(
  MouseEvent.MOUSE_UP,
  function(evt:MouseEvent):void {
    gotoAndStop(&lt;em&gt;frame number here&lt;/em&gt;);
  }
);&lt;/code&gt;&lt;/pre&gt;

Alternatively, you could give the function a name, such as &lt;code&gt;mouseUpHandler()&lt;/code&gt;:

&lt;pre&gt;&lt;code&gt;skitButton.addEventListener(
  MouseEvent.MOUSE_UP,
  mouseUpHandler
);

function mouseUpHandler(evt:MouseEvent):void {
  gotoAndStop(&lt;em&gt;frame number here&lt;/em&gt;);
};&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>Skit,</p>
<p>Sounds like you want <code>gotoAndStop()</code> instead of <code>gotoAndPlay()</code>.  If you want to write your function directly into the <code>addEventListener()</code> method, it would look like this:</p>
<pre><code>skitButton.addEventListener(
  MouseEvent.MOUSE_UP,
  function(evt:MouseEvent):void {
    gotoAndStop(<em>frame number here</em>);
  }
);</code></pre>
<p>Alternatively, you could give the function a name, such as <code>mouseUpHandler()</code>:</p>
<pre><code>skitButton.addEventListener(
  MouseEvent.MOUSE_UP,
  mouseUpHandler
);

function mouseUpHandler(evt:MouseEvent):void {
  gotoAndStop(<em>frame number here</em>);
};</code></pre>
]]></content:encoded>
				</item>
	<item>
		<title>by: Skit</title>
		<link>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-393899</link>
		<pubDate>Sat, 23 May 2009 22:45:58 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-393899</guid>
					<description>Ugh, my project for multimedia class is due on Wednesday, and I can't figure out the exact coding.

I need the code that will tell my buttons.... on release, it will go to a certain frame and stop.</description>
		<content:encoded><![CDATA[<p>Ugh, my project for multimedia class is due on Wednesday, and I can&#8217;t figure out the exact coding.</p>
<p>I need the code that will tell my buttons&#8230;. on release, it will go to a certain frame and stop.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-347608</link>
		<pubDate>Sat, 07 Feb 2009 23:02:33 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-347608</guid>
					<description>Armando,

Check out my answer to wes (near the top) and you'll see it.  The important part is that you give your button an instance name.  In your message just now, you said your button &quot;is called 'button',&quot; but that doesn't tell me if that name is the &lt;em&gt;instance name&lt;/em&gt; &amp;#8212; and without an instance name, ActionScript doesn't know which object you're talking about.  So select your button on the Stage by clicking on it, then give it an instance name in the Property inspector (&lt;code&gt;button&lt;/code&gt; is fine, or &lt;code&gt;myButton&lt;/code&gt;, or whatever makes sense to you).  Then use that instance name in place of &quot;&lt;code&gt;armandoButton&lt;/code&gt;&quot; in the script shown here:

&lt;pre&gt;&lt;code&gt;armandoButton.addEventListener(
  MouseEvent.MOUSE_UP,
  function(evt:MouseEvent):void {
    gotoAndPlay(1);
  }
);&lt;/code&gt;&lt;/pre&gt;

In my reply to wes, I invoked the &lt;code&gt;MovieClip.gotoAndPlay()&lt;/code&gt; method on another movie clip, but the main timeline is a movie clip too, so if you leave off a prefix (like the &quot;&lt;code&gt;someOtherClip&lt;/code&gt;&quot; in my reply to wes), the &lt;code&gt;gotoAndPlay()&lt;/code&gt; method is simply invoked on the timeline in which this code appears.

Alternately, you can give the function your event handler association a name.  Here's the same example with a named function, which I happened to call &quot;&lt;code&gt;clickHandler()&lt;/code&gt;&quot;:

&lt;pre&gt;&lt;code&gt;armandoButton.addEventListener(
  MouseEvent.MOUSE_UP,
  clickHandler
);

function clickHandler(evt:MouseEvent):void {
  gotoAndPlay(1);
}&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Armando,</p>
<p>Check out my answer to wes (near the top) and you&#8217;ll see it.  The important part is that you give your button an instance name.  In your message just now, you said your button &#8220;is called &#8216;button&#8217;,&#8221; but that doesn&#8217;t tell me if that name is the <em>instance name</em> &mdash; and without an instance name, ActionScript doesn&#8217;t know which object you&#8217;re talking about.  So select your button on the Stage by clicking on it, then give it an instance name in the Property inspector (<code>button</code> is fine, or <code>myButton</code>, or whatever makes sense to you).  Then use that instance name in place of &#8220;<code>armandoButton</code>&#8221; in the script shown here:</p>
<pre><code>armandoButton.addEventListener(
  MouseEvent.MOUSE_UP,
  function(evt:MouseEvent):void {
    gotoAndPlay(1);
  }
);</code></pre>
<p>In my reply to wes, I invoked the <code>MovieClip.gotoAndPlay()</code> method on another movie clip, but the main timeline is a movie clip too, so if you leave off a prefix (like the &#8220;<code>someOtherClip</code>&#8221; in my reply to wes), the <code>gotoAndPlay()</code> method is simply invoked on the timeline in which this code appears.</p>
<p>Alternately, you can give the function your event handler association a name.  Here&#8217;s the same example with a named function, which I happened to call &#8220;<code>clickHandler()</code>&#8220;:</p>
<pre><code>armandoButton.addEventListener(
  MouseEvent.MOUSE_UP,
  clickHandler
);

function clickHandler(evt:MouseEvent):void {
  gotoAndPlay(1);
}</code></pre>
]]></content:encoded>
				</item>
	<item>
		<title>by: Armando</title>
		<link>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-346993</link>
		<pubDate>Sat, 07 Feb 2009 01:11:39 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-346993</guid>
					<description>Hi! Simple question, how can i make a button work if what i want its just a simple gotoAndPlay (1). My button is called &quot;button&quot;. That's it. I don´t know AS3. Thank you so much!</description>
		<content:encoded><![CDATA[<p>Hi! Simple question, how can i make a button work if what i want its just a simple gotoAndPlay (1). My button is called &#8220;button&#8221;. That&#8217;s it. I don´t know AS3. Thank you so much!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-247011</link>
		<pubDate>Tue, 12 Aug 2008 03:00:38 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-247011</guid>
					<description>Ryan,

It sounds like you're referencing an object incorrectly, and it's probably due to your use of &lt;code&gt;this&lt;/code&gt; in your ActionScript.  From the point of view of your function there, &lt;code&gt;this&lt;/code&gt; refers to the timeline in which this code appears &amp;#8212; namely, the timeline of your nested &quot;menu&quot; movie clip.

The timeline of the &quot;menu&quot; clip doesn't contain &quot;sections,&quot; so you'll need to refer to the parent timeline of &quot;menu,&quot; which &lt;em&gt;does&lt;/em&gt; contain the &quot;sections&quot; clip.

Try this:

&lt;pre&gt;&lt;code&gt;button1.addEventListener(
  MouseEvent.MOUSE_UP,
  function(evt:MouseEvent):void {
    MovieClip(this.parent).sections.gotoAndStop(&amp;#34;spaCap&amp;#34;);
  }
);&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Ryan,</p>
<p>It sounds like you&#8217;re referencing an object incorrectly, and it&#8217;s probably due to your use of <code>this</code> in your ActionScript.  From the point of view of your function there, <code>this</code> refers to the timeline in which this code appears &mdash; namely, the timeline of your nested &#8220;menu&#8221; movie clip.</p>
<p>The timeline of the &#8220;menu&#8221; clip doesn&#8217;t contain &#8220;sections,&#8221; so you&#8217;ll need to refer to the parent timeline of &#8220;menu,&#8221; which <em>does</em> contain the &#8220;sections&#8221; clip.</p>
<p>Try this:</p>
<pre><code>button1.addEventListener(
  MouseEvent.MOUSE_UP,
  function(evt:MouseEvent):void {
    MovieClip(this.parent).sections.gotoAndStop(&quot;spaCap&quot;);
  }
);</code></pre>
]]></content:encoded>
				</item>
	<item>
		<title>by: Ryan</title>
		<link>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-240950</link>
		<pubDate>Tue, 05 Aug 2008 20:02:10 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-240950</guid>
					<description>Hey,

I have a nested movie clip called &quot;menu&quot;. In that mc I have another called &quot;button1&quot; that is only on frame 10. On frame 10 of the &quot;menu&quot; is a script:

button1.addEventListener(
MouseEvent.MOUSE_UP,
function(evt:MouseEvent):void {
this.sections.gotoAndStop(&quot;spaCap&quot;);
}
);

Now I would like this script to go to a frame labeled &quot;spaCap&quot; of a movie clip called &quot;sections&quot; which is actually on the same level as &quot;menu&quot;.

This script runs and i get the error:

TypeError: Error #1010: A term is undefined and has no properties.
at MethodInfo-26()

I think it has something to do with the script being on frame 10, but I put it on frame 1 and it did the same thing. What should I do?</description>
		<content:encoded><![CDATA[<p>Hey,</p>
<p>I have a nested movie clip called &#8220;menu&#8221;. In that mc I have another called &#8220;button1&#8243; that is only on frame 10. On frame 10 of the &#8220;menu&#8221; is a script:</p>
<p>button1.addEventListener(<br />
MouseEvent.MOUSE_UP,<br />
function(evt:MouseEvent):void {<br />
this.sections.gotoAndStop(&#8221;spaCap&#8221;);<br />
}<br />
);</p>
<p>Now I would like this script to go to a frame labeled &#8220;spaCap&#8221; of a movie clip called &#8220;sections&#8221; which is actually on the same level as &#8220;menu&#8221;.</p>
<p>This script runs and i get the error:</p>
<p>TypeError: Error #1010: A term is undefined and has no properties.<br />
at MethodInfo-26()</p>
<p>I think it has something to do with the script being on frame 10, but I put it on frame 1 and it did the same thing. What should I do?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-233531</link>
		<pubDate>Tue, 29 Jul 2008 16:56:15 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-233531</guid>
					<description>David,

Thanks for the purchase!  Your question &lt;em&gt;is&lt;/em&gt; answered in the book, but it most certainly isn't staring you (or anybody) in the face.  In fact, we've had a number of readers ask where the files are &amp;#8212; both privately and through Amazon comments &amp;#8212; so we're breaking from the publisher's norm for the second edition by making it a note at the beginning of every chapter.

Meanwhile, in the case of the book you have in your hands, you can flip to the inside of the very first printed page (with the copyright info) and you'll see where to go ... but it's quite the hidden URL!  ;)

Here's what you want:

&lt;a href=&quot;http://www.friendsofed.com/download.html?isbn=159059861X&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;www.friendsofED.com/download.html?isbn=159059861X&lt;/a&gt;

or

&lt;a href=&quot;http://www.FoundationFlashCS3.com/sample-files.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;www.FoundationFlashCS3.com/sample-files.html&lt;/a&gt;

Thanks again for picking up a copy!  :)</description>
		<content:encoded><![CDATA[<p>David,</p>
<p>Thanks for the purchase!  Your question <em>is</em> answered in the book, but it most certainly isn&#8217;t staring you (or anybody) in the face.  In fact, we&#8217;ve had a number of readers ask where the files are &mdash; both privately and through Amazon comments &mdash; so we&#8217;re breaking from the publisher&#8217;s norm for the second edition by making it a note at the beginning of every chapter.</p>
<p>Meanwhile, in the case of the book you have in your hands, you can flip to the inside of the very first printed page (with the copyright info) and you&#8217;ll see where to go &#8230; but it&#8217;s quite the hidden URL!  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Here&#8217;s what you want:</p>
<p><a href="http://www.friendsofed.com/download.html?isbn=159059861X" target="_blank" rel="nofollow">www.friendsofED.com/download.html?isbn=159059861X</a></p>
<p>or</p>
<p><a href="http://www.FoundationFlashCS3.com/sample-files.html" target="_blank" rel="nofollow">www.FoundationFlashCS3.com/sample-files.html</a></p>
<p>Thanks again for picking up a copy!  <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: David Pounds</title>
		<link>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-233520</link>
		<pubDate>Tue, 29 Jul 2008 16:45:53 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3-reply#comment-233520</guid>
					<description>I bought your Foundation Flash book and it has been quite helpful. I am sure it is staring me in the face and I am missing it, but your book did not come with a CD and I don't see a website download reference for the files you mention. Where should I be getting those files?</description>
		<content:encoded><![CDATA[<p>I bought your Foundation Flash book and it has been quite helpful. I am sure it is staring me in the face and I am missing it, but your book did not come with a CD and I don&#8217;t see a website download reference for the files you mention. Where should I be getting those files?
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
