Dynamically generate flash webpage Sun Yizhi (2000-09-19) Editor's press: The development of programming technology is really a new year. Dynamically generates HTML web pages through ASP and other programs seems to be a new technology. Since the launch of Macromedia, Macromedia's Flash Technology has been launched, and the Flash website has been a popular trend. Just like the HTML page can be dynamically generated with ASP, Flash animations can also be dynamically generated using languages that support COM Automation (such as Borland Delphi, ASP, Visual Basic, etc.). This article details how to apply Bukoo Flash Objects to implement the interaction application of the Flash page, with strong practical value. It is worth the programming to chase a new family. 1. Overview of the author applies ATL in Microsoft Visual C , encapsulates the advanced classes in the SWF SDK into COM Objects so that more supporting the programming language of Com Automation can generate Flash animations. These com Objects are named Bukoo Flash Objects. This article is not to describe the development method and process of Bukoo Flash Objects, but introduce how to use it. Second, download and install Bukoo Flash Objects can be downloaded in this URL: http://www.delphibbs.com/bukoo or http://www.geocities.com/yiyisun/bukoo. The downloaded file is swfobjs.zip, in addition to documentation and examples, Bukoo Flash Objects is installed in swfobjs.dll, install bukoo flash objects using Regsvr32 swfobjs.dll; use regsvr32 /uswfobjs.dll to remove bukoo flash objects. Third, the basic object and its attributes Bukoo Flash Objects include three com objects: swfmovie, swfObject and swfaction. By creating these three objects to generate flash animations: Create a Swfmovie animation object; set animation properties; create, insert, remove SwfObject elements objects and SwfAction action objects in the frame; finally output Flash animation. Here are the introduction of these three object applications. 1. Swfmovie animation object Swfmovie object represents the upcoming Flash animation, first need to set the size of the animation, the SWFMovie object's SetSize method is used to set the size of the animation. Note that the coordinate unit in SWF is TWIP, namely 1/1440 inches, or 1/20 pixels, such as 400 x 300 pixels, which is 8000 x 6000 TWIP. Must be called: Setsize (8000, 6000). SetFramerate (12) is an animation to put 12 frames per second, high per second, the animation is smooth, but the SWF file will become large, affect the download speed, so we need to weigh the loss. Use the Gotoframe method to position to the specified frame, then insert an element or action, the Swfmovie object automatically adds the maximum number of frames to the Call Gotoframe method. The method of inserting and deleting elements is addObject, RemoveObject, and inserting the action method is addAction. The WRITEMOVIE method is to generate a SWF file in accordance with the specified file name.
Swfmovie's Content property is a Variant type, or you can use the response.binarywite in the ASP to the web page. 2. SwfObject Element Object SwfObject is like a thousand faces, after creating this object, can be used to make it polygilant with its MakeRectangle method; becomes an ellipse with the Makeoval method; becomes a round with the Makecircle method Shape; use the MakePitcure method to become a JPEG image; becomes a button with the MakeButton method; becomes a sound with the makeFont method; use the MakeFont method to become a font; becomes the maketext method. The text processing in SWF is special, and you need to convert the TrueType font into a font object, and then generate text with font objects. SwfObject's Translate method is used to pan the element, the coordinate positioning TWIP; the Rotate method is used to rotate the element; Scale is used to zoom the element. Note that the parameter unit of the rotation and zoom method is also particularly special. It is called Fixed. Simple conversion method is to multiply 65536, such as 10 degrees of rotation, need to use 10 × 65536, zoom in to zoom in, to zoom in, 2 × 65536, and second. SwfObject's setLineWidth method is used to set the width of the object boundary line, unit twip; setLineColora method is used to set the color of the object edge line, which has four parameters, represents red, green, blue, and alpha, respectively. The Alpha parameter specifies the degree of transparency of the color. Alpha = 255 is opaque, completely covered the following graphics; alpha = 0 is full transparent, let the following graphs all transparent, you can't see it. SwfObject's setNofill method is used to set objects that do not populate, and setSolidFill is used to set objects with monochrome fill, or use alpha to specify transparency. SetLinearfill method For setting objects from one color to another color, the setLinearfillCenter method is used to set the center point of the color linear transition. SetradialFill method is used to set an object gradually transition from a color to another color radioactivity. The SetradialFillCenter method is used to set the center point of the color radioactive transition. SwfObject changes the process of the method of the button, because the button requires four graphics, representing the tutaneous state, the mouse over state, the mouse drop status, and the state of the prompt state. The action will be excited after the button is pressed, and the action object is added to the QueueEvent method. 3. SWFAction Action Objects Currently, Bukoo Flash Objects supports five actions: stop animation, play animation, jump to a frame, navigate to the URL, and navigate to the URL of a HTML Frame. Like SWFObject, after the SWFAction object is created, you can use makeActionStop, makeActionplay, makeactiongotoframe, makeactiongotourn, and makeactiongotofrget to turn into a corresponding action.