SWF making with dynamic text effects
How to make SWF with dynamic text effects with Delphi SWF SDK Base edition only (not using ActionScript compiler)?
Let's create a movie with a text effect with Flash Professional 8. This will be randomly dropping chars.
So, we make it in Flash IDE:
1. File -> New... -> Flash Document.
2. Set frame rate to 24 fps and choose version Flash Player 7.
3. Select the first frame.

4. Enter the following code in the Actions window:
var str: String = "Hello, world!"; var y = 200; var startflag = str.length; stop(); function cl_enter_frame() { this.v = this.v + 1; this._y = this._y + this.v; if (this._y > _root.y) { this.v = this.v * -0.700000; this._y = _root.y; } // end if if (Math.abs(this.v) < 0.500000 && Math.abs(this._y - _root.y) < 1) { this._y = _root.y; delete this.onEnterFrame; _root.startflag -= 1; if (_root.startflag == 0) _root.play(); } // end if } // End of the function function extractObjects(str) { var _l8 = 0; var _l10 = 0; var _l5 = []; var _l11 = 0; while (_l11 < str.length) { var _l3 = _root.createEmptyMovieClip("l_" + _l11, _l11 + 1); _l5.push(_l3); _l3.createTextField("t_field_" + _l11, _l3.getNextHighestDepth(), 0, 0, 0, 0); var _l2 = _l3["t_field_" + _l11]; _l2.embedFonts = true; var _l7 = str.charAt(_l11); _l2.text = _l7; var _l4 = new TextFormat(); _l4.font = "myfont"; _l4.color = 0; _l4.size = 24; _l2.setTextFormat(_l4); _l2.autoSize = "left"; _l2.selectable = false; var _l6 = _l2._width - _l2.textWidth; _l3._x = _l8; _l8 = _l8 + (_l2._width - _l6 / 2); _l3.v = -10 * Math.random(); _l3.onEnterFrame = cl_enter_frame; ++_l11; } // end while _l10 = (Stage.width - _l8) / 2; for (var _l11 in _l5) { _l5[_l11]._x = _l5[_l11]._x + _l10; } // end of for...in } // End of the function extractObjects(str);
5. Right click at the Library window, select in the popup menu New Font...
6. Set font parameter.

7. Right click at myfont, select in the popup menu Linkage...
8. Set flag Export for ActionScript.
9. Save file as "char_jump.fla".
10. Click Ctrl+Enter for testing.
That's all, our example is ready.
Download Parse demo from our site. Run parse.exe and open "char_jump.swf".
When analyzing SWF, we can see that it contains 3 important tags: DefineFont2, ExportAssets and DoAction. Note, DefineFont2 contains outlines for all chars, but SWF uses just some of the chairs. DoAction contains all actions and the first instruction ConstantPool containing our dropping text.

Now let's try to make the same SWF in Delphi .
1. Create Console Application.
2. Write code:
program as_textjump; uses Windows, SysUtils, FlashObjects, SWFObjects, SWFConst; var stt: string; Movie: TFlashMovie; label1, label2, label3, label4, label5, label6, label7, label8, label9, label10: TSWFOffsetMarker; begin if ParamStr(1) = '' then stt := 'Hello world!' else stt := ParamStr(1); Movie := TFlashMovie.Create(0, 0, 500, 400, 24, scPix); Movie.Compressed := true; Movie.Version := SWFVer7; Movie.AddFont('Courier New', true, false, 20, false); with Movie.Fonts[0] do begin AddChars(stt); Layout := true; end; Movie.ExportAssets('myfont', Movie.Fonts[0].CharacterId); with Movie.FrameActions do begin // insert actions end; Movie.ShowFrame(2); Movie.MakeStream; Movie.SaveToFile('delphi_char_jump.swf'); Movie.Free; end.
3. In tree select DoAction tag (Parse demo).
4. Select menu command Tools -> Copy pascal actions to clipboard.
5. Paste code to Movie.FrameActions
6. Declarate lebel1, lebel2, ... label10: TSWFOffsetMarker;
7. Replace "Hello world!" with stt.
8. Change line Push([FlashVar_null], [vtNull]);
to Push(['FlashVar_null'], [vtNull]); or Push([fvNull], [vtNull]);
Compiling we have a new SWF identical to the first one. Take attention our file size is much less because it is included outlines for used chars only.
To download all materials click here.