ASP generated dynamic Flash tools and introduction _ Application Skills
Source: Internet
Author: User
Editor's note: The development of programming technology is really changing. Dynamically generating HTML pages from programs such as ASP doesn't seem to be the latest technology. Macromedia Company's Flash technology since its inception, has 248 million users, the production of Flash website is a popular trend. Just as HTML pages can be dynamically generated using ASP, Flash animations can also be dynamically generated using languages that support COM automation (such as Borland delphi,asp, Visual Basic, and so on). This paper introduces how to use Bukoo Flash objects to realize the interactive application of Flash Web page, which has very strong practical value. It is worth programming to follow the new tribe at a glance.
I. Overview
Using ATL in Microsoft Visual C + +, I encapsulated the advanced classes in the SWF SDK into COM Objects to enable more COM-Automation programming languages to generate Flash animations. These COM Objects are named Bukoo Flash Objects. This article is not a description of the development method and process of Bukoo Flash Objects, but rather describes how to use it.
Second, download and install
Bukoo Flash Objects can be downloaded at the following URL: Http://www.delphibbs.com/bukoo or Http://www.geocities.com/yiyisun/bukoo. Download the file for Swfobjs.zip, after decompression in addition to documents and examples, Bukoo flash Objects in Swfobjs.dll, use regsvr32 swfobjs.dll install Bukoo flash Objects; use R Egsvr32/uswfobjs.dll Dismount Bukoo Flash Objects.
Iii. basic objects and their attributes
Bukoo Flash Objects includes three COM Objects:swfmovie, SWFObject and Swfaction in total.
The process of generating flash animations by creating these three objects is creating Swfmovie animation objects, setting animation properties, creating, inserting, deleting swfobject element objects and Swfaction action objects in frames, and finally outputting Flash animations. The following is an introduction to the three object application methods.
1. Swfmovie Animation Object
The Swfmovie object represents the Flash animation that is about to be generated, first you need to set the size of the animation, and the SetSize method of the Swfmovie object is used to set the size of the animation. Note that the coordinate unit in the SWF is Twip, or 1/1440 inches, or 1/20 pixels, such as an animation size of x 300 pixels, which is 8000 x 6000 twip. This must be called: setsize (8000, 6000).
Setframerate (12), is the animation 12 frames per second, the frame speed per second high, animation smooth, but the SWF file will become larger, affecting download speed, it needs to weigh the pros and cons. Navigates to the specified frame with the Gotoframe method, and then inserts an element or action, and the Swfmovie object automatically increases the number of frames to the maximum number of calls to the Gotoframe method.
The method of inserting and deleting elements is AddObject, Removeobject, the method of inserting action is addaction.
The Writemovie method is to generate the SWF file according to the specified filename. Swfmovie Content attributes are VARIANT types and can be exported to Web pages using Response.binarywite in AsP.
2. SWFObject Element Object
SWFObject is like a dough brother, after creating this object, you can use its Makepolygon method to make it into a polygon, a Makerectangle method to become a rectangle, a Makeoval method to become an ellipse, a makecircle method to become a circle; The Makepitcure method becomes a Jpeg image, a Makebutton method becomes a button, a MakeSound method becomes a sound, a MakeFont method becomes a font, a Maketext method becomes a literal, and so on. Text processing in SWF is special, you need to convert TrueType fonts to font objects, and then generate text with font objects.
The SWFObject Translate method is used to translate elements, coordinate location Twip, Rotate method to rotate elements, and scale to scale elements. Note that the rotation and scaling methods of the parameter units are also more special, called Fixed, simple conversion method is multiplied by 65536, such as rotation 10 degrees, need to use 10x65536, magnified twice times, need to use 2x65536, and so on. The SWFObject Setlinewidth method is used to set the width of the border line of the object, in units Twip the Setlinecolora method is used to set the color of the border line of the object, which has four parameters, representing red, green, blue, and Alpha, respectively. The Alpha parameter sets the degree of transparency of the color. alpha=255 opaque, completely cover the following graphics; alpha=0 all transparent, so that the following graphics all out, they can not see.
The SWFObject Setnofill method is used to set the object not to fill, Setsolidfill to set the object to fill with a single color, or to specify the degree of transparency with Alpha. The Setlinearfill method is used to set the gradual linear transition of an object from one color to another, and the Setlinearfillcenter method is used to set the center point of the color linear transition. The Setradialfill method is used to set the object from one color to another to the gradual transition of radioactivity. The Setradialfillcenter method is used to set the center point of the color radiative transition. The process of turning the swfobject into a button is slightly more complicated because the button requires four graphics, representing the normal state of the button, the mouse across state, the state of the mouse drop and the state of the hint. The action to be fired when the button is pressed, and the action object needs to be added using the Queueevent method.
3. Swfaction Action Object
Currently, the Bukoo Flash Objects supports five actions: Stop the animation, play the animation, jump to a frame, navigate to the URL, and navigate to the URL for an HTML frame. As with SWFObject, swfaction objects can be created with Makeactionstop, Makeactionplay, Makeactiongotoframe, Makeactiongotourl, and MAKEACT The iongotourltarget becomes the corresponding action.
Four, ASP example
This ASP program (sample1.asp) dynamically creates Flash animations that contain a radioactive fill background, a right-to-left text, and three expanded circles, and the SWF file is written to the browser as a binary stream. Sample1.asp source code.
If you need to insert dynamically generated Flash animations into other pages, you can do so using the reference dispswf.asp.
Through COM technology, Bukoo Flash Objects built a bridge between VC + + SWF SDK and other programming languages or environments other than VC + +, making it easy to generate Flash animations using ASP, Delphi and other languages.
However, many bugs are included in the SWF SDK, and readers who download and use the SWF SDK need special attention, such as the ability to convert TrueType fonts to Flash fonts, the incorrect geometry transformation formulas for objects, and so on. These issues are discussed in the openswf.org and flashkit.com discussion groups. In the production of Bukoo Flash Objects, I have tried to change a number of similar defects and errors. It is inevitable that there are omissions, which will greatly affect the quality of Bukoo Flash Objects. With the official release of Flash 5, the SWF 5 SDK is expected to be launched soon, hopefully correcting bugs in it. By then, I will recompile the Bukoo Flash Objects with the new SDK.
The next version of the Bukoo Flash Objects program will increase support for Chinese, embedded animations (sprite), and for variants (morph).
Readers are welcome to make suggestions and criticisms on Bukoo Flash Objects.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service