Jump to content

technology Actionscript 3 problems, HELP


BronyPonyProductions

Recommended Posts

(edited)

Not 100% sure if I should post this here. Kinda confusing issue I'm having  :huh:

 

 

Anyways, I'm having some Flash Actionscript 3 problems.

 

I'm trying to make 5 birds that are movieclips and each have a label, move from the right to the left of the screen.

When they go ofscreen, they should be put back on the right, with the x and y value changed.

Here is the code for a bird :

 

var randomNum:Number = Math.random();
 
addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler);
addEventListener(Event.ENTER_FRAME, f2_EnterFrameHandler);
 
function fl_EnterFrameHandler(event: Event): void
{
   bird1.x -= 1;
}
 
function f2_EnterFrameHandler(event: Event): void
{
   if (bird1.x < -20) {
      bird1.x = 850+(100*randomNum);
      bird1.y = 100*randomNum;
}
 
}
The randomNum is to generate a random number, so for x value, a number from 0 - 1 multiply by 100 so 100 is the max and all that plus the width.
Same goes for y value, anywhere from 0 - 100.
 
Moving the birds works and the do jump back to the right ofscreen and go left again. However, the intervals never change. It doesn't change it's height and always starts at the same x value.
 
What am I doing wrong?
Edited by BronyPonyProductions
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Join the herd!

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...