AS3: finding an object by it Instance name in a dy

2019-08-29 14:22发布

I am doing an Adobe AIR Kiosk app but I am having a little problem.

First step is to generate a webcam container:

var bandwidth:int = 0; 
var quality:int = 100;
var camera:Camera = Camera.getCamera();
camera.setQuality(bandwidth, quality);
camera.setMode(885,575,30,true);
var video:Video = new Video(885,575);
video.attachCamera(camera);
video.name = "camara";
webcam.addChild(video);

It works ok, the problem is that I want to apply to it a custom filter

It works ok if I write it this way:

MovieClip(parent).contenedor_postal.postal.webcam.filters = [filter];

But I want to affect only the child inside the clip "webcam" without affecting other MC's, so I write it like this:

MovieClip(parent).contenedor_postal.postal.webcam.camara.filters = [filter];

and does not work. I used to program in AS2, so maybe the trick is very simple but I can't find anything that works. Thanks in advance!

1条回答
倾城 Initia
2楼-- · 2019-08-29 14:36

If the video has a name property "camara" then this should work:

MovieClip(parent).contenedor_postal.postal.webcam.getChildByName("camara").filters = [filter];
查看更多
登录 后发表回答