Editor's press: The development of programming technology is really a new day. 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.
I. Overview
The author applies the ATL in Microsoft Visual C , encapsulates the advanced classes in the SWF SDK into COM Objects to make more programming languages that support 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 at 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, basic objects and their properties
Bukoo Flash Objects includes 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
The Swfmovie object represents the upcoming Flash animation, first requiring the size of the animation, the SWFMovie object's setSize method is used to set the movie size. 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, it can be used to make it a polygon in its MakePolygon method; becomes a rectangle with the MakeRectangle method; use the MakeOval method to become an elliptical; becomes a circular shape; use the MakePitcure method Change the JPEG image; becomes a button with the MakeButton method; becomes a sound with the makeFont method; use the MakeFont method to become a font; use the MakeText method to become text, and so on. 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 object
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 an 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.
Fourth, ASP example
This ASP program (SAMPLE1.ASP) will dynamically create flash animations, including radioactive pads, and 3-to-right text and three expansion circles, SWF files will be written to the browser in binary flow. . Sample1.asp source code. If you need to insert a dynamically generated Flash animation into another web page, you can do it with reference to DispsWF.asp.
The URLs used by the two ASPs are:
http://localhost/swf/dispswf.asp? SWF_URL = Sample1.asp & Width = 300 & height = 50
V. Further discussion
With COM technology, Bukoo Flash Objects has a bridge between other programming languages or environments other than VC SWF SDK and VC , making it easy to generate flash animations with ASP, Delphi, and other languages.
However, SWF SDK includes many errors, downloads and readers using SWF SDK require special attention, for example, without converting the TrueType font to the Flash font, the geometric transformation formula of the object is wrong, etc.. These issues have many discussions in the discussion group of Openswf.org and Flashkit.com. When making Bukoo Flash Objects, the author has tried a number of similar defects and errors. It is estimated that there is still an omission, which will greatly affect the quality of Bukoo Flash Objects. As Flash 5 is officially released, SDK in SWF 5 is expected to be launched soon, and I hope it can fix the bugs. By then, the author will recompile Bukoo Flash Objects with the new SDK.
The next version of the Bukoo Flash Objects plans to increase the Chinese, the Sprite (Sprite) and the Morph's support.
Welcome readers make recommendations and criticisms for Bukoo Flash Objects.