Flash CS3 Component Development Graphic Tutorial _flash as

Source: Internet
Author: User
Tags cdata
  1. "Tutorial description": At the request of friends such as Yunkai, I am going to organize the component development process today and write this tutorial. With this tutorial you can get a general idea of the overall development of the Flash component and hope to help friends who want to develop flash components themselves. This time I mainly develop flash code components, and even other flash components, you can study or discuss with me.
    "Prerequisites":
    1, the installation of Flash CS3 software;
    2, installed Adobe Extension Manager 1.8 Extension Manager, if not please download here first: http://www.adobe.com/cn/exchange/em_download/;
    "Development Tutorial":
    1, first prepare a 18x18 png picture, used to make the Flash component icon. (I will provide a PNG picture in the following package file)
    2, write a Stringutilcomponent component class, my component does not inherit system component Class (UIComponent), but directly inherit sprite class.
    Copy Code code as follows:

    Package Com.klstudio.components {
    Import flash.display.*;

    Import Com.klstudio.util.StringUtil;

    namespaces;
    Use namespace klstudio_internal;

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

    public class Stringutilcomponent extends sprite{
    Define the component display box;
    The existing display elements in the component must begin with a 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 stringutil class used by the component, which I have previously provided "[As3]stringutil class". Notice here that the display elements contained within the component must be prefixed with namespaces (that is, "use namespace klstudio_internal;"). Code), define the variables in the namespace below. If you do not add, you can not directly to the BOUNDINGBOX_MC display element operations (this point and the original Flash component development of different places, the original can be used directly), otherwise compile will be an error.
    3, the establishment of a STRINGUTIL.FLA file, the type of course is the choice of "Flash file (ACTIONSCRIPT3)."
    4, establish a MOVIECLIP element, named "Stringutil", and then set the class path as shown in the following figure.

    5, to create a new MovieClip element, named "BOUNDINGBOX_MC", used to do the component display box.

    6, and then put the BOUNDINGBOX_MC in the name of "Stringutil" movieclip elements, and as shown in the following figure will be the name has been set to "BOUNDINGBOX_MC."

    7, the next start to define components, set class CLASSPATH, hint information and other options. Then click on the component icon to select the PNG image before.


    8, if the icon can not be as shown in the following picture, please confirm it by the 4th step.

    9, and then is to package this stringutil component into a SWC file (in fact, is a zip compressed file format).

    10, to the 9th step if the component is successful, but to be published to others, you can pack the SWC file into a MXP file, and packaging before the first to configure the Stringutil.mxi file (this file is the XML file format), the contents are as follows:
    Copy Code code 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. About 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 are 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> &NBSP
    Official provides information about the Mxi file format: mxi_file_format.pdf
        11, if you have already installed Adobe Extension Manager 1.8 Extension Manager, you can simply double-click the Stringutil.mxi file to generate the Stringutil.mxp file. Or you first open Adobe Extension Manager 1.8 Extension Manager Select File  -"package expansion ...", Select the Stringutil.mxi file, and then generate the STRINGUTIL.MXP, you will be here to congratulate you, your flash CS3 components on the development of the completed!

    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.