|
It sounds like you don't have a correct understanding of
object references. A lot of different variables can contain references to (or
"point" to) the same object instance. A Container instance has a
reference to an EdgeMetrics instance. When you execute var v:EdgeMetrics =
super.viewMetrics; your local variable v now contains a
reference to the SAME EdgeMetrics instance that the Container is using; v and
some var in the Container instance are "sharing" the same object. When
you then assign v.left =
... you are modifying the shared
EdgeMetrics instance. Here''s a simple example of this using
Arrays: var a1:Array = [
"foo" ]; var a2 = a1; a2[0] =
"bar"; trace(a1[0]); //
traces "bar", not "foo", because a1 and a2 are two
references to the same Array object In AS3 as in most languages, Arrays,
Objects, and all subclasses of them are passed and returned "by
reference", not "by value", because they are potentially large
and it is much more efficient to pass just a 4-byte address of an object in
memory rather than copying all the data inside the object. If you need your own
copy, you have to make a copy. That's what a method like clone() is for. We
could have implemented the viewMetrics property to make a copy, but we chose
not to for performance reasons. The documentation probably isn't always clear
about whether an API returns a copy or a reference to the original object. - Gordon From: > you shouldn't be
modifying it. On 5/18/06, Gordon
Smith <[EMAIL PROTECTED]>
wrote: I don't think we changed anything... properties that return an
Yahoo! Groups Links
SPONSORED
LINKS
YAHOO!
GROUPS LINKS
|
- RE: [flexcoders] Flex2B3 :: viewMtrics - borderMetrics ::... Gordon Smith
- Re: [flexcoders] Flex2B3 :: viewMtrics - borderMetri... Manish Jethani
- Re: [flexcoders] Flex2B3 :: viewMtrics - borderM... Michael Schmalle
- Re: [flexcoders] Flex2B3 :: viewMtrics - bor... Michael Schmalle

