anybody knows if it is possible to accomplish
the following task in actionscript?
[1] create a movieClip [name: circle
[2] create a couple of instances with actionscript on the stage
[3] change the tint of MC circle with actionscript
[4] all instances should inherit the new tint of parent MC circle
...do i need to create a new component?
...any ideas/help appreciated
hi, thank you!
really nice approach but i was thinking of a solution
which is more elegant, using 'Object.registerClass' or
something similar... is it possible this way or am i
trying to accomplish something impossible and the best
solution is the one you suggested?
regards,
deeno
well tint isnt aquired through a property, its given through a method of a Color object. Because of that, you would have to call that method on every instance of that clip to have each obtain the new desired color.
Setting up your own class and handling it through that is doable. Here is an example.
question1: do i need to define a circles class for each of the 3 circles (as i did) or is there a way around that?
No, not really, but you would want seperate ASBroadcaster initialized objects for each group. You could then pas in which broadcasting object is used for each instance in the constructor (or call a method to assign it - or use the init object since you are attching clips to be associated with cirlces
question2: is it possible to control the transparency of each circle as well? how am i gonna add a new property for the transparency?
Yeah, set up in the same manner. Properties you wouldnt have to setup like this are properties which are initially handled by a prototype value to start - these like useHandCursor and... umm cant think of any others right now
question3: see line number 156 in frame 1
because 'this' there refers to your button object, not the scope where your cirlces exist. For that youd want to use _root[item]. Or as I sometimes do, since that might not always be _root, timeline[item] where, at the top of the script (not in any functions) timeline is set to ... well the timeline : timeline = this; Then in that function timeline will reference that timeline whether its _root or not
question4: is there any good tutorial or book about classes, objects, inheritance?
ASDG is pretty much the best book to get (so I hear). Robins online Flash 5 OOP documentation is really good... but, again, its Flash 5 and a lot doesnt apply to MX. Also, search the boards. A lot has been asked about it. You'll find links and whatnot. Alternatively, you can always ask Im currently working on an intro to MX OOP but its pretty basic - for the non programmers so I dont know how much of a help it would be. To be honest Im kind of stuck with it because its hard to know just what to expect other people to know and be able to understand. we'll see
... when you start getting into more properties like this, it might be easier to use just a function call rather than setting up getter/setter properties. Already its starting to get a little bulky up there with that setup.
as for sergwizs comment, i think it is a bit too ironic...
...how can you know what i know if you do not know what you know?...
i think you (sergwiz) should consider that not every person
on this planet is learning the same way...
for me, it is easier to set a question and when i see
the answer, i can learn from it, i can understand it...
(otherwise i would not set my question the way i did it!)
for me it is much easier than sitting in front of my screen
trying to solve a problem, using a way that i know it is
possible (OOP) but not very well documented in flashMX-help
or elsewhere
it is great to have persons like senocular trying to teach
people things they want to know!
i think this circle.fla is a good example for a tutorial about
OOP... it has every basic question answered somebody is coming
up with when starting with MX OOP... what do you think senocular?
please keep me up to date about your tut.
Hi Deeno, I beg your pardon. I was really too ironic.
It seemed to me that you yet didn't have enough knowledge. But if you understood Senocular's example and learned from it, - my respect.