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

ButtonTest [Ming wrapper example]

This flash movie was created with the following program.
ButtonTest.cpp
#include "SWFMovie.h"

int main() {
  Movie  movie   ("ButtonTest.swf", 600, 100);
  Font      verdana ("Verdana.fdb");
  Text      click_me(verdana, 16, 0, 0, "Click me!", 255, 0, 0);
  Shape     shape_bg;
  Button    btn;

  float txt_width = verdana.Width("Click me!", 16);

  shape_bg.DrawFilledRectWithBorder(0, -verdana.Ascent(16), txt_width, verdana.Descent(16),
      90, 90, 220, 40,
       1,
       0,  0,  0, 255);

  //Action nextFrame("nextFrame();");
  btn.Add(shape_bg, SWFBUTTON_UP|SWFBUTTON_DOWN|SWFBUTTON_OVER|SWFBUTTON_HIT);
  btn.Add(click_me, SWFBUTTON_UP|SWFBUTTON_DOWN|SWFBUTTON_OVER|SWFBUTTON_HIT);
  btn.Add(Action("nextFrame();"), SWFBUTTON_MOUSEUP);

  DisplayItem iBtn = movie.Add(btn);
  iBtn.Move(40,40);

  movie.Stop();

  movie.NextFrame();

  movie.Remove(iBtn);

  Text frame_2(verdana, 16, 40, 40, "Frame 2", 255, 0, 0);
  movie.Add(frame_2);

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