Hi again,

It seems that it does work but only the first time DofCache.usedof is
set. If I I try to change its value and recreate my scene, it still
keeps the old  value (when it was initialized). Here is my code :

I made the following method :

        private function initObjects(usedof:Boolean):void
                {

                        DofCache.aperture=_Aperture;
                        DofCache.usedof=usedof;
                        DofCache.maxblur=_Maxblur;
                        DofCache.focus = _Focus;

                        _DofSprite2D_1 = new Mesh();
                        _DofSprite2D_1.addSprite(new 
DepthOfFieldSprite(_Material1));
                        _DofSprite2D_1.x=100;
                        _DofSprite2D_1.y=100;

                        _DofSprite2D_2 = new Mesh();
                        _DofSprite2D_2.addSprite(new 
DepthOfFieldSprite(_Material2));
                        _DofSprite2D_2.x=300;
                        _DofSprite2D_2.y=150;
                        _DofSprite2D_2.z=100;


                        _DofSprite2D_1.ownCanvas=true;
                        _DofSprite2D_1.blendMode=BlendMode.DARKEN;

                        _DofSprite2D_2.ownCanvas=true;
                        _DofSprite2D_2.blendMode=BlendMode.DARKEN;


                        _Container=new ObjectContainer3D(_DofSprite2D_1, 
_DofSprite2D_2);

                        _View.scene.addChild(_Container);

                }


ThenI have the following callback function that is called when the
user clicks on a tick box (it allows to show the effect of dof) :

public function onCheckBoxStateChange(ThisCheckBox:CheckBox):void
                {

                        _Container.removeChild(_DofSprite2D_1);
                        _Container.removeChild(_DofSprite2D_2);

                        _View.scene.removeChild(_Container);

                        if (ThisCheckBox.getState() == false)
                        {
                                initObjects(false);
                        }
                        else
                        {
                                initObjects(true);
                        }
                }

Calling initObjects(false) or initObjects(true) has no effect.

Any idea to change the value of usedof after initialization ?

Sylvain

On 25 oct, 16:39, Sylvain Godbert <[email protected]> wrote:
> Hi,
>
> I am converting Away3.5 code to Away3.6. I have a problem with the
> following :
>
> DofCache.aperture=_Aperture;
> DofCache.usedof=usedof;
> DofCache.maxblur=_Maxblur;
> DofCache.focus=_Focus;
>
> _DofSprite2D_1 = new Mesh();
> _DofSprite2D_1.addSprite(new DepthOfFieldSprite(_Material1));
> ...
>
> If I set DofCache.usedof=false, I get nothing, while in Away3.5 it
> used to disable the dof effect.
>
> Is there a way to enable/disable dof in Away3.6 with
> DepthOfFieldSprite object?
>
> Sylvain

Reply via email to