|
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] ===================== >>> [EMAIL PROTECTED] 05/12/05 12:05 pm >>> hi i've got a few components that share the same functions. i pass the component name into the function and have been using if/else with hardcoded instancenames within the function. is there a best practice way of referring to the components dynamically? currently i'm kinda doing this: function something(componentInstanceName) { if (componentInstanceName == "widget1") { this.widget1.text = "something"; } else if (componentInstanceName == "widget2") { this.widget2.text = "something"; } } and i'd like to: function something(componentInstanceName) { this.stageObjectOrSomeCollection[componentInstanceName].text = "something"; } is there a decent way of doing this? G --- 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/ |
