-
1. Re: Dynamice Text adding Numbers
Rob Dillon Jan 23, 2011 6:26 PM (in response to Fumph)What version of Flash are you using and which version of Actionscript are you using? What does you code look like now?
-
2. Re: Dynamice Text adding Numbers
Fumph Jan 23, 2011 6:44 PM (in response to Rob Dillon)Flash pro CS5 and AS3(Because I'm in the Actionscript 3 forum), but currently I have no code because every code I try just doesn't work. There will be compiler errors, text wont show, syntax error! I hope that helps!
-
3. Re: Dynamice Text adding Numbers
Rob Dillon Jan 24, 2011 5:23 AM (in response to Fumph)You might be surprised at how many people who post in this forum are actually using AS2. In any case, you could use something like this:
buttonInstanceName.addEventListener(MouseEvent.MOUSE_UP,myUp);
dynamicTextInstanceName.text = "0";
function myUp(event:MouseEvent):void {
var myTempNum:int = parseFloat(dynamicTextInstanceName.text);
myTempNum += 1;
dynamicTextInstanceName.text = myTempNum.toString();
}
-
4. Re: Dynamice Text adding Numbers
Fumph Jan 24, 2011 8:26 PM (in response to Rob Dillon)Haha I bet! So I tried this code in my project, but! It still doesn't count up! I am thinking it has to do with the fact that I go to a new scene once I click this button. Here is the code for my main scene:
stop();
goal1.addEventListener(MouseEvent.MOUSE_DOWN, shootBall1);
goalCount.text = "0";
function shootBall1(e:MouseEvent):void
{
var myTempNum:int = parseFloat(goalCount.text);myTempNum += 1;
goalCount.text = myTempNum.toString();
trace("Goal!");
gotoAndPlay("shoot1","shootGoal");
}And once it goes back to my main scene it restarts the counting because of the "goalCount.text = "0";". I believe that's my problem, do you have any advice?
-
5. Re: Dynamice Text adding Numbers
Rob Dillon Jan 25, 2011 4:36 AM (in response to Fumph)You can set the inital value of the text conditionally:
if(goalCount.text == "") {
goalCount.text = "0";
}
-
6. Re: Dynamice Text adding Numbers
Fumph Jan 25, 2011 6:52 PM (in response to Rob Dillon)I'm sorry but, it still doesn't work. I don't know what is wrong with it but it doesn't count! Even when I took out the "gotoAndPlay". Its... being difficult! Do you think you could fix it?? Maybe I could e-mail you the FLA. But its okay if you cant.
-
7. Re: Dynamice Text adding Numbers
Rob Dillon Jan 26, 2011 5:23 AM (in response to Fumph)Sure, send me a private message and I'll send you an upload address to send the file to.



