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

Bubbling order of mouse events [Ming wrapper example]

This example demonstrates the bubbling of mouse events.
This flash movie was created with the following program.
OrderOfMouseDown.cpp
#include "SWFMovie.h"

void rect(Shape& shape, int len, byte col) {
  shape.FillStyle(col, col, col);

  shape.Line( len,   0);
  shape.Line(   0, len);
  shape.Line(-len,   0);
  shape.Line(   0,-len);
}

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

  Font     verdana("verdana.fdb");

  movie.Add(Action("var t;"));

  TextField textField(verdana, 14, 0, 0, "", 20, 30, 40, 255);
  textField.Rect(400, 200);
  textField.Wordwrap(true);
  textField.Variable("t");
  textField.ReadOnly(true);

  movie.Add(textField);

  Shape shape_lowest;
  Shape shape_middle;
  Shape shape_topmost;

  rect(shape_lowest, 150, 30);
  rect(shape_lowest, 100, 80);
  rect(shape_lowest,  50,110);

  MovieClip lowest;
  MovieClip middle;
  MovieClip topmost;

  lowest .Add(shape_lowest );
  middle .Add(shape_middle );
  topmost.Add(shape_topmost);

  topmost.NextFrame();

  DisplayClip iTopmost = middle.Add(topmost);
  iTopmost.OnMouseDown("_root.t+='topmost ';");
  middle .NextFrame();

  DisplayClip iMiddle = lowest.Add(middle);
  iMiddle.OnMouseDown("_root.t+='middle ';");
  lowest.NextFrame();

  DisplayClip iLowest = movie.Add(lowest);
  iLowest.Move(0, 200);
  iLowest.OnMouseDown("_root.t+='lowest ';");
  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.