René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Simple Movie clip [Ming wrapper example]

A movie clip (aka Sprite) rotates and moves to the right.
This flash movie was created with the following program.
MovieClipExample.cpp
#include "SWFMovie.h"

#include <iostream>

int main() {
  Movie movie("MovieClipExample.swf", 400, 300);

  Shape    rect;

  rect.LineStyle(1, 0, 0, 0);
  rect.FillStyle(155,145,165);

  // Creating a rectangle
  rect.MoveTo(-50, -50);
  rect.LineTo( 50, -50);
  rect.LineTo( 50,  50);
  rect.LineTo(-50,  50);
  rect.LineTo(-50, -50);

  MovieClip movieClip;
  DisplayItem iRect = movieClip.Add(rect);

  for (float angle=0; angle<90; angle+=7.5) {
    iRect.RotateTo(angle);
    movieClip.NextFrame();
  }

  DisplayItem iClip = movie.Add(movieClip);
  iClip.Name("rot");
  
  movie.Add(Action("rot._x+=4; rot._y+=3;"));
  movie.NextFrame();

  movie.Add(Action("prevFrame();play();"));
  movie.NextFrame();

  return 0;
}
This is one of a series of examples that demonstrates the C++ ming wrapper classes. Other examples can be found here.