|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Variables
I need to do the following:
i have this code, that verify if some one wrote 'like' on a text box placed on stage // if (text1 == "like") { // gotoAndPlay(10); // } else { // gotoAndPlay(15); // } but i need that even if some one write 'alike' or somelike the movieplayer goto frame 10 and not to 15 i know to do that in PHP, using the %xpto% but can't do it on ActionScript. if someone could help me... |
|
#2
|
||||
|
||||
|
What about...
[/CODE] if (text1 == "like") { gotoAndPlay(10); } elseif (text1 == "alike") gotoAndPlay(10); } else { gotoAndPlay(15); } [/CODE] ...I don't know if there's something like: Code:
if (text1=="like" or text1=="alike") .. ...but I guess not. |
|
#3
|
|||
|
|||
|
thanks for your post, a lot...
but what i want is that if someone writes anyhting before or after 'like' flash could get it. EG if the user write 'I like apples' (or you like oranges, or anything) the movie go to frame 10 if not, go to 15 |
|
#4
|
|||
|
|||
|
try looking into the methods: indexOf() and substr()
|
|
#5
|
|||
|
|||
|
Try this:
---------- var f = 15; if ( text1.indexOf("like")!=-1 ) f = 10; gotoAndPlay(f); ---------- or (same code): ---------- gotoAndPlay( text1.indexOf("like")!=-1 ) ? 10 : 15 ); ---------- the function indexOf tells the position of substring "like" in text1, if text1 doesn't have the substring "like" it returns -1. |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Variables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|