PDA

View Full Version : scoring in Flash - actionscript problem



ro1bu85
Sep 8th, 2005, 12:47 PM
hi
i am producing a quiz and have a scoring system. the quiz has a comment at the results page. the comments depend on the score. I have this scripting:





onEnterFrame = function(){
if (this._parent._score = 0){
this.resultText = "you didnt make an improvement";
}
if (this._parent._score = 1,2,3,4,5){
this.resultText = "you hardly made an improvement";
}
if (this._parent._score = 6,7,8,9,10){
this.resultText = "almost full points, well done";
}
}



well u get the picture... the code skips all the if statements and goes right to the last one and displays the last comment no matter what the score is. What is wrong?

fmx
Sep 9th, 2005, 05:08 AM
try-


onEnterFrame = function(){
if (this._parent._score == 0){
this.resultText = "you didnt make an improvement";
}
if (this._parent._score >=1 && this._parent._score <=5){
this.resultText = "you hardly made an improvement";
}
if (this._parent._score >= 6){
this.resultText = "almost full points, well done";
}
}

might need some tweaking, but you should get the idea... not sure what the onenterframe is for...

ro1bu85
Sep 9th, 2005, 02:06 PM
lol i originally wanted it to update the comments every frame but i scrapped that. thanks i will try that out.

ro1bu85
Sep 9th, 2005, 02:11 PM
no now im getting that _level0.instance4.resultText message...

i also tried else if but that also doesnt work.. any other ideas??