Graphic tutorial on Flash CS3 component development

Source: Internet
Author: User

  1. [Tutorial description]: In response to the requirements of Yunkai and other friends, I will organize the component development process today and write it into this tutorial. Through this tutorial, you can get a general idea of the entire Flash component development process and hope to help those who want to develop their own Flash components. I am mainly developing Flash code components and other Flash components this time. You can study them or discuss them with me.
    [Prerequisites ]:
    1. Flash CS3 software is installed;
    2. the Adobe Extension Manager 1.8 Extension Manager is installed. If not, download it here: http://www.adobe.com/cn/exchange/em_download/ first;
    [Development tutorial ]:
    1. First, prepare a png Image of 18x18 for the Flash component icon. (I will provide a png Image in the following package file)
    2. Write a StringUtilComponent component class. None of my components inherit the system component class (UIComponent), but directly inherit the Sprite class.Copy codeThe Code is as follows: package com. klstudio. components {
    Import flash. display .*;

    Import com. klstudio. util. StringUtil;

    // Namespace;
    Use namespace klstudio_internal;

    // Set the component icon;
    [IconFile ("StringUtilIcon.png")]

    Public class StringUtilComponent extends Sprite {
    // Define the widget display box;
    // The existing display elements in the component must start with the namespace;
    Klstudio_internal var boundingBox_mc: MovieClip;
    // Define the LRC parser;
    Private var util: StringUtil;
    Public function StringUtilComponent (){
    // Remove the component display box;
    BoundingBox_mc.visible = false;
    AddChild (boundingBox_mc );
    BoundingBox_mc = null;
    }
    }
    }

    This uses the StringUtil class used by components. I have provided the "[AS3] StringUtil class ". Note that the display elements contained in the component must use the namespace as the prefix (that is, the above "use namespace klstudio_internal;" Code). The namespace defines variables. If no element is added, you cannot directly operate the boundingBox_mc display element (this is different from the original Flash component development, which can be used directly). Otherwise, an error will be reported during compilation.
    3. Create a StringUtil. fla File. Select "Flash File (ActionScript3)" as the type )".
    4. Create a MovieClip element named "StringUtil", and set the Class path as shown in.

    5. Create a New MovieClip element named "boundingBox_mc" for the component display box.

    6. Place boundingBox_mc in the MovieClip element named "StringUtil" and set the name to "boundingBox_mc" as shown in the following figure ".

    7. Next, define the component and set the Class path, prompt information, and other options. Click the component icon and select the png image.


    8. If the icon cannot be shown in the following figure, click "Confirm" in step 1.

    9. Then, package the StringUtil component into a SWC file (actually a zip compressed file format ).

    10. Even if the component is successfully completed in step 1, you can package the swc file into an mxp file if you want to publish it to others. before packaging, configure StringUtil. mxi file (this file is in xml format) with the following content:Copy codeThe Code is as follows: <macromedia-extension

  2. Name = "StringUtil"
  3. Version = "1.0"
  4. Type = "Flash component"> <! -- Describe the author -->
  5. <Author name = "Kinglong"/>
  6. <! -- List the required/compatible products -->
  7. <Products>
  8. <Product name = "Flash" version = "9" primary = "true"/>
  9. </Products>
  10. <! -- Describe the extension -->
  11. <Description>
  12. <! [CDATA [
  13. StringUtil class <br>
  14. For the String tool class.
  15. ]>
  16. </Description>
  17. <! -- Describe where the extension shows in the UI of the product -->
  18. <Ui-access>
  19. <! [CDATA [
  20. This StringUtil Component is accessed by choosing Window> Components> StringUtil.
  21. ]>
  22. </Ui-access>
  23. <! -- Describe the files that comprise the extension -->
  24. <Files>
  25. <File name = "StringUtil. swc" destination = "$ flash/Components"/>
  26. </Files>
  27. </Macromedia-extension>
    Mxi_file_format1 _
    11. If you have installed the Adobe Extension Manager 1.8 Extension Manager, you can double-click the StringUtil. mxi file to generate the StringUtil. mxp file. Alternatively, open Adobe Extension Manager 1.8 Extension Manager and select "file"-"package Extension... ", select StringUtil. mxi file, and then generate StringUtil. mxp is ready. Here you will be welcomed, and your Flash CS3 component will be developed!

    [Package download] http://www.klstudio.com/download/stringutil.rar

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.