CREATE ANIMATE Example


Example:

 

*

 

 

.Define the Objects and Variables

.

 

 

ANIMATE1

ANIMATE

 

BUTTON1

BUTTON

 

BUTTON2

BUTTON

 

RESULT

INTEGER

1

MODE

INTEGER

1 // 0 = stopped, 1 = playing

*

 

 

.Create the Objects

.

 

 

  

CREATE

ANIMATE1=2:10:20:50,BORDER=1

  

CREATE

BUTTON1=23:24:31:38,"Play"

  

CREATE

BUTTON2=23:24:42:49,"Quit"

*

 

 

.Open the Automation file

.

 

 

  

ANIMATE1.OPEN GIVING RESULT USING "clock.avi"

  

IF

NOT ZERO

  

ALERT

STOP,"Animation file not found.",RESULT

  

STOP

 

  

ENDIF

 

*

 

 

.Activate the Objects

.

 

 

  

ACTIVATE

ANIMATE1

  

ACTIVATE

BUTTON1,CONTROL,RESULT

  

ACTIVATE

BUTTON2,QUIT,RESULT

*

 

 

.Wait for an Event to Occur

.

 

 

  

LOOP

 

  

  EVENTWAIT

 

  

REPEAT

 

*

 

 

.Terminate the Program

.

 

 

QUIT

 

 

 

CLOSE

ANIMATE1

  

STOP

 

*

 

 

.Control the Animation

.

 

 

CONTROL

 

 

  

IF

(MODE = 0)

  

ANIMATE1.PLAY

  

ELSE

 

  

ANIMATE1.STOP

  

ENDIF

 

  

SUB

"1",MODE

  

RETURN

 

 

This instruction creates a ANIMATE object at the specified location. The file played is 'clock.avi'. Once the program executes, clicking on the play button allows the animation to begin. Clicking the stop button stops the animation. Clicking on the Quit button terminates the program.

 

 



PL/B Language Reference COUNT Example CREATE AUTOMATION Example