It works, but seems fundamentally wrong, as I understood it was bad practise
to add methods to an object dynamically. Should I make the class listen for
clicks on the nested clip or is there another solution?

There's nothing wrong with adding methods to an object dynamically. What's slightly dodgy is 'talking to' a child or property of an object directly. It's better OO practice for the object to be in charge of its own properties, and to talk to it by some kind of accessor method. So you might say

myClip.setUpButtonFunction()

and then in the timeline of myClip, have a function which says

function setUpButtonFunction() {
myChildClip.onRelease = function() { stuff };
}

It's the same thing, of course, but it's cleaner, because if you ever decide to change the name or location of the button, you can do so without affecting the interface with the outside world.

Is that what you were asking?

Danny
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to