Else if function not working with While function why?

I got a code (

onClipEvent (enterFrame) {
 if (_root.chatbox == "buy") { while (_root.shop == "What would you like to do?") {
   _root.shop = "Yes, Ok then.";
   _root.items._visible = 1;
} else if (_root.chatbox == "sell") {
_root.shop = "Ok. I see you have chosen sell.";
_root.items._visible = 0;
  }
 }
}

)

the Else if function doesnt seem to work well with while function.
When i got rid of the while function it worked.

Any one know why this is happening?

NVM, got it to work.

Couldn’t you just say


onClipEvent (enterFrame) {
 if (_root.chatbox == "buy" && _root.shop == "What would you like to do?") {
   _root.shop = "Yes, Ok then.";
   _root.items._visible = 1;
}

Sandman9

ok that works better.