This has just been started, please feel encouraged to contribute

Gotchas with Movie Clips (SWFMovieClip)

Remember to call SWFMovieClip_nextFrame() on a movie clip after you've added your object(s) to it, else it will NOT show up in your movie.

i.e.:

   1         // Create the movie clip object
   2         movie_clip = newSWFMovieClip();
   3 
   4         // Add the text object to the movie clip
   5         SWFMovieClip_add(movie_clip, (SWFBlock) my_object);
   6 
   7         // Advance the movie clip one frame, else it doesn't get displayed
   8         SWFMovieClip_nextFrame(movie_clip);
   9 
  10         // Add the movie clip object to the main movie
  11         display_item = SWFMovie_add(my_movie, (SWFBlock) movie_clip);

Gotchas with Text (SWFText)

Bug with SWFText_moveTo() - With all Ming versions up to and including 0.4.0.beta5.

If you are adding multiple text strings to a single Text object, then you can't use SWFText_moveTo() to set the x co-ordinate back to 0. (0 gets ignored by this function)

Quick example, let's say you want to create a single text object with two lines of text:

So, you create the font object, then create the text object and assign it properties (i.e. the font to use, height, color, etc).

Then you add the string "First line" to it.

Now you want to move the pen position down one line and back to the x origin, so you can add the second string "Second line". In theory, you should be able to do this:

   1   // Move to the appropriate Y position
   2   SWFText_moveTo(text_object, 0, scaled_font_size);

But no, there's a bug. SWFText_moveTo() checks for the presence of 0 and then ignores it, so your text ends up like:

   First line
             Second line

The workaround if you're using an affected version is to position the pen x position to one twip away from 0. i.e.

   1   // Move to the appropriate Y position
   2   SWFText_moveTo(text_object, 0, scaled_font_size);
   3 
   4   // Try and move X as close as possible to 0.  We can't use 0 in SWFText_moveTo() due to a bug in Ming
   5   current_ming_scale = Ming_getScale();
   6   Ming_setScale(1);
   7   SWFText_moveTo(text_object, 1, 0);
   8   Ming_setScale(current_ming_scale);

libming: MingGotchas (last edited 2009-06-25 03:09:39 by localhost)