RE: [flexcoders] createChild and destroyChild
I think that if statement should be if (counter 0) { this.destroyChild(rowArray[counter-1]); counter--; } Matt -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of rgwilson26 Sent: Tuesday, February 21, 2006 8:56 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] createChild and destroyChild I am new to FLEX and am working on an app that allows the user to dynamically create a FormItem w/ various text boxes dynamically from a click event including a delete button in each form item that will allow the user to delete that specific instance of the object. I am able to create the FormItem using createChild, but don't know how to get destroyChild to work for a specific object. I am guessing you must reference this when referring to the specific FormItem object, but not sure of the correct syntax. Note: In my code my add function calls a component I have created (Start_New_Event.Components.Entry) Here is what I have: *** Main.mxml ** ?xml version=1.0? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Script ![CDATA[ var rowArray : Object = new Array() ; var counter : Number = 0 ; private function addRow():Void { rowArray[counter] = Start_New_Event.Components.Entry (formItem.createChild(Start_New_Event.Components.Entry, undefined, null ) ); counter++; } public function deleteRow():Void{ //-- this function does not work if(rowArray[counter] != 0){ this.destroyChild(rowArray[counter -1] ); counter--; } } ]] /mx:Script mx:Form mx:Button label=Add width=60 click=addRow();/ mx:FormItem textAlign=left id=formItem mx:HBox mx:TextInput id=txtRCAParticipants width=150/ mx:TextInput id=txtTitle width=150/ mx:Button label=Delete click=deleteRow(); / /mx:HBox /mx:FormItem /mx:Form /mx:Application -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] createChild with custom components
Hi, If your component class extends from mx.core.View or any of its subclasses (container class) like Box, HBox, VBox etc, your component would have this method automatically. Following is custom mxml component, which extends form Hbox and you can call createChild(..) on its intstances. For example, see the code below. 1) ##HBoxEx.mxml## mx:Hbox xmlns:mx=http://www.macromedia.com/2003/mxml; //your code /mx:HBox 2) ##testHBoxEx.mxml## mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; xmlns=* mx:Script function onHBoxInit() { _hb.createChild(mx.controls.Label, , {text:Hello World!}); } /mx:Script local:HBoxEx id=_hb / /mx:Application Hope that helps.. -abdul -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of m00n_de Sent: Friday, June 17, 2005 5:14 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] createChild with custom components hi there, a rookie needs some help ;) My Goal is to create custom Components dynamicly. Its no problem to generate components with createChild(), but i dont know how to adress custom components and what has to be imported in actionscript first. tnx for your help.. Yahoo! Groups Links Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] createChild
Robert Brueckmann wrote: I implemented the creationPolicy=auto and my tab navigator is still creating all of the children at load time. Like I said, I have an empty Tab navigator in the MXML code itselfwhen the user logs in, I trigger a [snip] If you're creating children dynamically, then that won't work. So let's stick with your approach and go back to your original problem: you have a TabNavigator to which you're adding tabs dynamically, and you say the tabs are not expanding to 100%. Can you show us a simplified version of this code (with the problem showing)? Something I can run and test locally? Manish
Re: [flexcoders] createChild
On Mon, 14 Feb 2005 09:55:39 -0500, Robert Brueckmann [EMAIL PROTECTED] wrote: [snip] stringsI use this array of strings to create tabs for my tab navigator. The only application that is created at load time is the first tab being displayedthe others are only created at runtime when the user clicks on that application's corresponding tab. The problem I'm having is when I [snip] Have you looked at the TabNavigator component? It supports deferred instantiation. You don't need to do this yourself. http://www.macromedia.com/devnet/flex/articles/client_perf_06.html Manish
RE: [flexcoders] createChild
Thanks for thatthat makes moving forward with more apps in the future easier to handle. Much appreciated Robert L. Brueckmann Web Developer Merlin Securities,LLC
RE: [flexcoders] createChild
Manish, I implemented the creationPolicy=auto and my tab navigator is still creating all of the children at load time. Like I said, I have an empty Tab navigator in the MXML code itselfwhen the user logs in, I trigger a GetUserApplications event which calls the command class, triggers the delegate class method which returns to the Application component view an array of strings listing all the apps the user has access to which I immediately loop through and create the associated tabs on the navigator and the corresponding components for each tabIm guessing the creation policy setting doesnt apply to children dynamically attached to the navigator component? If I had the components actually listed in the MXML file, this works but Im doing this on the fly because one user may only have access to app #1 and #2 whereas another may have all-accessso I need to do this dynamically and it works and my code I had written before your post about deferred instatiation built into the tab navigator still does the trick in the meantime. Thanks again, Rob Robert L. Brueckmann Web Developer Merlin Securities,LLC