Forum Topic: "Input" Text Help

(101 views • 9 replies)

This topic is 1 page long.

<< < > >>
None

blindbaker49

Reply To Post Reply & Quote

Posted at: 5/18/09 06:49 PM

blindbaker49 DARK LEVEL 03

Sign-Up: 10/05/08

Posts: 20

I was just playing around in Flash, but I came across a problem.

I want a ball to move at the speed the user enters, and I put this code in for the ball:

onClipEvent (load) {
xv = 0;
yv = 0;
g = 0.6;
f = 0.9;
_x = 0;
go = false;
radius = _width/2;
}
onClipEvent (enterFrame) {
if (go) {
xv = _root.speed;
yv += g;
if (_y+radius>=400) {
_y = 400-radius;
if (yv <= 1){
yv = 0;
g = 0;
} else {
yv = -yv+5;
}
}
_x += xv;
_y += yv;
}
}

But when I test it, nothing happens, the ball just bounces in place. Help?

I dream of the day chickens can cross roads and not have their motives questioned.


None

blindbaker49

Reply To Post Reply & Quote

Posted at: 5/18/09 06:53 PM

blindbaker49 DARK LEVEL 03

Sign-Up: 10/05/08

Posts: 20

Sorry for double posting, but I have the instance name of the input text box as "speed" and the instance name of the ball as "ball." The go button is "gobutton."

I dream of the day chickens can cross roads and not have their motives questioned.


None

LostVoices

Reply To Post Reply & Quote

Posted at: 5/18/09 07:07 PM

LostVoices LIGHT LEVEL 07

Sign-Up: 03/09/06

Posts: 1,891

At 5/18/09 06:53 PM, blindbaker49 wrote: Sorry for double posting, but I have the instance name of the input text box as "speed" and the instance name of the ball as "ball." The go button is "gobutton."

because you have an if statement saying if(go){

well go is false so it won't run

awww


None

blindbaker49

Reply To Post Reply & Quote

Posted at: 5/18/09 07:08 PM

blindbaker49 DARK LEVEL 03

Sign-Up: 10/05/08

Posts: 20

At 5/18/09 07:07 PM, LostVoices wrote:
At 5/18/09 06:53 PM, blindbaker49 wrote: Sorry for double posting, but I have the instance name of the input text box as "speed" and the instance name of the ball as "ball." The go button is "gobutton."
because you have an if statement saying if(go){

well go is false so it won't run

I said it bounces, and that's not the problem. I have a button that makes go true.

I dream of the day chickens can cross roads and not have their motives questioned.


None

LostVoices

Reply To Post Reply & Quote

Posted at: 5/18/09 07:12 PM

LostVoices LIGHT LEVEL 07

Sign-Up: 03/09/06

Posts: 1,891

I said it bounces, and that's not the problem. I have a button that makes go true.

have you tried tracing go and is the button referencing to the go properly?

awww


None

blindbaker49

Reply To Post Reply & Quote

Posted at: 5/18/09 07:14 PM

blindbaker49 DARK LEVEL 03

Sign-Up: 10/05/08

Posts: 20

At 5/18/09 07:12 PM, LostVoices wrote:
I said it bounces, and that's not the problem. I have a button that makes go true.
have you tried tracing go and is the button referencing to the go properly?

The problem isn't that nothing's happening. The ball bounces up and down just fine, but it doesn't move left or right. The problem isn't the "go," it's the "speed."

I dream of the day chickens can cross roads and not have their motives questioned.


None

CrustySheet

Reply To Post Reply & Quote

Posted at: 5/18/09 07:21 PM

CrustySheet LIGHT LEVEL 03

Sign-Up: 05/03/06

Posts: 534

The problem isn't that nothing's happening. The ball bounces up and down just fine, but it doesn't move left or right. The problem isn't the "go," it's the "speed."

is the ball bouncing an animation or is that code making the ball bounce?


None

blindbaker49

Reply To Post Reply & Quote

Posted at: 5/18/09 07:24 PM

blindbaker49 DARK LEVEL 03

Sign-Up: 10/05/08

Posts: 20

It's the code.

I dream of the day chickens can cross roads and not have their motives questioned.


None

AlexisGOAR

Reply To Post Reply & Quote

Posted at: 5/18/09 10:30 PM

AlexisGOAR LIGHT LEVEL 07

Sign-Up: 03/12/09

Posts: 575

At 5/18/09 07:24 PM, blindbaker49 wrote: It's the code.

is it as2 or as3 .... be sure to put what it is, but I'm sure it is as2 right?


None

Yambanshee

Reply To Post Reply & Quote

Posted at: 5/18/09 11:54 PM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,585

trace all the key variables to make sure they work

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 03:54 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!