|
|
|
#1 |
|
Junior Member
Join Date: Jul 2004
Posts: 5
|
string comparsion problem
Hello there,
I got here a string comparing problem (or I think it is). I try to random generate a number and, say I will drag that number over some other instances, when that number match a instance's name, it will shows "correct" Now, I got a object instance called a07. on (release) { display = substring((Math.random()), 1, 3); } Occasionally, display will equal 0.7 Now, with the following coding, hello = "0." + substring(this._droptarget, 4,1); // where this.droptarget is the instance a07 if (hello == display) { _root.green_box.gotoAndStop(2); //Let's say it do stuff A } else { _root.green_box.gotoAndStop(3); //Let's sat it do stuff B _root.a07.gotoAndStop(3); } hello should equal 0.7 as well. However, everytime I drag the number over a07, it will do the else part rather than the if part. I must have misunderstand something about the string class... Could anyone help me here? Thank you very much. Kelly |
|
|
|
|
|
#2 |
|
Run for your life!
Join Date: Jul 2003
Location: Vancouver, Canada
Posts: 679
|
try using some tracing, ex
see if it's actually running that or if theres some problem oh, and use the [/as] [as] tags for code (i put them in wrong order so they dont work
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2004
Posts: 5
|
gobal variable???
Hello there,
Thanks for the advice. I tried the trace line, and it ends up the display has NOTHING in it...empty string..... but it appear on screen all right. I have look at my display variable, which is a single line dynamic text. I wonder if this is the problem, something like local variable which can't be use outside the function. I was looking at the ActionScript manual, whcih said you can use either setVariables action or (=) assignment to set a gobal variable, which I already did
Am I doing something wrong? Kelly |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|