The right-click menu of Loader does not respond.

Source: Internet
Author: User

 

Code

 1 package
2 {
3 Import com. Zs. components. abstracthumanfactory;
4 Import com. Zs. components. personfactory;
5
6 Import Fl. Controls. Button;
7 Import Fl. Controls. ComboBox;
8 Import Fl. Controls. scrollbar;
9
10 Import flash. display. loader;
11 import flash. display. loaderinfo;
12 Import flash. display. Sprite;
13 Import flash. display. stagealign;
14 Import flash. display. stagequality;
15 Import flash. display. stagescalemode;
16 Import flash. Events. contextmenuevent;
17 import flash. Events. event;
18 Import flash. Events. keyboardevent;
19 Import flash.net. URLRequest;
20 Import flash. UI. contextmenu;
21 import flash. UI. contextmenuitem;
22
23 public class factorymethod extends Sprite
24 {
25 private var Loader: loader;
26
27 public function factorymethod ()
28 {
29 stage. scalemode = stagescalemode. no_scale;
30 stage. Quality = stagequality. High;
31 stage. align = stagealign. top_left;
32
33 var Loader: loader = new loader ();
34
35 loader. Load (New URLRequest ("http://showpic.51.com/CBME_Resource/51/20080514/other/200805141130322.swf "));
36
37 loader. contentloaderinfo. addeventlistener (event. Complete, oncomplete );
38
39}
40
41 private function oncomplete (E: Event): void
42 {
43 var Loader: loader = (e.tar get as loaderinfo). loader;
44
45 var Item1: contextmenuitem = new contextmenuitem ("move up a layer ");
46 item1.addeventlistener (contextmenuevent. menu_item_select, moveup );
47 var item2: contextmenuitem = new contextmenuitem ("move down a layer ");
48 item2.addeventlistener (contextmenuevent. menu_item_select, movedown );
49 var item3: contextmenuitem = new contextmenuitem ("delete scenario", true );
50 item3.addeventlistener (contextmenuevent. menu_item_select, removesence );
51 var menu: contextmenu = new contextmenu ();
52 menu. customitems = [Item1, item2, item3];
53 menu. hidebuiltinitems ();
54 loader. contextmenu = menu;
55 addchild (loader );
56}
57
58
59 private function moveup (E: contextmenuevent): void
60 {
61 trace ("-- move one layer up --");
62
63}
64
65 private function movedown (E: contextmenuevent): void
66 {
67 trace ("-- move down one layer --");
68
69}
70
71 private function removesence (E: contextmenuevent): void
72 {
73 trace ("-- delete --");
74}
75
76
77}
78}
79
80

 

For example, the question is to add a right-click menu to the SWF material that loader comes in. The strange thing is that the right-click menu can be displayed, but the commands in it rarely respond. (The materials used for testing are avm1. I don't know if this is the impact)

 

Solution:

1. Add a transparent layer to the SWF from the loader, and register the right-click on the transparent layer.

2. Place the SWF in the container and add mousechildren = false to the SWF;

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.