static void do_movie (int version) { char name[100]; SWFMovie movie; SWFTextField text; SWFDisplayItem display; movie = newSWFMovieWithVersion (version); movie = newSWFMovie(); SWFMovie_setRate (movie, 1); SWFMovie_setDimension (movie, 200, 150); text = newSWFTextField (); SWFTextField_setVariableName (text, "/:foo"); display = SWFMovie_add (movie, (SWFBlock) text); SWFMovie_nextFrame (movie); SWFMovie_add (movie, (SWFBlock) newSWFAction ( "loadMovie (\"FSCommand:quit\", \"\");" )); SWFMovie_nextFrame (movie); sprintf (name, "crash-0.5.3-text-field-root-variable-%d.swf", version); SWFMovie_save (movie, name); }
void add_text_field(SWFMovie mo, const char* name, const char* varname, const char* initial_label, int depth, int x, int y) { SWFDisplayItem it; SWFTextField tf = newSWFTextField(); SWFTextField_setFont(tf, (void*)font); SWFTextField_addChars(tf, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345689:.,/\\#@?!"); SWFTextField_setVariableName(tf, varname); SWFTextField_addString(tf, "Idle"); SWFTextField_setBounds(tf, 120, 12); SWFTextField_setFlags(tf, SWFTEXTFIELD_DRAWBOX|SWFTEXTFIELD_NOEDIT); it = SWFMovie_add(mo, (SWFBlock)tf); SWFDisplayItem_moveTo(it, x, y+2); SWFDisplayItem_setDepth(it, depth); SWFDisplayItem_setName(it, name); // "textfield"); // Label tf = newSWFTextField(); SWFTextField_setFont(tf, (void*)font); SWFTextField_addString(tf, initial_label); SWFTextField_setFlags(tf, SWFTEXTFIELD_DRAWBOX|SWFTEXTFIELD_NOEDIT); it = SWFMovie_add(mo, (SWFBlock)tf); SWFDisplayItem_scale(it, 0.3, 0.3); SWFDisplayItem_setDepth(it, depth*10); SWFDisplayItem_moveTo(it, x, y); }
static VALUE set_variable_name(VALUE self, VALUE name) { SWFTextField tf; Data_Get_Struct(self, struct SWFTextField_s, tf); SWFTextField_setVariableName(tf, StringValuePtr(name)); return self; }
void add_xtrace_function_clip(SWFMovieClip mc, SWFBlock font, int depth, int x, int y, int width, int height) { SWFTextField tf; SWFDisplayItem it; int flags; tf = newSWFTextField(); SWFTextField_setFont(tf, font); /* setting flags seem unneeded */ flags = 0; //flags |= SWFTEXTFIELD_USEFONT; flags |= SWFTEXTFIELD_WORDWRAP; //flags |= SWFTEXTFIELD_NOEDIT; SWFTextField_setFlags(tf, flags); /* Add all ascii chars */ SWFTextField_addChars(tf, asciichars); SWFTextField_addString(tf, " - xtrace enabled -\n"); SWFTextField_setBounds(tf, width, height); /* * Hopefully we have a *single* _root. */ SWFTextField_setVariableName(tf, "_root._trace_text"); /* * Set flags explicitly so that the field is selectable * and you can cut&paste results. * (the default seems to include SWFTEXTFIELD_NOSELECT) */ SWFTextField_setFlags(tf, SWFTEXTFIELD_NOEDIT); /*SWFTextField_setHeight(tf, 240);*/ /*SWFTextField_setColor(tf, 0x00, 0x00, 0x00, 0xff);*/ /*SWFTextField_setAlignment(tf, SWFTEXTFIELD_ALIGN_LEFT);*/ /*SWFTextField_setLeftMargin(tf, 0);*/ /*SWFTextField_setRightMargin(tf, 0);*/ /*SWFTextField_setIndentation(tf, 0);*/ /*SWFTextField_setLineSpacing(tf, 40);*/ /*SWFTextField_setLineSpacing(tf, 40);*/ it = SWFMovieClip_add(mc, (SWFBlock)tf); SWFDisplayItem_moveTo(it, x, y); SWFDisplayItem_setDepth(it, depth); SWFDisplayItem_setName(it, "_xtrace_win"); add_clip_actions(mc, " _root.xtrace = function (msg) { " " _root._trace_text += msg + '\n'; " "};"); }
void add_xtrace_function(SWFMovie mo, SWFBlock font, int depth, int x, int y, int width, int height) { SWFTextField tf; SWFDisplayItem it; tf = newSWFTextField(); SWFTextField_setFont(tf, font); /* setting flags seem unneeded */ /*SWFTextField_setFlags(tf, SWFTEXTFIELD_USEFONT|SWFTEXTFIELD_NOEDIT);*/ /* Add all ascii chars */ SWFTextField_addChars(tf, asciichars); SWFTextField_addString(tf, " - xtrace enabled -\n"); SWFTextField_setBounds(tf, width, height); /* * Hopefully we have a *single* _root. */ SWFTextField_setVariableName(tf, "_root._trace_text"); /*SWFTextField_setHeight(tf, 240);*/ /*SWFTextField_setColor(tf, 0x00, 0x00, 0x00, 0xff);*/ /*SWFTextField_setAlignment(tf, SWFTEXTFIELD_ALIGN_LEFT);*/ /*SWFTextField_setLeftMargin(tf, 0);*/ /*SWFTextField_setRightMargin(tf, 0);*/ /*SWFTextField_setIndentation(tf, 0);*/ /*SWFTextField_setLineSpacing(tf, 40);*/ /*SWFTextField_setLineSpacing(tf, 40);*/ it = SWFMovie_add(mo, (SWFBlock)tf); SWFDisplayItem_moveTo(it, x, y); SWFDisplayItem_setDepth(it, depth); SWFDisplayItem_setName(it, "_xtrace_win"); add_actions(mo, " _root.xtrace = function (msg) { " " trace (msg); " " _root._trace_text += msg + '\n'; " "};"); }
EXPORT BOOL WINAPI tf_setName(void *p1, char *name, int p3, int p4) { lstrcpy(funcname, "tf_setName"); SWFTextField_setVariableName(mhsp_field, name); return 0; }