views:

308

answers:

2

Hi,

I want to display a Collada model over top of a video stream and dynamically adjust its alpha value. Right now I have it partially working in PaperVision but I can't seem to set the alpha of the model at all. I have tried a few things from google. For non-Collada models the following works fine:

var layer:ViewportLayer = viewport.getChildLayer(myModel, true);
layer.alpha = 0.5;

All the Collada models I have tried have UVW mapped textures. In the end I am hoping to have the model alpha adjust continuously based on some external events. I have googled extensively and had little luck.

Any help would be appreciated!

UPDATE / RESOLVED

So as indicated below, all I needed to do was find the appropriate child and manipulate it directly. My code now looks similar to:

currentModel = new DAE(true, "Model");
currentModel.load("./model/Model.dae");
baseNode.addChild(currentModel);
currentModel.addEventListener(FileLoadEvent.LOAD_COMPLETE, function():void {
    // Assume first child is what we want
    for (var key:String in currentModel.children) {
        currentModelContainer = currentModel.getChildByName(key)
        currentModelContainer.useOwnContainer = true;
        currentModelContainer.alpha = 0.0;
        break;
    }
});

Now, later on all I do is use Tweener to adjust the alpha attribute of currentModelContainer.

Cheers for the help! Hopefully this helps someone else in the future.

+1  A: 

One way is by placing the models childnodes inside their own containers.

var target:DisplayObject3D = model.getChildByName("someNode", true);
target.useOwnContainer = true;
target.alpha = 0.5;
Marco
Cheers man, turns out there was one child node and it responded as the documentation indicated. It's just the top level DAE model that was ignoring the useOwnContainer and alpha parameter adjustment.
Jotham
A: 

thank you very much ! very helpfull

Przemek