Flash Action Scripting

by Daganev

Back to Mechanic's Corner.

Daganev2004-12-03 03:45:07
So I suddenly find out my partner expending me to come up with the code when he said "I have an idea of how it might work". So I ask your help.

First the Goal: We have video clips. You enter a phrase like Jump up and down, and the video clip of jumping will be played. You type in Hit her and the video clip where he hits her gets played. The basic code is as follows

CODE
on (release, keyPress "") {
   if (answer eq "rooster" or answer eq "cockerel") {  
       gotoAndPlay ("win");
   } else if (answer eq "hen" or answer eq "chicken") {
       gotoAndStop ("boy");
   } else {
       gotoAndStop ("wrong");
   }
}


The problem with that is, if they type "Rooster" it works, if they type in "Its a Rooster" it won't work.

I'm trying to figure out how to code in the type of pattern matching zmud does into flash so that for the clip "jump" both "jump up and down works" and "Hey you go do a jump or something" works. We also have some clips where the action is directed to another person. so I need code that says something like. If answer = *hit* AND *her* play clip HIT HER, or if Answer =*hit* NOT *hit*AND *her* play clip HIT.


Thanks in advance.

I know theres some genouses out there. Just can't find the proper syntax for FLASH to understand my ZMUD like thinking.