How to correctly use the new features of Flash Player and knowledge about flash develop Editor

Source: Internet
Author: User

Adobe adds new features to each new version of Flash Player. To use these functions, You need to compile your SWF file correctly. Unfortunately, it may be tricky to set up your compiling environment and pass the correct options to the compiler. This article aims to clear these troubles for you so that you can use the latest Flash Player function.


This article does not involve the vast integrated development environment (IDE) of flash. On the contrary, they all use a tool hidden behind the scenes: Flex SDK. In particular, use the mxmlc command line to generate SWF, And the compc command line to generate SWC. The basic method is ignored!



 

Mxmlc MyApp.


If you say you want to use a new feature like stage3d. You can read this API document first, and then write some code and recompile the above command. Unexpectedly, you see the following error:
 

/Path/to/MyApp. As (8): Col: 10 error: Access of possibly undefined property stage3ds through a reference with static type flash. display: stage.

Stage. stage3ds [0]. requestcontext3d ("Auto", "baseline ");

Wait! Why is the compiler unaware of stage3d? Has Flash Player been released for a year? I still haven't downloaded the latest flex SDK from the Adobe official website? No, you have downloaded and installed it, but the compiler still needs some settings to know about this new version of Flash Player. You need to add an option to the command line to tell the Compiler which version of Flash Player it is compiling.

Mxmlc MyApp. As-target-player = 11.4.0


Now you find another error during compilation:

 

/Path/to/flex_sdk/frameworks/flex-config.xml (56): Error: Unable to open 'libs/player/11.4/playerglobal. swc'

</External-library-path>

[My error message is: Unable to open 'libs/player/10.1/playerglobal. swc' alas, I also read this article for a long time and I am always prompted for errors. I have downloaded the package for 10.0, 10.3, and 11.7, and the results are still prompted for errors, finally, I suddenly found that the folder named 10.0 under my player was speechless to myself. I immediately created a 10.1 folder and put a 10.1 SWC in, CTRL + enter
, OK, haha]
This error seems to have a vague meaning, but it reflects what happened to the command line option. As you can see, all problems occur when you want to specify the-target-player option, which means that you tell the compiler to link to a specific SWC that contains the Flash Player API. This API changes with the release of each new version of Flash Player. These changes usually add new classes, methods, and parameters. The above error indicates that the compiler does not find this SWC (playerglobal. SWC. So you need to download playerglobal. SWC of Flash player11.4, and put it here:

/Path/to/flex_sdks/frameworks/libs/player/11.4


In the future, you want to create directories that do not exist. For future readers, you can create either "11.4", "11.5", or any version of Adobe. Let's look at my small example:

Package
{
Import flash. display. Sprite;
Public class MyApp extends Sprite
{
Public Function MyApp ()
{
Stage. stage3ds [0]. requestcontext3d ("Auto ");
}
}
}


The above Code uses the most basic method in stage3d. When I put it in Flash player11.4 for compilation, I got this uncaptured exception:

Referenceerror: Error #1069: Property stage3ds not found on flash. display. stage and there is no default value.
At MyApp ()


Why? We didn't specify the correct Flash Player version? Yes, but this is only partly because-target-player-only effect is the playerglobal. SWC of the specified link. The fact is that each SWF has an internal version number, which determines which Flash Player API you use at runtime. So we need to set another item and compile it again.

Mxmlc MyApp. As-target-player = 11.4.0-SWF-version = 17


17 seems to be a strange version because the Flash Player version is only 11.4, but this integer corresponds to the release of each small version of Flash Player. The following table lists the released SWF and Flash Player versions:


(The original post is not an image. I found that I could not upload a local image, nor could I upload an attachment. I did not respond when I clicked the Browse button for 10 thousand times. Go to the original post and check it out. Thank you ~)


Your code can finally be compiled normally.

Let's recall that the following three steps are required to link to the correct Flash Player version:


1. Download and import the correct version, playerglobal. SWC

2. Specify the correct Player version to mxmlc or compc.

3. Specify the correct SWF version to mxmlc or compc.

Remember that once you set a specific Flash Player version based on the above, users of previous versions of player cannot play your SWF, when Javascript is detected, the user is prompted to update the version on the webpage. Of course, users of the latest Flash Player can still use SWF.


Address: http://hi.baidu.com/joomecow/item/389ca300a77e59046d90485f

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.