In the movie below the message on the right and stops in the center. In this movie we only move the message if message.x>60.
The code is shown below:
//The message enters on the right and stops in the middle
this.addEventListener(Event.ENTER_FRAME,frames);
function frames(e:Event): void {
if(message.x>60) {
message.x=message.x-2;
}
} //frames
A Boolean expression can do a comparison using any of the symbols below:
| Symbol | Meaning | Example; | < | less than | if(a<b) |
|---|---|---|
> | greater than | if(a>b) |
== | equal | if(a==b) |
!= | not equal | if(a!=b) |
<= | less or equal | if(a<=b) |
>= | greater or equal | if(a>=b) |
Experiment: Make the mesage move up from the bottom and stop when it gets to the middle.