Tools and introduction for generating dynamic flash using ASP

Source: Internet
Author: User

Editor's note: the development of programming technology is changing with each passing day. It seems that dynamic HTML web pages generated using ASP and other programs are no longer the latest technology. Since the launch of Macromedia's Flash technology, there have been 0.2 billion million users, making flash websites popular. 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, and Visual Basic. This article describes in detail how to use Bukoo Flash Objects to implement Flash webpage interaction applications, which is of great practical value. It is worth a list of new programmers.

I. Overview

I applied the ATL in Microsoft Visual C ++ to encapsulate the advanced classes in the SWF SDK into COM Objects, so that more programming languages that support COM Automation can generate Flash animation. These COM Objects are named Bukoo Flash Objects. This document does not describe the development method and process of Bukoo Flash Objects, but describes how to use it.

Ii. 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. After decompression, the Bukoo Flash Objects is stored in swfobjs. dll, use regsvr32 swfobjs. install Bukoo Flash Objects using dll; Use Regsvr32/Uswfobjs. dll to remove Bukoo Flash Objects.

3. Basic objects and their attributes

Bukoo Flash Objects consists of three COM Objects: SwfMovie, SwfObject, and SwfAction.

The Flash Animation Generation Process by creating these three objects is: Creating SwfMovie animation objects; setting animation attributes; creating, inserting, and deleting SwfObject element objects and SwfAction action objects in frames; finally, the Flash animation is output. The following describes the three object application methods.

1. SwfMovie animation object

The SwfMovie object represents the Flash animation to be generated. You must first set the animation size. The SetSize method of the SwfMovie object is used to set the animation size. Note that the coordinate unit in Swf is twip, that is, 1/1440 inch, or 1/20 pixels. For example, the animation size is 400x300 pixels, that is, 8000x6000 twip. It must be called as follows: setsize (8000,600 0 ).

SetFrameRate (12) means that the animation is placed at 12 frames per second, the frame speed per second is high, and the animation is smooth. However, the Swf file will become larger, which affects the download speed. Therefore, you need to weigh the advantages and disadvantages. Use the GotoFrame method to locate the specified frame and insert an element or action. The SwfMovie object automatically increases the number of frames to the maximum number of frames called the GotoFrame method.

The insert and delete methods for elements are AddObject and RemoveObject. The insert action is AddAction.

The WriteMovie method is to generate a sWF File Based on the specified file name. The Content attribute of SwfMovie is of the VARIANT type. You can also use response. binarywite in AsP to output it to the webpage.

2. SwfObject Element Object

SwfObject is like a thousand faces. After creating this object, you can use its MakePolygon method to convert it into a polygon; Use the MakeRectangle method to convert it into a rectangle; Use the MakeOval method to convert it into an oval shape; use the MakePitcure method to convert a Jpeg image, use the MakeButton method to convert a button, use the Makesound method to change a sound, use the MakeFont method to convert a font, and use the MakeText method to convert a text image. The text processing in sWF is special. You must first convert the TrueType font into a font object and then generate the text with the font object.

SwfObject's Translate method is used to Translate elements, coordinate twip positioning; Rotate method is used to Rotate elements; scale is used to zoom elements. Note that the unit of parameters for the rotation and scaling methods is also special, called Fixed. A simple conversion method is multiplied by 65536. For example, if the rotation is 10 degrees, a value of 10 × 65536 must be used to zoom in twice, 2 × 65536 is required, and so on. The setLineWidth method of SwfObject is used to set the width of the border line of the object, in twip. The setLineColorA method is used to set the color of the border line of the object. It has four parameters, which represent red, green, blue, and Alpha. The Alpha parameter specifies the transparency of the color. Alpha = 255 is not transparent, and the image below is completely covered; Alpha = 0 is completely transparent, so that all the following images are completely transparent and invisible to you.

The setNoFill method of SwfObject is used to set that the object is not filled. setsolidFill is used to set that the object is filled with a monochrome color, and alpha can also be used to specify the transparency level. The setLinearFill method is used to set the gradual linear transition from one color to another. The setLinearFillCenter method is used to set the center point of Linear color transition. The setRadialFill method is used to set the gradual transition from one color to another. The setRadialFillCenter method is used to set the center point of the color radioactive transition. The process of converting SwfObject into a button is a little complicated, because the button requires four graphics, representing the common status of the button, the mouse over the status, the mouse Drop status and the prompt status. The action to be triggered after the button is pressed. You must use the QueueEvent method to add the action object.

3. SwfAction action object

Currently, Bukoo Flash Objects supports five actions: Stop an animation, play an animation, jump to a frame, navigate to a URL, and navigate an html frame to a URL. Like SwfObject, after a SwfAction object is created, you can use MakeActionstop, MakeActionPlay, MakeActionGotoFrame, MakeActionGotoURL, and MakeActionGotoURLTarget to convert it into the corresponding action.

Iv. ASP example

This ASP program (sample1.asp) will dynamically create Flash animation, including radioactive filling background, a text moving from right to left, and three expanded circles, the Swf file is written to the browser as a binary stream. Sample1.asp source code.

If you want to insert a dynamically generated Flash animation into other web pages, you can use dispswf. asp for reference.

The URLs used in combination with ASP are:

Http: // localhost/swf/dispswf. asp? Swf_url = sample1.asp & width = 300 & height = 50

V. Further Discussion

Through the COM technology, Bukoo Flash Objects builds a bridge between the swf sdk of VC ++ and other programming languages or environments other than VC ++, this allows you to easily generate Flash animations using ASP, Delphi, and other languages.

However, the swf sdk contains many errors (bugs). You need to pay special attention to downloading and using the swf sdk. For example, the TrueType font is not converted to the Flash font, And the geometric transformation formula of the object is incorrect. These issues have been discussed in the discussion groups of openswf.org and flashkit.com. When I made Bukoo Flash Objects, I tried to modify a batch of similar defects and errors. It is estimated that there are still omissions, which will greatly affect the quality of Bukoo Flash Objects. With the official release of Flash 5, it is expected that the SWF 5 SDK will be released soon, hoping that it can correct the bug. At that time, I will re-compile Bukoo Flash Objects with the new SDK.

The next version of Bukoo Flash Objects will support Chinese characters, embedded animations and variants.

Readers are welcome to make suggestions and criticisms on Bukoo Flash Objects.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.