<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Property Practice (simple motion)</title>
	<link>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/</link>
	<description>A digital supplement for the O'Reilly book</description>
	<pubDate>Sat, 04 Feb 2012 06:17:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: LS</title>
		<link>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-5121</link>
		<dc:creator>LS</dc:creator>
		<pubDate>Thu, 10 Dec 2009 10:42:37 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-5121</guid>
		<description>Hi
fantastic exercises. But how do i make the balls on exe1 stop when they reach the end of the screen?
thanks!</description>
		<content:encoded><![CDATA[<p>Hi<br />
fantastic exercises. But how do i make the balls on exe1 stop when they reach the end of the screen?<br />
thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-2099</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Sun, 22 Feb 2009 16:30:41 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-2099</guid>
		<description>@Ben, thanks. Zevan was the man behind these exercises. Great for learning, right?

The most straightforward way of doing what you're referring to is to place a conditional in the enter frame listener and set a variable with mouse events. Declare a var called something like "run" at the top of the script. The contents of the enter frame listener are within &lt;span class="inlineas"&gt;if (run) {  }&lt;/span&gt; (or you can just put this at the first line of the listener &lt;span class="inlineas"&gt;if (!run) { return; }&lt;/span&gt;). Then a mouse listener sets the run var  to &lt;span class="inlineas"&gt;true&lt;/span&gt; when you want to play the exercise, and, perhaps, a timeline script a the end of the exercise sets the var to &lt;span class="inlineas"&gt;false&lt;/span&gt;.</description>
		<content:encoded><![CDATA[<p>@Ben, thanks. Zevan was the man behind these exercises. Great for learning, right?</p>
<p>The most straightforward way of doing what you&#8217;re referring to is to place a conditional in the enter frame listener and set a variable with mouse events. Declare a var called something like &#8220;run&#8221; at the top of the script. The contents of the enter frame listener are within <span class="inlineas">if (run) {  }</span> (or you can just put this at the first line of the listener <span class="inlineas">if (!run) { return; }</span>). Then a mouse listener sets the run var  to <span class="inlineas">true</span> when you want to play the exercise, and, perhaps, a timeline script a the end of the exercise sets the var to <span class="inlineas">false</span>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-2094</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Sun, 22 Feb 2009 05:51:38 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-2094</guid>
		<description>Hi Rich,

Thank you for writing such a great book and providing these exercises.  I have learned a lot from you.  Would you be able to show us the code to have a functioning play button for these exercises?  I suspect the play() methods will not work since the motions are not timeline based. My guess is the ENTER_FRAME in the addEventListener will need to be replaced with a MouseEvent.  If this is the case then I am at a lost as to how to get the function to loop. Am I even in the right hemisphere with this?</description>
		<content:encoded><![CDATA[<p>Hi Rich,</p>
<p>Thank you for writing such a great book and providing these exercises.  I have learned a lot from you.  Would you be able to show us the code to have a functioning play button for these exercises?  I suspect the play() methods will not work since the motions are not timeline based. My guess is the ENTER_FRAME in the addEventListener will need to be replaced with a MouseEvent.  If this is the case then I am at a lost as to how to get the function to loop. Am I even in the right hemisphere with this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leslie</title>
		<link>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-1100</link>
		<dc:creator>leslie</dc:creator>
		<pubDate>Sat, 08 Nov 2008 23:12:49 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-1100</guid>
		<description>Aha! Thank you, Rich. You are awesome.</description>
		<content:encoded><![CDATA[<p>Aha! Thank you, Rich. You are awesome.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-1099</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Sat, 08 Nov 2008 23:07:32 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-1099</guid>
		<description>@Leslie, the circles are moving because they don't share a common registration point. You are adjusting their position using the &lt;span class="inlineas"&gt;X&lt;/span&gt; and &lt;span class="inlineas"&gt;Y&lt;/span&gt; parameters of the &lt;span class="inlineas"&gt;drawCircle()&lt;/span&gt; method. It is usually better to draw the circle around the (0,0) point (which occurs by default) and set the location of the display object itself. Note both the change to the &lt;span class="inlineas"&gt;drawCircle()&lt;/span&gt; method and the addition of the positioning of the display object in the setup below. With these changes, it should work the way you want it to work.

&lt;pre class='code'&gt;
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0x009900);
circle.graphics.drawCircle(0, 0, 20);
circle.graphics.endFill();
circle.x = 200;
circle.y = 100;

var circle2:Sprite = new Sprite();
circle2.graphics.beginFill(0x990000);
circle2.graphics.drawCircle(0, 0, 40);
circle2.graphics.endFill();
circle2.x = 200;
circle2.y = 100;

var circle3:Sprite = new Sprite();
circle3.graphics.beginFill(0x000066);
circle3.graphics.drawCircle(0, 0, 60);
circle3.graphics.endFill();
circle3.x = 200;
circle3.y = 100;
addChild(circle3);
addChild(circle2);
addChild(circle);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Leslie, the circles are moving because they don&#8217;t share a common registration point. You are adjusting their position using the <span class="inlineas">X</span> and <span class="inlineas">Y</span> parameters of the <span class="inlineas">drawCircle()</span> method. It is usually better to draw the circle around the (0,0) point (which occurs by default) and set the location of the display object itself. Note both the change to the <span class="inlineas">drawCircle()</span> method and the addition of the positioning of the display object in the setup below. With these changes, it should work the way you want it to work.</p>
<pre class='code'>
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0x009900);
circle.graphics.drawCircle(0, 0, 20);
circle.graphics.endFill();
circle.x = 200;
circle.y = 100;

var circle2:Sprite = new Sprite();
circle2.graphics.beginFill(0x990000);
circle2.graphics.drawCircle(0, 0, 40);
circle2.graphics.endFill();
circle2.x = 200;
circle2.y = 100;

var circle3:Sprite = new Sprite();
circle3.graphics.beginFill(0x000066);
circle3.graphics.drawCircle(0, 0, 60);
circle3.graphics.endFill();
circle3.x = 200;
circle3.y = 100;
addChild(circle3);
addChild(circle2);
addChild(circle);
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: leslie</title>
		<link>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-1098</link>
		<dc:creator>leslie</dc:creator>
		<pubDate>Sat, 08 Nov 2008 22:21:05 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-1098</guid>
		<description>In exercise three, I am drawing the circles dynamically. However, when I scale them they are also changing position. What am I doing wrong?

&lt;pre class='code'&gt;
import flash.display.Graphics;
import flash.display.Shape;

var circle:Shape = new Shape();
circle.graphics.beginFill(0x009900);
circle.graphics.drawCircle(200, 100, 20);

var circle2:Shape = new Shape();
circle2.graphics.beginFill(0x990000);
circle2.graphics.drawCircle(200, 100, 40);

var circle3:Shape = new Shape();
circle3.graphics.beginFill(0x000066);
circle3.graphics.drawCircle(200, 100, 60);
addChild(circle3);
addChild(circle2);
addChild(circle);

addEventListener(Event.ENTER_FRAME, scaleCircle, false, 0, true);
	
function scaleCircle(evt:Event):void {
	circle.scaleX  += .03;
	circle.scaleY  += .03;
	 
	circle2.scaleX  += .02;
	circle2.scaleY  += .02;
 
	circle3.scaleX  += .01;
	circle3.scaleY  += .01; 
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>In exercise three, I am drawing the circles dynamically. However, when I scale them they are also changing position. What am I doing wrong?</p>
<pre class='code'>
import flash.display.Graphics;
import flash.display.Shape;

var circle:Shape = new Shape();
circle.graphics.beginFill(0x009900);
circle.graphics.drawCircle(200, 100, 20);

var circle2:Shape = new Shape();
circle2.graphics.beginFill(0x990000);
circle2.graphics.drawCircle(200, 100, 40);

var circle3:Shape = new Shape();
circle3.graphics.beginFill(0x000066);
circle3.graphics.drawCircle(200, 100, 60);
addChild(circle3);
addChild(circle2);
addChild(circle);

addEventListener(Event.ENTER_FRAME, scaleCircle, false, 0, true);

function scaleCircle(evt:Event):void {
	circle.scaleX  += .03;
	circle.scaleY  += .03;

	circle2.scaleX  += .02;
	circle2.scaleY  += .02;

	circle3.scaleX  += .01;
	circle3.scaleY  += .01;
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-596</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Fri, 26 Sep 2008 13:25:54 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-596</guid>
		<description>@Dennis, what you're asking for is a tall order. You can make something draggable by using the &lt;span class="inlineas"&gt;startDrag()&lt;/span&gt; and &lt;span class="inlineas"&gt;stopDrag()&lt;/span&gt; methods, which are explained in the Help system. But you have to write a custom class to add control handles to a dispaly object. Senocular has a few related classes you can look into. This is one, so you should poke around to make sure you get all dependencies. &lt;a href="http://www.senocular.com/flash/actionscript.php?file=ActionScript_3.0/com/senocular/display/TransformTool.as" target="_blank" rel="nofollow"&gt;TransformTool&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>@Dennis, what you&#8217;re asking for is a tall order. You can make something draggable by using the <span class="inlineas">startDrag()</span> and <span class="inlineas">stopDrag()</span> methods, which are explained in the Help system. But you have to write a custom class to add control handles to a dispaly object. Senocular has a few related classes you can look into. This is one, so you should poke around to make sure you get all dependencies. <a href="http://www.senocular.com/flash/actionscript.php?file=ActionScript_3.0/com/senocular/display/TransformTool.as" target="_blank" rel="nofollow">TransformTool</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-595</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Fri, 26 Sep 2008 13:10:19 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-595</guid>
		<description>@Rodrigo, that error usually means you're trying to use an instance name as a type, but I can't see how you might be doing that based on these examples. They use instances defined on the stage, but if you forget to give an object an instance name, the error is usually "access of undefined property" or "variable not defined." If you declare a variable in your timeline code, the error is usually "conflict in namespace internal." 

The only thing I can think of is that you've adapted the examples to bring ball1 in from the library? Something like &lt;span class="inlineas"&gt;var mc:ball1 = new ball1();&lt;/span&gt;. If that's the case, make sure the class name you gave the symbol in the library is the same as used in your script, including case-sensitivity.</description>
		<content:encoded><![CDATA[<p>@Rodrigo, that error usually means you&#8217;re trying to use an instance name as a type, but I can&#8217;t see how you might be doing that based on these examples. They use instances defined on the stage, but if you forget to give an object an instance name, the error is usually &#8220;access of undefined property&#8221; or &#8220;variable not defined.&#8221; If you declare a variable in your timeline code, the error is usually &#8220;conflict in namespace internal.&#8221; </p>
<p>The only thing I can think of is that you&#8217;ve adapted the examples to bring ball1 in from the library? Something like <span class="inlineas">var mc:ball1 = new ball1();</span>. If that&#8217;s the case, make sure the class name you gave the symbol in the library is the same as used in your script, including case-sensitivity.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rodrigo Amorim</title>
		<link>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-593</link>
		<dc:creator>Rodrigo Amorim</dc:creator>
		<pubDate>Fri, 26 Sep 2008 10:27:39 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-593</guid>
		<description>Hi there, 

I think I tumbling on some simple error, but can't see any way around it. I've set up my own file with the Event Listener and Function described above(trying to move a symbol's instance called "ball1"), but wherever I test the Movie I get the following error:
"1046: Type was not found or was not a compile-time constant: ball1."
Do you have any idea of what I'm doing wrong?
Many thanks for the tutorials, by the way.</description>
		<content:encoded><![CDATA[<p>Hi there, </p>
<p>I think I tumbling on some simple error, but can&#8217;t see any way around it. I&#8217;ve set up my own file with the Event Listener and Function described above(trying to move a symbol&#8217;s instance called &#8220;ball1&#8243;), but wherever I test the Movie I get the following error:<br />
&#8220;1046: Type was not found or was not a compile-time constant: ball1.&#8221;<br />
Do you have any idea of what I&#8217;m doing wrong?<br />
Many thanks for the tutorials, by the way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kent</title>
		<link>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-588</link>
		<dc:creator>kent</dc:creator>
		<pubDate>Thu, 25 Sep 2008 03:59:28 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/04/20/property-practice-simple-motion/#comment-588</guid>
		<description>wow, pretty simple, thanks!</description>
		<content:encoded><![CDATA[<p>wow, pretty simple, thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

