Cornbane
05-03-2010, 03:59 AM
Hey guys. I'm having an issue with a simple bit of code that seems too easy, but it just won't work for me. I couldn't find the solution in help or google within reasonable time so hopefully someone can toss me a solution quickly.
Here's a simple example of what I'm looking for:
I have a variable:
var myVar:String = "cheese";
When I click a button I want addition text added to that variable:
stage.addEventListener(MouseEvent.MOUSE_DOWN, yayIWasClicked);
function yayIWasClicked(e:MouseEvent):void {
myVar = myVar + "extratext";
}
The code there is what I thought would work, it did, but not how I wanted it to. What I want it to do is keep adding to the variable each time instead of just once.
Can anyone turn me in the right direction?
Here's a simple example of what I'm looking for:
I have a variable:
var myVar:String = "cheese";
When I click a button I want addition text added to that variable:
stage.addEventListener(MouseEvent.MOUSE_DOWN, yayIWasClicked);
function yayIWasClicked(e:MouseEvent):void {
myVar = myVar + "extratext";
}
The code there is what I thought would work, it did, but not how I wanted it to. What I want it to do is keep adding to the variable each time instead of just once.
Can anyone turn me in the right direction?