home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 14 / IOPROG_14.ISO / soft / sdkjava / dxma.exe / DXMA05.cab / samples / da / java / exercises / Movie / Movie.java < prev   
Encoding:
Java Source  |  1997-11-13  |  1.1 KB  |  37 lines

  1. // This applet imports and playback a movie repeatedly.
  2. //
  3. // Copyright (c) 1997 Microsoft Corporation
  4.  
  5. import com.ms.dxmedia.*;
  6. import java.net.URL;
  7.  
  8. public class Movie extends DXMApplet {  
  9.   public void init() {
  10.     super.init() ;
  11.     setModel (new MovieModel());
  12.   }
  13. }
  14.  
  15. // This class extends the Model class.  The createModel method in this class
  16. // is where you construct your model.
  17. class MovieModel extends Model {
  18.  
  19.   // Import and plays back a movie.
  20.   public void createModel(BvrsToRun bvrs) {
  21.  
  22.     // Create a movie behavior by importing an avi file.
  23.     URL movieBase = buildURL(getImportBase(),"movie/");
  24.     ImageBvr[] imgArr = {null};
  25.     SoundBvr[] sndArr = {null};
  26.     NumberBvr lenNum = importMovie(buildURL(movieBase, "movie.avi"),
  27.                                    imgArr, sndArr);
  28.  
  29.     // construct an image and a sound behavior that loop
  30.     ImageBvr movieImg = ImageBvr.newUninitBvr();
  31.     movieImg.init(until(imgArr[0], timer(lenNum), movieImg));
  32.  
  33.     setImage(overlay(movieImg, solidColorImage(black)));
  34.     setSound(sndArr[0].loop());
  35.   }
  36. }
  37.