1. Foreword
PowerBuilder (hereafter referred to as PB) is an object-oriented, rapid development database development platform, often used in database development, Flash animation not only contains animation, but also have a sound such as the formation of a very image of the dynamic screen, in the PB development of the program to add Flash animation, making the program more dynamic To create a more user-friendly interactive interface for users. The following is a way to animate the OLE control "Swflash.ocx" provided by Flash 5 in PB8.0 database programming.
2. Use of OLE controls in PB
Using the "Swflash.ocx" control in a PB8.0 environment, first create a window, then add an OLE control to the form, and use OLE to connect the FLASH 5 control "Swflash.ocx" as follows:
(1) Select Menu "Cotrols | OLE, displays the window Insert object, chooses insert control, and finds "Shockware FLASH object" in the control Tyle (if it is not registered, select Register Now) Register the control); go back to the PB window and click the mouse to place the control on the window and resize it.
(2) Use the main properties provided by the FLASH5.0 control "Swflash.ocx" in programming:
Movie property: The URL of the Flash animation file: Write the full directory name on the local disk or the address on the Internet by browsing the Web page, for example: f:\touch\start.swf.
Quality (resolution) Properties: playback resolution, with 0 (low), 1 (Autolow), 2 (Hight), 3 (Autohight), 4 (best) five values.
Scale property: The screen that plays, has 0 (showall), 1 (Noborder), 2 (exactfit) three values.
Loop (Loop Playback) property: True, False.
Menu (menu) property: True, False.
(3) According to the needs of the application programming, such as in the window "open" event, set the "Swflash.ocx" control of the property value, input the following code (or in the property page to fill in):
Ole_1.object.movie= "F:\ \touch\start.swf"
Ole_1.object.loop=true
Ole_1.object.quality=4
ole_1.object.scale=2
Ole_1.object.menu=true
3. PB Control Animation playback
The above set the control's properties, in the program can only play the generated animation file ("*.swf"), PB can not control the animation, to PB control Flash animation, you need to use the "Swflash.ocx" control methods and events.
(1) using the control "SetVariable" method can realize the display of dynamic text (for example, play a text in the animation "I Love Flash", change to "I Love" PB). The practice is as follows:
A to set the text field variable in the Flash animation.
Select the dynamically displayed text object in Flash, and select dynamic text in the Textoptions panel to set the Text field type. Then enter the field variable name in variable: "Disptext". In the text box, type "I love Flash"