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

Multiple Action [Ming wrapper example]

This example demonstrates that the order in which Action's are added to a MovieClip_ is important.
If the line that reads #define WORKS is removed, then the TextField won't change its text.
This flash movie was created with the following program.
MultipleAction.cpp
#include "SWFMovie.h"

int main() {
  Movie       movie   ("MultipleAction.swf", 300, 50);
  Font        verdana ("Verdana.fdb");
  TextField   result  (verdana, 16, 10, 25, "The result", 255, 0, 0);
  result.ReadOnly(true);

  DisplayItem iResult= movie.Add(result);
  iResult.Name("result");

  MovieClip clip;

#define WORKS
#ifdef WORKS
  clip.Add(Action("function x() {return 'func x returned';}"));
  clip.Add(Action("_root.result.text=x();"));
#else
  clip.Add(Action("_root.result.text=x();"));
  clip.Add(Action("function x() {return 'func x returned';}"));
#endif 

  clip.NextFrame();
  movie.Add(clip);

  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.