开发者

AS3: Hide elements outside the stage in loaded swf

开发者 https://www.devze.com 2023-02-26 02:59 出处:网络
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 th

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.

How to hide elements outside the stage of loaded swf?


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);

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号