<?xml version="1.0" encoding="iso-8859-1"?><rss version="2.0">
<channel><title><![CDATA[ActionScript.org Flash, Flex and ActionScript Resources - Comments for article: Realistic ball movement]]></title><link>http://www.actionscript.org/resources</link><description /><language>en-us</language><copyright><![CDATA[http://www.actionscript.org/resources]]></copyright><generator>N/A</generator><webMaster>general.redirect@gmail.com</webMaster><lastBuildDate>Sun, 22 Nov 2009 00:36:57 CST</lastBuildDate><ttl>20</ttl><item><title><![CDATA[Comment #1]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment1568</link><description><![CDATA[Perfect subject matter for beginers. But, it's missing some of the expicite step by step info needed by beginers. Please fill in the blanks.<br/><br/>
(Comment posted by Bart at 5:03 pm, Mon 19th Mar 2007)]]></description><author>no@spam.com (Bart)</author><pubDate><![CDATA[Mon, 19 Mar 2007 17:03:58 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment1568</guid></item><item><title><![CDATA[Comment #2]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment1689</link><description><![CDATA[Good tutorial, but forgot to name the circle with an instance name of "ball". Without this nothing works<br/><br/>
(Comment posted by Cristian Rojas-Lazic at 10:42 pm, Thu 22nd Mar 2007)]]></description><author>no@spam.com (Cristian Rojas-Lazic)</author><pubDate><![CDATA[Thu, 22 Mar 2007 22:42:06 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment1689</guid></item><item><title><![CDATA[Comment #3]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment2592</link><description><![CDATA[I can't seem to get this to work. I have reread your tutorial several times and I have no idea how to make it work. I use Macromedia Flash Professional 8. Please explain more on it. I renamed the symbol for the ball to be "ball" and that did nothing. <br/><br/>
(Comment posted by Aaron at 2:52 pm, Tue 24th Apr 2007)]]></description><author>no@spam.com (Aaron)</author><pubDate><![CDATA[Tue, 24 Apr 2007 14:52:44 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment2592</guid></item><item><title><![CDATA[Comment #4]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment2793</link><description><![CDATA[i had the same problem. I created the movie clip and named the instance "ball" and then pasted all of the script into the action window after selecting the first frame.. the script checking said no errors but when i went to preview the file nothing worked. it just showed the ball sitting there. sumbody plz help  k96gnome@gmail.com<br/><br/>
(Comment posted by Adam at 6:18 pm, Wed 2nd May 2007)]]></description><author>no@spam.com (Adam)</author><pubDate><![CDATA[Wed, 02 May 2007 18:18:53 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment2793</guid></item><item><title><![CDATA[Comment #5]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment2924</link><description><![CDATA[Brother Adam and Aron, I think I understand your problem. Giving the name ball is not enough. I think this will solve your problem:

1) Goto the main scene.
2) Click your ball and goto its properties.
3) In the instance name, write 'ball' and then it should work.<br/><br/>
(Comment posted by Muhammad at 2:53 am, Tue 8th May 2007)]]></description><author>no@spam.com (Muhammad)</author><pubDate><![CDATA[Tue, 08 May 2007 02:53:41 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment2924</guid></item><item><title><![CDATA[Comment #6]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment3443</link><description><![CDATA[There is one more thing. One function says: function boundries and onEnterFrame = function ... there is bound(A)ries. So, you should add one letter to run this function. Cheers!<br/><br/>
(Comment posted by Radko79 at 2:20 am, Fri 25th May 2007)]]></description><author>no@spam.com (Radko79)</author><pubDate><![CDATA[Fri, 25 May 2007 02:20:48 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment3443</guid></item><item><title><![CDATA[Comment #7]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment3561</link><description><![CDATA[i have tried this about 2 times and all it does is sit there....i have tried everything...giving the instance name ball...any ideas?<br/><br/>
(Comment posted by m at 3:16 pm, Tue 29th May 2007)]]></description><author>no@spam.com (m)</author><pubDate><![CDATA[Tue, 29 May 2007 15:16:00 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment3561</guid></item><item><title><![CDATA[Comment #8]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment3675</link><description><![CDATA[this is really simple, yet elegant.

Very, very smart idea<br/><br/>
(Comment posted by  at 2:24 pm, Sat 2nd Jun 2007)]]></description><author>no@spam.com ()</author><pubDate><![CDATA[Sat, 02 Jun 2007 14:24:36 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment3675</guid></item><item><title><![CDATA[Comment #9]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment3923</link><description><![CDATA[nothing happens 8(
it just sits there<br/><br/>
(Comment posted by dave at 10:03 am, Wed 13th Jun 2007)]]></description><author>no@spam.com (dave)</author><pubDate><![CDATA[Wed, 13 Jun 2007 10:03:29 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment3923</guid></item><item><title><![CDATA[Comment #10]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment3958</link><description><![CDATA[Just a note for CS3 users...the Key functionality is different for ActionScript 3.0, and this will not compile (you'll get undefined key property errors).  To use this code, go to File->Publish Settings, select the "Flash" tab and go to the drop-down and selection "ActionScript 2.0" in place of "ActionScript 3.0."  This should now compile/work properly for you.<br/><br/>
(Comment posted by Dan at 2:09 pm, Thu 14th Jun 2007)]]></description><author>no@spam.com (Dan)</author><pubDate><![CDATA[Thu, 14 Jun 2007 14:09:33 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment3958</guid></item><item><title><![CDATA[Comment #11]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4015</link><description><![CDATA[I get the same sitting-there-doing-nothing  problem, and I've tried all the solutions, with no avail. Halp!<br/><br/>
(Comment posted by Ali at 1:25 pm, Sun 17th Jun 2007)]]></description><author>no@spam.com (Ali)</author><pubDate><![CDATA[Sun, 17 Jun 2007 13:25:06 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4015</guid></item><item><title><![CDATA[Comment #12]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4379</link><description><![CDATA[Hi
I am Using Version of Flash Mx and
I followed all the instruction corectly coppied in to the actionscript windows but i am unable to get the effect in output windows<br/><br/>
(Comment posted by Srinivas at 7:21 am, Wed 4th Jul 2007)]]></description><author>no@spam.com (Srinivas)</author><pubDate><![CDATA[Wed, 04 Jul 2007 07:21:50 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4379</guid></item><item><title><![CDATA[Comment #13]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4507</link><description><![CDATA[cool script... but the author has left out many points that are needed by beginners... which most of intermediate user should know... 

1. you need to apply the name of the function in "onEnterFrame"... here's my onEnterFrame script:

onEnterFrame = function () {
    moveBall();
	applyMovement();
	ballFriction();
	ballGravity();
	boundaries();
};

2. a small typo in "boundaries"... thanks to Radko79's comment.. :)

hope these help...<br/><br/>
(Comment posted by katabana at 10:21 pm, Mon 9th Jul 2007)]]></description><author>no@spam.com (katabana)</author><pubDate><![CDATA[Mon, 09 Jul 2007 22:21:53 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4507</guid></item><item><title><![CDATA[Comment #14]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4602</link><description><![CDATA[1st - give the ball an instance name "ball"
2nd - to let the action apply to the ball, add as below:
ball.onEnterFrame = function () {
moveBall();
applyMovement();
ballFriction();
ballGravity();
boundaries();
};
then the movie should works. Hope it helps.<br/><br/>
(Comment posted by jj0000 at 11:23 pm, Thu 12th Jul 2007)]]></description><author>no@spam.com (jj0000)</author><pubDate><![CDATA[Thu, 12 Jul 2007 23:23:19 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4602</guid></item><item><title><![CDATA[Comment #15]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4669</link><description><![CDATA[Great tutorial but you forgot a few bits of info.  People, make sure you give your ball the instance name of "ball" as well<br/><br/>
(Comment posted by Matt Fugitive at 5:24 pm, Sun 15th Jul 2007)]]></description><author>no@spam.com (Matt Fugitive)</author><pubDate><![CDATA[Sun, 15 Jul 2007 17:24:53 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4669</guid></item><item><title><![CDATA[Comment #16]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4744</link><description><![CDATA[I turn to it AS3. But i suppose i made a mistake. Because its not working properly good..
Please add a AS3 Version of this tutorial :(
Thank you for this Tutorial again.<br/><br/>
(Comment posted by furious at 5:58 am, Wed 18th Jul 2007)]]></description><author>no@spam.com (furious)</author><pubDate><![CDATA[Wed, 18 Jul 2007 05:58:07 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4744</guid></item><item><title><![CDATA[Comment #17]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4799</link><description><![CDATA[hi ,i did everything,but still the ball is not working<br/><br/>
(Comment posted by swati at 3:23 am, Fri 20th Jul 2007)]]></description><author>no@spam.com (swati)</author><pubDate><![CDATA[Fri, 20 Jul 2007 03:23:21 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment4799</guid></item><item><title><![CDATA[Comment #18]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment5101</link><description><![CDATA[make sure you're following the whole tutorial. 
DON'T just copy the code where it says "so far your code should look like:" because it's missing some of the elements mentioned earlier in the turorial

google "flash vector tutorial" if you'd like to know more about it<br/><br/>
(Comment posted by gordon at 12:14 am, Thu 2nd Aug 2007)]]></description><author>no@spam.com (gordon)</author><pubDate><![CDATA[Thu, 02 Aug 2007 00:14:23 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment5101</guid></item><item><title><![CDATA[Comment #19]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment5432</link><description><![CDATA[Either this simply does not work

or someone needs to rewrite it. Maybe I'm slow, but I've read and tried this for about 2.5hours.
I would like to see the entire (complete) code (every single line of it) in order the way way it is supposed to look. <br/><br/>
(Comment posted by Winfred at 3:30 pm, Thu 16th Aug 2007)]]></description><author>no@spam.com (Winfred)</author><pubDate><![CDATA[Thu, 16 Aug 2007 15:30:54 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment5432</guid></item><item><title><![CDATA[Comment #20]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment5435</link><description><![CDATA[This tutorial is bad.
I'd rather see the entire complete code, after that you can start explaining.

This thing has so many holes in it, it is rediculous. Does the thing work or not?
And if it does...THEN SHOW ALL THE CODE AND NOT BITS AND PIECES!<br/><br/>
(Comment posted by Winfred at 6:36 pm, Thu 16th Aug 2007)]]></description><author>no@spam.com (Winfred)</author><pubDate><![CDATA[Thu, 16 Aug 2007 18:36:57 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment5435</guid></item><item><title><![CDATA[Comment #21]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment6597</link><description><![CDATA[can someone send me the whole directions because something is missing and it wont work<br/><br/>
(Comment posted by logan at 1:54 pm, Mon 8th Oct 2007)]]></description><author>no@spam.com (logan)</author><pubDate><![CDATA[Mon, 08 Oct 2007 13:54:14 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment6597</guid></item><item><title><![CDATA[Comment #22]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment9160</link><description><![CDATA[var Xspeed:Number = 0;
var Yspeed:Number = 0;
/*--*/
var friction:Number = 0.15;
var gravity:Number = 0.70;
var ballSpeed:Number = 1.24;
/*--*/
onEnterFrame = function () {
	moveBall();
	ballFriction();
	applyMovement();
};
/*--*/
function moveBall() {

	if (Key.isDown(Key.RIGHT)) {

		Xspeed += ballSpeed;

	}

	if (Key.isDown(Key.LEFT)) {

		Xspeed -= ballSpeed;

	}

	if (Key.isDown(Key.DOWN)) {

		Yspeed += ballSpeed;

	}

	if (Key.isDown(Key.UP)) {

		Yspeed -= ballSpeed;

	}

}
/*--*/
function ballFriction() {

	if (Xspeed>0) {

		Xspeed -= friction;

	}

	if (Xspeed<0) {

		Xspeed += friction;

	}

	if (Yspeed>0) {

		Yspeed -= friction;

	}

	if (Yspeed<0) {

		Yspeed += friction;

	}

}
function applyMovement() {
	ball._x += Xspeed;
	ball._y += Yspeed;
	ball._rotation += Xspeed;
}<br/><br/>
(Comment posted by Dakota at 2:22 pm, Mon 28th Jan 2008)]]></description><author>no@spam.com (Dakota)</author><pubDate><![CDATA[Mon, 28 Jan 2008 14:22:07 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment9160</guid></item><item><title><![CDATA[Comment #23 (Reply to Comment #22)]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment13696</link><description><![CDATA[here is what it said when i used this this code

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 9: Function name expected
     onEnterFrame = function () {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 10: Unexpected '#' encountered
     moveBall();

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 11: Unexpected '#' encountered
     ballFriction();

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 12: Unexpected '#' encountered
     applyMovement();

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 16: '(' expected
     function moveBall() {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 18: '(' expected
     if (Key.isDown(Key.RIGHT)) {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 24: '(' expected
     if (Key.isDown(Key.LEFT)) {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 30: '(' expected
     if (Key.isDown(Key.DOWN)) {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 36: '(' expected
     	if (Key.isDown(Key.UP)) {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 45: '(' expected
     function ballFriction() {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 48: '(' expected
     if (Xspeed>0) {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 54: '(' expected
     if (Xspeed<0) {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 60: '(' expected
     	if (Yspeed>0) {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 66: '(' expected
     if (Yspeed<0) {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 73: '(' expected
     function applyMovement() {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 77: Syntax error.
     }

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 45: Statement block must be terminated by '}'
     function ballFriction() {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 77: Syntax error.
     }

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 16: Statement block must be terminated by '}'
     function moveBall() {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 77: Syntax error.
     }

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 9: Statement block must be terminated by '}'
     onEnterFrame = function () {

**Error** Symbol= 'ball', layer=Layer 1, frame=1:Line 77: Syntax error.
     }

Total ActionScript Errors: 22 	 Reported Errors: 22

please help me solve it i am in need for this to work please help thanks<br/><br/>
(Comment posted by kitsune at 2:35 am, Wed 18th Nov 2009)]]></description><author>no@spam.com (kitsune)</author><pubDate><![CDATA[Wed, 18 Nov 2009 02:35:04 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment13696</guid></item><item><title><![CDATA[Comment #24]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment12071</link><description><![CDATA[all the boundaries can be easily simplified, to just 2 small parts of code:
if(_y<0 or _y>550) {
    yspeed *= -1;
}
if(_x<0 or _x>400){
   xspeed *= -1;
}
by multiplying the velocity of the ball as it hits the boundary by -1, 
the direction will be inverted. Simple but effective =]<br/><br/>
(Comment posted by Malboro Jones at 5:21 pm, Sun 5th Oct 2008)]]></description><author>no@spam.com (Malboro Jones)</author><pubDate><![CDATA[Sun, 05 Oct 2008 17:21:01 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment12071</guid></item><item><title><![CDATA[Comment #25]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment12072</link><description><![CDATA[all you people complaining should find patience, at least he has tried helping,
over time your capability of writing flash scripts will increase and you will see 
that you should appreciate this help as he has taken the time to do it!
Without it you would be lost without hope! take time to get to understand the coding,
move things around and you'll soon figure things out for yourselves!<br/><br/>
(Comment posted by Malboro Jones at 5:25 pm, Sun 5th Oct 2008)]]></description><author>no@spam.com (Malboro Jones)</author><pubDate><![CDATA[Sun, 05 Oct 2008 17:25:32 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment12072</guid></item><item><title><![CDATA[Comment #26]]></title><link>http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment12617</link><description><![CDATA[its works but if I add  ball._rotation += Xspeed; to the code, its will not bounce nicely<br/><br/>
(Comment posted by Newbie at 11:14 pm, Sun 8th Feb 2009)]]></description><author>no@spam.com (Newbie)</author><pubDate><![CDATA[Sun, 08 Feb 2009 23:14:17 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/562/1/Realistic-ball-movement/Page1.html#Comment12617</guid></item></channel></rss>