View Full Version : goal of root and dictionaryes
Aquilonian
June 16th, 2007, 03:03 PM
If to use root the same way we used to use _root we have to cast it to mc or sprite, it seems that it was not designed to be used that way
SO, how root was suposed to be used?I mean, what that for?
And what dictionaryes are for?
Tnkz
sasxa
June 16th, 2007, 05:36 PM
I'm guessing root is there to help you in situations like object.parent.parent.parent.parent.parent (:
and Dictionaries are used for referencing objects. I use them often to assign some value to the object that would be otherwise impossible (or inconvenient)... for example, I load object and want to assign XML object with settings to it. since you can't add properties to Loader class (not dynamic), you'd have to make new class that extends Loader, define new property, getter/setter and what not (: or I want to add an array of rgb values for my Bitmap for some color transform effects. same thing - make new class, define..........
but with Dictionary I can avoid all that and use:
var extra:Dictionary = new Dictionary();
//...
extra[loader] = new XML();
extra[loader.content] = new Array(rValue, gValue, bValue);
Aquilonian
June 16th, 2007, 06:35 PM
So, dictionaryes are some kind of storage for dynamic data of non dynamic objects?
Inst easyer to use another dynamic object for that?
And for root...i think i didnt make myself clear... parent parent parent, rigth, but whats that for since i still need to cast it to acess another sprite inside parent?So i assume its not to acess another sprites, so its there for what?
Tnkz
dthought
June 18th, 2007, 08:21 AM
ries! ries, not ryes ;)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.