You should be able to cast this as a strongly typed 'Person' object.

var object:Object = new Object();

object.name = "name";
object.address = "address";

person:Person = object as Person;

trace ( person.name ); //name
trace ( person.address ); //address

On Sat, May 8, 2010 at 9:18 PM, anagnost68 <[email protected]> wrote:

>
>
> I have a class defined called Person that has a name and address. If I have
> an Object with a name property and address property.
>
> var object:Object = new Object();
>
> object.name = "name";
> object.address = "address";
>
> I'd like to be able to do this:
>
> Person person = object as Person;
>
> But, it generates an error. Is there a way to convert the Object into a
> Person object without individually copying each property?
>
> Thanks
>
>  
>

Reply via email to