# Flex help needed!

**URL:** <https://forum.kirupa.com/t/flex-help-needed/283487>\
**Category:** flash\
**Created:** [March 6, 2009, 7:35pm UTC](https://forum.kirupa.com/t/flex-help-needed/283487 "2009-03-06T19:35:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crai9](https://avatars.discourse-cdn.com/v4/letter/c/a9adbd/32.png) [@Crai9](https://forum.kirupa.com/u/Crai9)\
**Post date:** [March 6, 2009, 7:35pm UTC](https://forum.kirupa.com/t/flex-help-needed/283487/1 "2009-03-06T19:35:01Z")

</div>

Hi, I have a college assignment to do in flex but it just doesn’t want to work for me. the assignment is quite simple in theory because all we have to do is add 3 new functions to an existing game like space invaders or something and update the graphics. This is where I’m hitting my first problem, updating the graphics is being a pain. I am using an asteroids type game and in the original there is one frame for the thrusters and it used a gotoAndStop to show it. Now I am trying to add a range of frames so it has an animation and I am trying gotoAndPlay(""); with my frames labeled and everything but it’s not behaving as I would like. Instead of playing said frames once it loops everything in the movieclip once and then stops on a frame in the labeled region. gotoAndStops work fine but gotoAndPlay is not. I want it to play “burn” infinitely while holding up and playing the “cool” animation once when up is released.

current code for key presses

// register key presses  
public function keyDownFunction(event:KeyboardEvent):void {  
if (event.keyCode == 37) {  
leftArrow = true;  
} else if (event.keyCode == 39) {  
rightArrow = true;  
} else if (event.keyCode == 38) {  
upArrow = true;  
// show thruster  
if (gameMode == “play”)  
{  
ship.gotoAndPlay(“burn”);  
}

} else if (event.keyCode == 32) { // space  
newMissile();  
} else if (event.keyCode == 90) { // z  
startShield(false);  
}  
}

// register key ups  
public function keyUpFunction(event:KeyboardEvent):void {  
if (event.keyCode == 37) {  
leftArrow = false;  
} else if (event.keyCode == 39) {  
rightArrow = false;  
} else if (event.keyCode == 38) {  
upArrow = false;  
// remove thruster  
if (gameMode == “play”)  
{  
ship.gotoAndStop(1);  
}  
}  
}

I just went with gotoAndStop for the release but the intention is to get it playing “cool”. If I can get one label working I’m sure I can figure out the rest.

The fla is pretty useless so I’d have to show an swf, well this is the only way I can figure out to upload

> **[Space Rocks Animations Test](http://almwitch.deviantart.com/art/Space-Rocks-Animations-Test-115066239)**
>
> test

There is more bugs in there like if you rotate with left or right the animation loops all frames infinitely while holding but if I can just get labels working right I’ll be pleased.

Any help appreciated. If you need more of the code let me know.
