|
In browser DOM you use getElementById to get a
reference to the object using it's name. There are numerous ways to do
this in Flash. Modifying your example slightly:
function something(componentInstanceName) {
---this[componentInstanceName].text = "something"; } >>> [EMAIL PROTECTED] 05/12/05 12:35 pm >>> thanks bill, but it's the conditional if () that i'm trying to avoid. i'm thinking of the way it's implemented in browser DOM models with document.getElementById(elementID). surely there's a way? On 5/12/05, Bill Lane <[EMAIL PROTECTED]> wrote: > > Using components you can use getFocus to get a reference to the currently > active component. I use this in conjunction with an event listener to > respond to component events. Not sure that this is the best way. I'd be > interested to hear what others are doing. > > //example > > var new_object = createClassObject(mx.controls.TextInput,id,next_depth,o); > new_object.addEventListener("change", change_action); > > function change_action(evt:Object) > { > //get focussed item > var f:Object = evt.target.getFocus(); > if(f.className == "TextInput") > { > f.text = "something" > } > > } > > > > > Bill Lane > ===================== > Web Developer > Educational Media Group > PVC Teaching and Learning Portfolio > RMIT University > Tel: 61 3 9925 9804 > Fax: 61 3 9925 9625 > [EMAIL PROTECTED] > ===================== --- You are currently subscribed to fugli as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ You are currently subscribed to fugli as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ |
