Re: [Flashcoders] Attaching a change handler to a dynamically generated comboBox
I'm using Flash 9. I just tried using this instead of setChangeHandler: var myComboBox = myScrollBox.createClassChildAt Depth(mx.controls.ComboBox, DepthManager.kTop, {_x:10, _y:10}); myCondition.change = function(eventObj){ // combo = myComboBox.getSelectedItem().data; combo = myComboBox.selectedItem; trace(combo.label); } myComboBox.addEventListener("change", myCondition); ... And it didn't work either. Any advice? Thanks, --Carl On 6/26/07, Rákos Attila <[EMAIL PROTECTED]> wrote: As far I remember setChangeHandler() was used in v1 component library for Flash 6. Are you surely using v1 components? I don't think so, since there was no createClassChildAtDepth(), mx.controls.ComboBox class, etc. In v2 components there is an other way of attaching event handlers (addEventListener, "change" event). Attila =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From:Carl Welch <[EMAIL PROTECTED]> To: Flashcoders mailing list Date: Tuesday, June 26, 2007, 11:46:14 AM Subject: [Flashcoders] Attaching a change handler to a dynamically generated comboBox --===-- Hello List, I am having an issue with attaching a "change" handler to a ComboBox that is being dynamically generated. What is wrong with this code I am using? var myComboBox = myScrollBox.createClassChildAtDepth(mx.controls.ComboBox, DepthManager.kTop, {_x:10, _y:10}); myComboBox.addItem({label:"Foo", data:"FooBar"}); function comboDisplay(component) { trace(myComboBox.getSelectedItem().data); } myComboBox.setChangeHandler("comboDisplay"); As a test, I tried: myComboBox.onPress = function() { trace(myComboBox.getSelectedItem().data); } ... and it did trace the first item, but of course it wouldn't work as a dropdown anymore. Thanks. -- Carl Welch http://www.carlwelch.com [EMAIL PROTECTED] 805.403.4819 ___ Flashcoders@chattyfig.figleaf.com 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 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ___ Flashcoders@chattyfig.figleaf.com 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 -- Carl Welch http://www.carlwelch.com [EMAIL PROTECTED] 805.403.4819 ___ Flashcoders@chattyfig.figleaf.com 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
Re: [Flashcoders] Attaching a change handler to a dynamically generated comboBox
As far I remember setChangeHandler() was used in v1 component library for Flash 6. Are you surely using v1 components? I don't think so, since there was no createClassChildAtDepth(), mx.controls.ComboBox class, etc. In v2 components there is an other way of attaching event handlers (addEventListener, "change" event). Attila =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From:Carl Welch <[EMAIL PROTECTED]> To: Flashcoders mailing list Date:Tuesday, June 26, 2007, 11:46:14 AM Subject: [Flashcoders] Attaching a change handler to a dynamically generated comboBox --===-- Hello List, I am having an issue with attaching a "change" handler to a ComboBox that is being dynamically generated. What is wrong with this code I am using? var myComboBox = myScrollBox.createClassChildAtDepth(mx.controls.ComboBox, DepthManager.kTop, {_x:10, _y:10}); myComboBox.addItem({label:"Foo", data:"FooBar"}); function comboDisplay(component) { trace(myComboBox.getSelectedItem().data); } myComboBox.setChangeHandler("comboDisplay"); As a test, I tried: myComboBox.onPress = function() { trace(myComboBox.getSelectedItem().data); } ... and it did trace the first item, but of course it wouldn't work as a dropdown anymore. Thanks. -- Carl Welch http://www.carlwelch.com [EMAIL PROTECTED] 805.403.4819 ___ Flashcoders@chattyfig.figleaf.com 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 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ___ Flashcoders@chattyfig.figleaf.com 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
[Flashcoders] Attaching a change handler to a dynamically generated comboBox
Hello List, I am having an issue with attaching a "change" handler to a ComboBox that is being dynamically generated. What is wrong with this code I am using? var myComboBox = myScrollBox.createClassChildAtDepth(mx.controls.ComboBox, DepthManager.kTop, {_x:10, _y:10}); myComboBox.addItem({label:"Foo", data:"FooBar"}); function comboDisplay(component) { trace(myComboBox.getSelectedItem().data); } myComboBox.setChangeHandler("comboDisplay"); As a test, I tried: myComboBox.onPress = function() { trace(myComboBox.getSelectedItem().data); } ... and it did trace the first item, but of course it wouldn't work as a dropdown anymore. Thanks. -- Carl Welch http://www.carlwelch.com [EMAIL PROTECTED] 805.403.4819 ___ Flashcoders@chattyfig.figleaf.com 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