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

Dragging text [Ming wrapper example]

This example demonstrates how text can be dragged with the mouse. See also Dragging II and Hit test.
This flash movie was created with the following program.
Dragging.cpp
#include "SWFMovie.h"

int main() {
  Movie      movie ("Dragging.swf", 400, 200);
  Text       text(Font("Verdana.fdb"), 14, 0, 14, "Mouse Down anywhere!!! drags me", 0x40, 0x60, 0x80, 0xff);
  MovieClip  clip;

  clip.Add(text);

  DisplayClip  iDrag = movie.Add(clip);

  // If an action should be reused, it can be added
  // multiple times
  // ----------------------------------------------
  // iDrag.OnMouseDown(Action("startDrag();"));
  // iDrag.OnMouseUp  (Action("stopDrag ();"));
  
  iDrag.OnMouseDown("startDrag();");
  iDrag.OnMouseUp  ("stopDrag ();");
  clip.NextFrame();

  movie.Stop();
  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.