Some "unknown" techniques in ActionScript

Source: Internet
Author: User
The trick is to use this article to specifically collect some of the techniques or problems that are not known or uncommon in ActionScript. Hope to help you!
This article will also be updated and amended.
1. Textformat.url
Many people know how to use Textfield.htmltext to write hypertext, but few people seem to know that we can actually use Textformat.url to define it.

1:myformat = new TextFormat ();
2:myformat.url = " http://www.zhitiao.com";
3:my_txt.html = true; It's a must.
4:my_txt.htmltext = "A piece of note studio";
5:my_txt.settextformat (MyFormat);

2. Using JavaScript methods
The browser workaround for the usual trace method can be used

1:function Debug (Info) {
2:geturl ("Javascript:alert (' + info + ')");
3:}
If you use hypertext links, you can use the

My_txt.html = true;
My_txt.htmltext = "<a Href=javascript:alert" Welcome to a note studio! ') > A note Studio </a> ";

3. Copy array
If the following method of replicating an array is only a point, it does not form a true copy.
[Copy] [Run] [Save]
1:b_array = A_array;
2://When the A_array array content changes, the content of B_array changes
3://solution can use the following method
4:b_array = A_array.slice ();

4. Uninstall the MC that is dragged into the stage
We know that only dynamically created MC can be uninstalled using the Removemovieclip () method, and the instructions for the Removemovieclip method in Help are as follows:
Quote
Delete with Duplicatemovieclip (), Movieclip.duplicatemovieclip () or
Movieclip.attachmovie () Creates a movie clip instance.
The following tips allow us to uninstall the MC you need, even if you drag the component into the stage.

1:my_mc.swapdepths (100)//The value of the MC's depth is set to greater than 0
2:my_mc.removemovieclip ();//So you can uninstall the MC properly
is not very useful oh.
PS: Use My_mc.unloadmovie () to remove the MC instance, but the instance properties and the clip processing function are preserved. You can delete an instance (including its properties and clip-processing functions) with Removemovieclip ().

5. Mana Depth Value –16384

We know that the elements in flash use the concept of depth, all the elements in the creation begin with-16383, so if we want to have an element displayed at the bottom, we can set the depth to the mana depth value.
The reason why we may delve into the following:
The following values are defined in the original Macromedia ' s Mx.managers.DepthManager class:
[Copy] [Run] [Save]
1://Highest allowed depth is reserved for ToolTips and cursors
2:static var reserveddepth:number = 1048575;
3://Highest depth for all other objects
4:static var highestdepth:number = 1048574;
5://lowest allowed depth
6:static var lowestdepth:number =-16383;
7://Lowest depth plus this number of layers is reserved
8://For statically placed content
9:static var numberofauthortimelayers:number = 383;

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.