You can change the content of the object, but you cannot change its address.

var o : Object = new Object();
o.name = "rich";
trace( o.name ); //rich
test( o );
trace( o.name ); //ralf

function test( param : Object )
{
    trace( param.name ); //rich

    //this changes the original object
    param.name = "ralf";
    trace( param.name ); //ralf

    //this creates a new object
    //and assigns it to the local reference param
    //when the method is finished, it will be removed by the
    //garbage collector because there are no external references to it
    param = new Object();
    param.name = "mary";
    trace( param.name ); //mary
}


Cheers
Ralf

Reply via email to