I've seen a similar question asked on flex coders before, but it was
about 2006 so things may have moved on since then!

I'm trying to fool the runtime into thinking one object is of a
different type. The object is of type ObjectProxy so it can handle all
the calls to the object it is proxying, and I'm trying to use the Proxy
in place of the object it is proxying... Clear as mud?

 

Basically...

 

var obj : ObjectProxy = new ObjectProxy( new MyObject() );

var newObj : * = obj;

 

works because the newObj variable is untyped. This isn't acceptable for
a whole host of reasons (the loudest one appears to be that code hinting
stops working at that point).

 

var obj : ObjectProxy = new ObjectProxy( new MyObject() );

var newObj : MyObject = obj;

 

throws a Type Coercion error as it cannot convert the Proxy to the
strong type.

 

Is there any way of fooling the runtime into thinking the type of the
ObjectProxy is actually that of MyObject?

Am I actually going mad, and trying to do something foolhardy and
impossible?

 

Gk.

Gregor Kiddie
Senior Developer
INPS

Tel:       01382 564343

Registered address: The Bread Factory, 1a Broughton Street, London SW8
3QJ

Registered Number: 1788577

Registered in the UK

Visit our Internet Web site at www.inps.co.uk
<blocked::http://www.inps.co.uk/> 

The information in this internet email is confidential and is intended
solely for the addressee. Access, copying or re-use of information in it
by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
INPS or any of its affiliates. If you are not the intended recipient
please contact [email protected]

 

Reply via email to