AS3:在已加载的swf中隐藏舞台以外的元素 [英] AS3: Hide elements outside the stage in loaded swf

查看:127
本文介绍了AS3:在已加载的swf中隐藏舞台以外的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Myapp加载一个外部swf并将其添加到MovieClip. 外部SWF影片具有放置在舞台外部的元素(在SWF播放期间它们会在舞台上).但是加载后,这些元素在主MovieClip中可见.

Myapp loads an external swf and adds it to MovieClip. External swf movie has elements that are placed outside the stage (they go on the stage during swf playing). But after loading that elements are visible in the main MovieClip.

换句话说,看起来舞台和舞台之外的整个空间都是可见的.

In other words, it looks like the whole space outside the stage is visible as well as the stage.

如何在已加载的swf阶段之外隐藏元素?

How to hide elements outside the stage of loaded swf?

推荐答案

Adob​​e对此页面进行了介绍,下面的代码示例向您展示了如何在运行时向加载的剪辑添加遮罩:

Adobe has a page about this, with the following code example showing you how to add a mask to the loaded clip at runtime:

import flash.display.*; 
import flash.net.URLRequest; 
var rect:Shape = new Shape(); 
rect.graphics.beginFill(0xFFFFFF); 
rect.graphics.drawRect(0, 0, 100, 100); 
addChild(rect); 
var ldr:Loader = new Loader(); 
ldr.mask = rect; 
var url:String = "http://www.unknown.example.com/content.swf"; 
var urlReq:URLRequest = new URLRequest(url); 
ldr.load(urlReq); 
addChild(ldr);

该页面的完整链接: http://help.adobe.com/zh_CN/ActionScript/3.0_ProgrammingAS3 /WS5b3ccc516d4fbf351e63e3d118a9b90204-7c83.html

Full link to the page: http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c83.html

这篇关于AS3:在已加载的swf中隐藏舞台以外的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆