This content has been marked as final. Show 4 replies
Looking at your code, I cannot fathom what it is that you are trying to do....
Your Thing class isn't going to have access to dot if it exists in your two mcs inside your main fla. not unless you use MovieClip(root).mc1.dot.y = 30; dot is not a member of the Thing class and therefore Thing cannot access it. At least not the way you are wanting. If you setup each of your mcs to be exported for AS and set their Class name as Box and Circle, then instantiating them would give you access to their dot member but not in the way you might think.
// Instantiate Circle MC
var mycircle:Circle = new Circle();
mycircle.dot.y = 30;
This would be a legal call. Parent classes do not inherit anything from their children. Their children inherit access to their methods. I wish I better understood what it was you were trying to do because then I might be able to help you get it working but based on what you have here I'd have to say you have things turned a bit inside out.
If you wished to extend this code for the movie clip to have an onPress event, how is this done?
If you create a number of objects dynamically of one of the children classes, in the actions on the stage, (still working in AS2), how do you get the object to respond to an onPress event?
Eg can you implement a listenerAction like in java.
The code below has the onPress event working but not it doesn't know which object has pressed it.
I wish I could tell you more. In AS2, you had to code each button independently. It did not have an Event Dispatch methodology like AS3 has. AS2 does have listeners but they are no where near as powerful as they are in AS3. All I can suggest is to look up listeners in the AS2 help and based on what you are doing, go from there. I personally prefer AS3s method of doing things since they are much more OOP oriented and a great deal more flexible than AS2.
In AS3 you could use the getChildAt or getChildByName method to reach the "dot" movieclip of either "Box" or "Circle".
Assume we are in the Thing class (this scopes to Thing).