Hmm, I think the problem lies in how director treats sprites... Dot syntax is great for referenceing known things... not so great for referencing variable things...Hence the reason array syntax is so nice. Unfortunately, array syntax in director only seems to work on proper 'objects' like behaviors, or parentscripts, etc...

For example, if I put a behavior on some graphic in frame 1, with a property pSomething with a value of test, this works perfectly...
put sprite(1).scriptInstanceList[1][#pSomething]
--"test"


Works great with behaviors, and any other type of script. Problem is that Sprites are not instances of scripts... so apparently their properties are hidden from [] access.

You can get around this by putting a generic function on every sprite that is the only way you access the sprite's properties. Basically it becomes a 'wrapper' for the sprite, and if you want to change the properties, you use your own functions to do so. Then you can keep track of any sprite's properties and can set them dynamically, as long as you use your 'wrapper' functions. It could be a pain, depending on the number of sprites, and existing reworking of code that directly addresses sprite properties, but at least it will give you complete access to the sprite.

I don't belive this is the case in Flash cause movieClips are Object instances themselves, indeed the whole swf is an instance of a movieClip Object.

So, I think the short of it is you can either use a proper object to access sprite properties, or you can use something like do() or value() to set/get properties dynamically.

What would be COOL is if all these properties existed in a list somewhere... then you could get a reference to the sprite's 'propertylist' and you could change properties mucho easalio.

~Mathew

roymeo wrote:
That's my question, Mathew.

Is there a way to access the sprite properties WITHOUT creating a LookUpTable/Case Statement which addresses each and every one, in the same way that you can with Script-Instance properties, or even Member properties.

x = #fontsize
put sprite(21).member.getProp(x)

works fine.

The other way I'm trying to avoid would be for the accessor to utilize a do statement.


So, I guess my answer is "No, you haven't forgotten some simple, basic way to access the sprite-object properties that you can access with .getProp() on almost every other object in Director 9, roymeo."


roymeo-cranky-pants



[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]

Reply via email to