Awesome, Thanks Darin,
Johnny On Sat, Jan 31, 2009 at 10:41 AM, Darin Kohles <[email protected]> wrote: > You can pass a reference to an item the way your code looks, but the > items is still a child (display child, if it was added as one) of the > original parent. If you want to swap 'ownership' of the thingy without > simply copying the naughty bits, you'll need to "pop" it off the view > stack and place it back on in it's new home. > > so: > > var tempHome:SomeClass = oldHome.removeChild(oldHome.someClassInstance); > > // parent-less at this point but as long as you have a handle on it still > alive > > newHome.addChild(tempHome); > > // re-inserted in the view stack in the new parent > > newHome.invalidateDisplayList(); > > //for good measure > > > If you don't really want to remove the thingy from the first location, > but "use" it elsewhere, then copy out the naughty bits and make a new > one: e.g.source url etc, otherwise make a deep copy - I suggest you > read up on the ObjectUtil static class in the live docs. (I'm too lazy > to pass a link :>) > > On Sat, Jan 31, 2009 at 10:05 AM, John Waggener <[email protected]> > wrote: > > Rules around a DisplayObjectContainer's addChild: > > > > I have a DisplayObjectContainer that has a property of a datatype that > has a > > property named prettyThing which is an Image > > > > myDisplayObjectContainer{ > > > > private var class:Class; > > private var url:String = "someImage.jpg"; > > > > public function createClass():void > > { > > class = new Class(); > > class.prettyThing = new Image(); > > class.prettyThing.load(); //load a url and such > > } > > > > public function addPrettyThing():void > > { > > addChild( class.prettyThing ); > > } > > > > } > > > > addPrettyThing will not take the Image that is a property of class and > > display it. What is the rule here? If prettyThing were a property of > > myDisplayObjectContainer then it coud be added to the dispplaylist and > > displayed? > > > > Does anyone know what the rule is? > > > > -- > > Johnny Waggener > > Software Developer > > Multicast Media > > 678-592-2650 > > > > > > -- > Darin Kohles > RIA Developer > > > ------------------------------------------------------------- > To unsubscribe from this list, simply email the list with unsubscribe in > the subject line > > For more info, see http://www.affug.com > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > List hosted by http://www.fusionlink.com > ------------------------------------------------------------- > > > -- Johnny Waggener Software Developer Multicast Media 678-592-2650
