actionscript 3 - AS3 Array Display button not working properly -
i'm working on program learn how use arrays in computer course , display button doesn't work after first press. first time click it, works , displays 2nd time stop showing first value , starts showing last value twice, 3rd time cuts off 2nd value , displays last value 3 times , on. , when press button find sum of values gives me sum of of values show after hit display button. here's code, , sorry french commentary, it's school.
function afficherfunction(event:mouseevent):void { // compose cette fonction visant à afficher tous les éléments du tableau. txtsortie.text = ""; var entier:int; entier = -1 (var i:int=entier; < mesentiers.length; i++) { if (i+1 < mesentiers.length) { mesentiers[i] = mesentiers[i+1]; affichage = affichage + mesentiers[i] + "\n" } } txtsortie.text = affichage; affichage = ""; = -1; } //fin fonction afficher.
mesentiers[i] = mesentiers[i+1];
this line problem. not sure meant line doing, it's setting value @ index i
value @ next index--essentially shifting values down 1 (and losing value @ index 0).
Comments
Post a Comment