Re: [flexcoders] Re: getChildByName using it to get the value of a textbox
Hi. I wrote a getChildById function for this purpose/use case... I create the grid and its children dynamically at runtime and give the DisplayObjects numerical ids. Its one thing you miss in flex if you're used to using getElementById in javascript. So... this is container specific... I havent gotten round to generifying it yet... private function getChildById(g:Grid, id:int):DisplayObject { for each (var gr:GridRow in g.getChildren()) { for each (var gi:GridItem in gr.getChildren()) { if (!(gi.getChildAt(0) is HBox)) { if (gi.getChildAt(0) is Text) { if (Text(gi.getChildAt(0)).id == String(id)) { return Text(gi.getChildAt(0)); } } if (gi.getChildAt(0) is TextInput) { if (TextInput(gi.getChildAt(0)).id == String(id)) { return TextInput(gi.getChildAt(0)); } } } } } return null; } hth. Kr. Luke. Jason B wrote: Because the items are not in MXML its in actionscript which dynamically creates the items for my form from a database and i want to dynamically loop the text box's so i can then save the data back to the database. you cant refer to a ID since the components are created at runtime --- In flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote: Why are you trying to use getChildByName to get a reference to a component? If you give it an 'id' attribute in MXML, you can then refer to it by that id. Gordon Smith Adobe Flex SDK Team From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jason B Sent: Monday, August 18, 2008 8:07 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] getChildByName using it to get the value of a textbox when using getchildbyname variable i've not been able to get the value can someone please post an example of how to get a value using getChildByName. var test:DisplayObject = this.getChildByName(inputtext + i); -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] external css file problem
Hi. I want to include an external css file in my flex application. Very simple: mx:Script source=assets/wemmStyle.css/ However this gives me an error: 1087: Syntax error: extra characters found after end of program. When I use the css in mx:Style tags in the file, all is well... however when I move it to an external file, it breaks... Can someone suggest why? Thanks in advance. Kind regards. Luke. Heres the css: /~~~ @font-face { src: url(assets/HelveticaNeueLTStd/HelveticaNeueLTStd-Md.otf); fontFamily: HelveticaMedium; fontWeight: normal; } @font-face { src: url(assets/HelveticaNeueLTStd/HelveticaNeueLTStd-Hv.otf); fontFamily: HelveticaHeavy; fontWeight: normal; } global { color: #66; fontFamily: HelveticaMedium; fontWeight: normal; fontSize: 12; } Label, Form, FormHeading, ComboBox, Button, VBox, HBox, Panel, TabNavigator, FormItem, Text, .errorTip { color: #66; fontFamily: HelveticaMedium; fontWeight: normal; fontSize: 12; } Button { color: #33; paddingTop: 5; paddingRight: 10; paddingBottom: 2; paddingLeft: 10; } Panel { color: #FF3300; fontSize: 18; } FormHeading { color: #E21630; fontFamily: HelveticaHeavy; fontWeight: normal; fontSize: 14; leftPadding: 0; paddingRight: 0; paddingTop: 0; textIndent: 0; textDecoration: none; textAlign: left; errorColor: #FF9900; disabledColor: #66; indicatorGap: 0; } Label { color: #00; } TabNavigator { color: #00; fontSize: 12; } .tabStyle { color: #00; fontSize: 11; } .selectedTab { color: #66; fontSize: 11; } .submitBox { backgroundColor: #EE; borderWidth: 1; borderColor: #CC; paddingTop: 10; paddingRight: 10; paddingBottom: 10; paddingLeft: 10; horizontalAlign: center; } FormItem { color: #00; fontSize: 12; } .errorTip { color: #FF; fontSize: 11; } HRule { borderColor: #EE; } / -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] external css file problem
Hi Shaun. Thanks bud, that extra pair of eyes! (-; Kr. Luke. shaun wrote: Luke Vanderfluit wrote: Hi. I want to include an external css file in my flex application. Very simple: mx:Script source=assets/wemmStyle.css/ mx:Script != mx:Style cheers, - shaun -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] x coordinate of component relative to parent
Hi. I have a component called RiskLikelihood which is basically a ComboBox. Ive placed many of these components in GridItems in a Grid. Now I want each component to tell me its x coordinate when I hover over the dropdown list. I have the index of the dropdown item through the 'itemRollOver' event Doing a trace on the 'evt.currentTarget.x' is always 0. I want to get the x coordinate relative to the parent so I can display a tooltip when the user hovers over a drop down list item... Any help appreciated. Kind regards. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] x coordinate of component relative to parent
Hi Again. Answered my own question by searching the group. Found it in this thread: 'Finding the x,y-coordinate position of a component' Thanks guys. Kr. Luke. Luke Vanderfluit wrote: Hi. I have a component called RiskLikelihood which is basically a ComboBox. Ive placed many of these components in GridItems in a Grid. Now I want each component to tell me its x coordinate when I hover over the dropdown list. I have the index of the dropdown item through the 'itemRollOver' event Doing a trace on the 'evt.currentTarget.x' is always 0. I want to get the x coordinate relative to the parent so I can display a tooltip when the user hovers over a drop down list item... Any help appreciated. Kind regards. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] scrollbar in HBox wont go away
Hi. I have an HBox with a button that I setup programmatically. And one that I set up using MX tags. mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=init(); mx:Script ![CDATA[ private function init():void { var hbs:HBox = new HBox(); baro.addChild(hbs); hbs.percentWidth = 100; hbs.setStyle(verticalAlign,middle); hbs.setStyle(horizontalAlign,center); hbs.setStyle(backgroundColor,#EE); hbs.setStyle(paddingBottom,10); hbs.setStyle(paddingTop,10); var b1:Button = new Button(); hbs.addChild(b1); b1.label = foo; } ]] /mx:Script mx:Form id=baro width=100% paddingBottom=0 paddingLeft=0 paddingRight=0 paddingTop=0 mx:HBox width=100% paddingBottom=10 paddingTop=10 horizontalAlign=center verticalAlign=middle backgroundColor=#EE mx:Button label=Button/ /mx:HBox /mx:Form /mx:Application One of the hboxes has a vertical scrollbar for no apparent reason and the other doesnt. I cant figure out how to get rid of the scrollbar Any suggestions? TIA. Kind regards. Luke -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] scrollbar in HBox wont go away
Hi. Michael Schmalle wrote: Hi, I have seen this before, your styles need to be of the correct type value IE Number, unit This is correct; hbs.setStyle(backgroundColor,0xEE); hbs.setStyle(paddingBottom,10); hbs.setStyle(paddingTop,10); You were using strings, only use string with string type styles. Thanks a million and a half (-: That fixed my prob. Kind regards. Luke. Mike -- Teoti Graphix, LLC http://www.teotigraphix.com Teoti Graphix Blog http://www.blog.teotigraphix.com You can find more by solving the problem then by 'asking the question'. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] capture linebreaks
Hi. Josh McDonald wrote: No, I mean /$\s*^/g which looks for any whitespace (including \n and \r) between the end of a line and the beginning of the next (with the /g) so you replace that with . Ok. Gotcha. But for some reason that won't work in Flex's regexp implementation although it does work fine in Java's. The second solution works fine though: var s : String = Line\nLine2; var rg : RegExp = /$\s*^/g; trace(s == \ + s + \); trace(); trace(s.replace( + rg + ,\\) == \ + s.replace(rg,) + \); trace(); trace(s.split(\\\n\).join(\\) == \ + s.split(\n).join() + \); trace(); Gives: s == Line Line2 s.replace(/$\s*^/g,) == Line Line2 s.split(\n).join() == LineLine2 Havent tested this yet but might need to. Since I have found the problem of missing newlines to be caused by my 'tail' program, Im simply saving the data from the textarea 'as is' to the database. When loading it again from the db, line breaks are intact so all is good, but the practise of storing line breaks in a database doesnt sit well with me so I might do something of an alternative solution... Kr. Luke. -Josh On Wed, Jun 18, 2008 at 9:36 AM, Luke Vanderfluit [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi. Thanks for your help. Josh McDonald wrote: If the /$\s*^/g regex doesn't work (it should though), You probably mean /^\s*$/ which is looking for any number of spaces between the beginning and end of a line... try string.split(\n).join() - it probably won't be fast, problem is I cant get it to recognise the \n Kr. Luke. but it'll get you by, and you can write something specific using indexOf etc later if speed becomes a problem. -Josh On Wed, Jun 18, 2008 at 9:24 AM, Luke Vanderfluit [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi. shaun etherton wrote: Hey Luke, Luke Vanderfluit wrote: Ive tried this: var myp:RegExp = /\n/g; have you tried \r Yes. Ive tried /\r\n/, /\r/, /\n/ Also tried setting is as in new RegExp(//n,g); etc. Kr. Luke. cheers, -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au http://e3Learning.com.au http://e3Learning.com.au 08 8221 6422 -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au http://e3Learning.com.au 08 8221 6422 -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] capture linebreaks
Hi. shaun etherton wrote: Hey Luke, Luke Vanderfluit wrote: Ive tried this: var myp:RegExp = /\n/g; have you tried \r Yes. Ive tried /\r\n/, /\r/, /\n/ Also tried setting is as in new RegExp(//n,g); etc. Kr. Luke. cheers, -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] capture linebreaks
Hi. Thanks for your help. Josh McDonald wrote: If the /$\s*^/g regex doesn't work (it should though), You probably mean /^\s*$/ which is looking for any number of spaces between the beginning and end of a line... try string.split(\n).join() - it probably won't be fast, problem is I cant get it to recognise the \n Kr. Luke. but it'll get you by, and you can write something specific using indexOf etc later if speed becomes a problem. -Josh On Wed, Jun 18, 2008 at 9:24 AM, Luke Vanderfluit [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi. shaun etherton wrote: Hey Luke, Luke Vanderfluit wrote: Ive tried this: var myp:RegExp = /\n/g; have you tried \r Yes. Ive tried /\r\n/, /\r/, /\n/ Also tried setting is as in new RegExp(//n,g); etc. Kr. Luke. cheers, -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au http://e3Learning.com.au 08 8221 6422 -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] textarea line breaks
Hi. I found a thread on this group about this problem but it doesnt address my particular case. I rendering text in a textarea with \n line breaks, now I want to store it in a database with those line breaks included and when its loaded back into the textarea in flex, I want to display it with the linebreaks. Whats the recommended or easiest way to do this in Flex? Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] textarea line breaks
Hi. Sorry about not being clear. Im creating a TextArea programmatically and rendering the text in there _with_ line breaks. So: ta1.text = foo\nbar; When I save that (through some save function) I want to retain the newline and save it to the database. Then when I pull that data back into the same textarea, I want to have the newlines where they were b4. Currently the newlines dont even make it to the save function. How do I keep them? Hope this makes more sense. Kr. Luke. Josh McDonald wrote: Not sure what you mean? If your server is returning text with line breaks, they should show up in your textarea without any troubles. It could be your backend is stripping newlines on the way into or out of the database. Try trace() with the string to double check. -Josh On Tue, Jun 17, 2008 at 1:43 PM, Luke Vanderfluit [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi. I found a thread on this group about this problem but it doesnt address my particular case. I rendering text in a textarea with \n line breaks, now I want to store it in a database with those line breaks included and when its loaded back into the textarea in flex, I want to display it with the linebreaks. Whats the recommended or easiest way to do this in Flex? Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au http://e3Learning.com.au 08 8221 6422 -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] textarea line breaks
Hi. Josh McDonald wrote: Yeah it helps, now we know that somewhere between flex and your database (on the way in) you're losing your newlines :) How are you posting the information back to your server? -Josh Great! when Ive rendered my textarea... so it contains: foo bar I have a button that when I click it does a trace of the textarea.text property. That trace doensn't contain the newlines... any ideas? Kr. Luke. then I do a trace on text property On Tue, Jun 17, 2008 at 2:05 PM, Luke Vanderfluit [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi. Sorry about not being clear. Im creating a TextArea programmatically and rendering the text in there _with_ line breaks. So: ta1.text = foo\nbar; When I save that (through some save function) I want to retain the newline and save it to the database. Then when I pull that data back into the same textarea, I want to have the newlines where they were b4. Currently the newlines dont even make it to the save function. How do I keep them? Hope this makes more sense. Kr. Luke. Josh McDonald wrote: Not sure what you mean? If your server is returning text with line breaks, they should show up in your textarea without any troubles. It could be your backend is stripping newlines on the way into or out of the database. Try trace() with the string to double check. -Josh On Tue, Jun 17, 2008 at 1:43 PM, Luke Vanderfluit [EMAIL PROTECTED] mailto:luke.vanderfluit%40e3learning.com.au mailto:[EMAIL PROTECTED] mailto:luke.vanderfluit%40e3learning.com.au wrote: Hi. I found a thread on this group about this problem but it doesnt address my particular case. I rendering text in a textarea with \n line breaks, now I want to store it in a database with those line breaks included and when its loaded back into the textarea in flex, I want to display it with the linebreaks. Whats the recommended or easiest way to do this in Flex? Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au http://e3Learning.com.au http://e3Learning.com.au 08 8221 6422 -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] mailto:josh%40gfunk007.com mailto:[EMAIL PROTECTED] mailto:josh%40gfunk007.com -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au http://e3Learning.com.au 08 8221 6422 -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] textarea line breaks
Hi. Josh McDonald wrote: I just tried this in my testbed project: mx:TextArea id=foo width=200 height=200 wordWrap=true/ mx:Button label=GO horizontalCenter=0 top=10 click=trace('[' + foo.text + ']')/ And it seems to work fine. I type some gibberish with a bunch of newlines and get: Im using BareTail to show the flashlog.txt file. Unfortunately it does all the compressing )-: When I opened the file in wordpad, it has the line breaks! doh! What are you using for tailing the log file? Im used to tail -f on linux... anything you know that is equivalent on windows... Thanks for your help (- Kr. Luke. [sadasdad kjh sadlj hasdlkj hasdlkjh asdkjahsdlkajsh adhjk ajkshd ailsjdh kalsjdh kjhas dkjh asd d d d] Which as you can see includes the newlines. Can you post the source to your textarea and the button click code you're using to trace the value of the textarea? -Josh On Tue, Jun 17, 2008 at 2:56 PM, Luke Vanderfluit [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi. Josh McDonald wrote: Yeah it helps, now we know that somewhere between flex and your database (on the way in) you're losing your newlines :) How are you posting the information back to your server? -Josh Great! when Ive rendered my textarea... so it contains: foo bar I have a button that when I click it does a trace of the textarea.text property. That trace doensn't contain the newlines... any ideas? Kr. Luke. then I do a trace on text property On Tue, Jun 17, 2008 at 2:05 PM, Luke Vanderfluit [EMAIL PROTECTED] mailto:luke.vanderfluit%40e3learning.com.au mailto:[EMAIL PROTECTED] mailto:luke.vanderfluit%40e3learning.com.au wrote: Hi. Sorry about not being clear. Im creating a TextArea programmatically and rendering the text in there _with_ line breaks. So: ta1.text = foo\nbar; When I save that (through some save function) I want to retain the newline and save it to the database. Then when I pull that data back into the same textarea, I want to have the newlines where they were b4. Currently the newlines dont even make it to the save function. How do I keep them? Hope this makes more sense. Kr. Luke. Josh McDonald wrote: Not sure what you mean? If your server is returning text with line breaks, they should show up in your textarea without any troubles. It could be your backend is stripping newlines on the way into or out of the database. Try trace() with the string to double check. -Josh On Tue, Jun 17, 2008 at 1:43 PM, Luke Vanderfluit [EMAIL PROTECTED] mailto:luke.vanderfluit%40e3learning.com.au mailto:luke.vanderfluit%40e3learning.com.au mailto:luke.vanderfluit%2540e3learning.com.au mailto:[EMAIL PROTECTED] mailto:luke.vanderfluit%40e3learning.com.au mailto:luke.vanderfluit%40e3learning.com.au mailto:luke.vanderfluit%2540e3learning.com.au wrote: Hi. I found a thread on this group about this problem but it doesnt address my particular case. I rendering text in a textarea with \n line breaks, now I want to store it in a database with those line breaks included and when its loaded back into the textarea in flex, I want to display it with the linebreaks. Whats the recommended or easiest way to do this in Flex? Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au http://e3Learning.com.au http://e3Learning.com.au http://e3Learning.com.au 08 8221 6422 -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] mailto:josh%40gfunk007.com mailto:josh%40gfunk007.com mailto:josh%2540gfunk007.com mailto:[EMAIL PROTECTED] mailto:josh%40gfunk007.com mailto:josh%40gfunk007.com mailto:josh%2540gfunk007.com -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au http://e3Learning.com.au http://e3Learning.com.au 08 8221 6422 -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] mailto:josh%40gfunk007.com mailto:[EMAIL PROTECTED] mailto:josh%40gfunk007.com -- Luke Vanderfluit Analyst / Web Programmer
[flexcoders] capture linebreaks
Hi. Now that Ive solved the textarea linebreak problem (with Josh's help, thanks Josh), my next problem arises... How do I capture a line break in flex. I capture the text that's been put in the textarea with linebreaks and all, but now I want to replace the linebreaks.. Ive tried this: mx:Script ![CDATA[ private function saveThis():void { var s1:String = foo.text; var myp:RegExp = /\n/g; s1 = s1.replace(myp,FA); if (s1.indexOf(\n) -1) { bar.text = yes + s1; } else { bar.text = no + s1; } } ]] /mx:Script mx:TextArea id=bar width=100 height=100/ mx:TextArea id=foo width=200 height=200 wordWrap=true/ mx:Button label=GO horizontalCenter=0 top=10 click=saveThis()/ Thanks in advance. Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] combobox.selectedItem causing component to do 3 runs to the server
Hi. I have a combobox component that has a list of sites. When I click on a site in the list, another component is populated with data from that site. This is what the setup looks like in the main file: mx:VBox id=rm enabled={orgform.saveOrUpdateOrg == 'Update'} label=Risk Matrix horizontalAlign=left horizontalGap=0 SiteList id=sitelist3 siteArr={siteArr} verticalGap=0/ RiskMatrix id=riskmatrix site={Site(sitelist3.sites.selectedItem)}/ /mx:VBox So when I click on a site in the sitelist3 component, that site is sent to the RiskMatrix component. All good. Now in the RiskMatrix component I have a 'set' function: [Bindable] private var _premise:Premise; public function set premise(p:Premise):void { _premise = p; if (_premise != null) { s2.getTemplateObjects(_premise.premiseId, RM); } } This sets the premise but does everything 3 times including calling the server function: s2.getTemplateObjects(_premise.premiseId, RM) I have a handler 'handleGetTemplateObjects()'. The handler does everything 3 times. Any idea why this is happening? Ive tested other setter functions in my code and they are all calling 3 times... why? Thanks for any help. Kind regards. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] combobox.selectedItem causing component to do 3 runs to the server
Hi Shaun and Alex. Alex Harui wrote: Maybe the way binding is set up causes a few cycles before settling down. If siteArr can be affected by a server access that would be one way Thanks. It was a binding prob. I changed it to: private var _premise:Premise; [Bindable] public function set premise(p:Premise):void { trace(HOWMANYTIMES... ); _premise = p; if (_premise != null) { s2.getTemplateObjects(_premise.premiseId, RM); } } public function get premise():Premise { return _premise; } and now it does one single server trip! Yes! Kr. Luke. *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Luke Vanderfluit *Sent:* Monday, June 02, 2008 6:01 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] combobox.selectedItem causing component to do 3 runs to the server Hi. I have a combobox component that has a list of sites. When I click on a site in the list, another component is populated with data from that site. This is what the setup looks like in the main file: mx:VBox id=rm enabled={orgform.saveOrUpdateOrg == 'Update'} label=Risk Matrix horizontalAlign=left horizontalGap=0 SiteList id=sitelist3 siteArr={siteArr} verticalGap=0/ RiskMatrix id=riskmatrix site={Site(sitelist3.sites.selectedItem)}/ /mx:VBox So when I click on a site in the sitelist3 component, that site is sent to the RiskMatrix component. All good. Now in the RiskMatrix component I have a 'set' function: [Bindable] private var _premise:Premise; public function set premise(p:Premise):void { _premise = p; if (_premise != null) { s2.getTemplateObjects(_premise.premiseId, RM); } } This sets the premise but does everything 3 times including calling the server function: s2.getTemplateObjects(_premise.premiseId, RM) I have a handler 'handleGetTemplateObjects()'. The handler does everything 3 times. Any idea why this is happening? Ive tested other setter functions in my code and they are all calling 3 times... why? Thanks for any help. Kind regards. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422 -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] popup timeout
Hi. Im trying to get a popup that says Details Saved when I save data. The popup should stay up for 2 seconds and then go away. I currently have the following code: private var puWin:IFlexDisplayObject; private function sdPopup():void { puWin = PopUpManager.createPopUp( this, DetailsSavedPopup, true); var myTimer:Timer = new Timer(2000, 0); myTimer.addEventListener(timer, timerHandler); myTimer.start(); } public function timerHandler(event:TimerEvent):void { PopUpManager.removePopUp(puWin); //trace(timerHandler: + event); } The problem here is that the times are not consistent. The first time I save the timeout is 2 seconds, then if I save again (immediately or after 5 seconds or so) the popup barely stays up at all, then on continued saves, it's inconsistent... Is there anything in the code causing this? Is there another (simpler way of doing this); This is my popup component: ?xml version=1.0 encoding=utf-8? mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml; width=200 height=100 mx:Text text=Details Saved... x=47.5 y=33 width=105 height=35 fontWeight=bold/ /mx:TitleWindow Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] popup timeout
Hi I solved this one as follows: See the code (changed) below, Basically the timer needs to be stopped for it to run its entire 2 seconds each time... Haha Viva Flex! Kr. Luke. Luke Vanderfluit wrote: Hi. Im trying to get a popup that says Details Saved when I save data. The popup should stay up for 2 seconds and then go away. I currently have the following code: private var puWin:IFlexDisplayObject; private var myTimer:Timer; private function sdPopup():void { puWin = PopUpManager.createPopUp( this, DetailsSavedPopup, true); myTimer:Timer = new Timer(2000, 0); myTimer.addEventListener(timer, timerHandler); myTimer.start(); } public function timerHandler(event:TimerEvent):void { PopUpManager.removePopUp(puWin); myTimer.stop(); //trace(timerHandler: + event); } The problem here is that the times are not consistent. The first time I save the timeout is 2 seconds, then if I save again (immediately or after 5 seconds or so) the popup barely stays up at all, then on continued saves, it's inconsistent... Is there anything in the code causing this? Is there another (simpler way of doing this); This is my popup component: ?xml version=1.0 encoding=utf-8? mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml; width=200 height=100 mx:Text text=Details Saved... x=47.5 y=33 width=105 height=35 fontWeight=bold/ /mx:TitleWindow Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] How do I wrap text in a label control
Hi. How do I wrap text in a label control? Thanks. Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] talk from one swf to another
Hi. Im using blazeds and a java backend. I have a swf that updates stuff on the server and thus in the database. My question is: Is it possible to have a second swf (using blazeds) that will listen for or subscribe to changes on a server object and have the server object push changes to the subscribed object. IOW. I want to have one swf respond to changes made with a different swf. Thanks. Kind regards. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] binding quandary
Hi. I have a master detail setup with a list of sites in the master section and individual sites in the detail section. In the detail section I have a form and I want to bind the form field values to the current site object. When I click on a site object in the master component, the 'set' function in the details component sets the site and pulls the particulars for that site from the server. I handle that server call (still in the details component) and copy the site values from the database into the site object. The form fields in the details component are bound to the site object using '{}'. Now when I alter the fields the changes are not reflected in the site object. The fields are bound to the site object so they should change when the site object changes. However when the fields are changed the changes are not reflected in the site object and I have to manually update the fields to get this to work. I expected the binding to work both ways. Apparently not. Is this correct. Should I set binding programmatically and then set them both ways, like so? BindingUtils.bindProperty(siteObject, selected, checkboxField, selected); BindingUtils.bindProperty(checkBoxField, selected, siteObject, selected); Can anyone shed light on this and suggest a recommended way of doing what I want to achieve. Thanks. Kind regards. Luke
[flexcoders] data object transfer
Hi. I have a series of checkboxes of which I want to store the values (true or false) On a page that displays the checkboxes I need to load them from a database and then post any changes back to the database. I have the server communication happening. On the client side I pass the data up as an object: private var cbm:Object = { REQ_CW: {selected:true}, REQ_DCW: {selected:true}, REQ_DCWCO: {selected:false}, REQ_AW: {selected:false}, REQ_FW: {selected:false}, REQ_DAW: {selected:false}, REQ_DFW: {selected:false}, REQ_W: {selected:false}, REQ_FAW: {selected:false} } This I can cast to a java HashMap on the server side. However when retrieving the data Im having a problem, I pass back a HashMap to the client which gets received as an Object, I can access all the values of the object correctly, BUT. I cant bind to the object. How do I tackle this other than populating/assigning and reading the object values manually? Thanks for any help. Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] component life cycle question
Hi. Im replying to my own post coz Ive worked out something... I should pass the dataProvider fo the datagrid in my component from the main application (or some controller class). I guess this is the recommended way: That is. Supply any data for childcomponents from a main component. Any suggestions or thoughts on this are welcome... Kr. Luke. Luke Vanderfluit wrote: Hi. Ive been reading up on the component life cycle. However the following problem I still cant solve. I have an main application component that gets passed a request parameter (personid) at runtime. (Application.application.parameters.personid) I then have a component called 'sitelist' that builds a datagrid based on a server request involving the personid, so the server request relies on the personid being passed on. In my main app I am able to see the personid parameter on loading, but in the sitelist component personid is null on loading. It seems that the child component renders before the main app and therefore the parameter doesnt exist at the time that the child is created. What is the recommended way of getting a runtime parameter in a subcomponent? I appreciate any help. Kr. Luke. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] component life cycle question
Hi. Ive been reading up on the component life cycle. However the following problem I still cant solve. I have an main application component that gets passed a request parameter (personid) at runtime. (Application.application.parameters.personid) I then have a component called 'sitelist' that builds a datagrid based on a server request involving the personid, so the server request relies on the personid being passed on. In my main app I am able to see the personid parameter on loading, but in the sitelist component personid is null on loading. It seems that the child component renders before the main app and therefore the parameter doesnt exist at the time that the child is created. What is the recommended way of getting a runtime parameter in a subcomponent? I appreciate any help. Kr. Luke.
[flexcoders] binding problem
Hi. I have a master detail setup. When I click the master item and the details are editable in the detail section, I need to bind them (the object's properties) to the relevant textinput fields so that when I save the object, the details I've entered go to the server. I have a setter that sets the object in the detail when it's selected in the master. public function set premise(p:Premise):void { _premise = p; if (_premise.premiseId != 0) { //not a new premise //do stuff } doBinding(); } //bind to text input fields public function doBinding():void { BindingUtils.bindProperty(_premise,name,premiseName,text); BindingUtils.bindProperty(_premise,street,premiseStreet,text); BindingUtils.bindProperty(_premise,suburb,premiseSuburb,text); BindingUtils.bindProperty(_premise,state,premiseState,text); BindingUtils.bindProperty(_premise,postcode,premisePostcode,text); } However the binding only works for the first premise, then when I select a premise in the master, this selection and consecutive selections set the premises in the array to all be the same premise. Any suggestions? Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] db object - main app - component
Hi. I have a main application that fetches an organisation object from the db. It then instantiates an organisation object on the client side. Then, still in my main application I call a component which contains a form for the organisation. I pass the organisation object to this component. Previously I had the following in my component to populate the organisation object: Organisation id=organisation name={organisationName.text} street={organisationStreet.text} suburb={organisationSuburb.text} state={organisationState.selectedItem.toString()} postcode={organisationPostcode.text} / The problem with this is that I cant access the fields on initialisation of the component. It seems the component hasnt populated the organisation yet. So I think I need to populate the organisation using a setter. Would that help? What Im trying to achieve is that once the component and the form loads I can test the organisation's fields in my script block. Thanks for any responses. Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] number and string validator
Hi Josh. Josh McDonald wrote: Just use a number validator and check it's 999 and 1? That's great! Thanks. minLength=1000 maxLength= Kr. Luke. On Mon, Apr 28, 2008 at 3:54 PM, Luke Vanderfluit [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi. I have a postcode field that I want to test on digits as well as length. So the field must have digits and the field should be of length 4. I thought I would do 2 validators: mx:StringValidator id=postcodeStringValidator source={organisationPostcode} property=text minLength=4 maxLength=4 tooShortError=Please enter a 4-digit postcode/ mx:NumberValidator id=postcodeNumberValidator source={organisationPostcode} property=text/ However only the StringValidator works here... How would I use validators to check both lenght and whether the pc is 4 digits? Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au http://e3Learning.com.au 08 8221 6422 -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] change event
Hi. I have a textinput and combobox. Both dispatch a change event. Is there a way of discerning which type of event so I can take appropriate action based on the type? TextInput change dispatches flash.events.Event ComboBox change dispatches mx.events.ListEvent Thanks. Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] change event
Hi Alex and Shaun. Alex Harui wrote: The best way is to use different event handlers, i.e.: textInput.addEventListener(Event.CHANGE, textInput_changeHandler); comboBox.addEventListener(Event.CHANGE, comboBox_changeHandler); You can also test for which one like this: function generic_changeHandler(event:Event):void { if (event.target is ComboBox) … else if (event.target is TextInput) … } Thanks very much. Both methods (Shaun's too) worked. Kr. Luke. *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Luke Vanderfluit *Sent:* Sunday, April 27, 2008 9:36 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] change event Hi. I have a textinput and combobox. Both dispatch a change event. Is there a way of discerning which type of event so I can take appropriate action based on the type? TextInput change dispatches flash.events.Event ComboBox change dispatches mx.events.ListEvent Thanks. Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422 -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422 -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * 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/
[flexcoders] number and string validator
Hi. I have a postcode field that I want to test on digits as well as length. So the field must have digits and the field should be of length 4. I thought I would do 2 validators: mx:StringValidator id=postcodeStringValidator source={organisationPostcode} property=text minLength=4 maxLength=4 tooShortError=Please enter a 4-digit postcode/ mx:NumberValidator id=postcodeNumberValidator source={organisationPostcode} property=text/ However only the StringValidator works here... How would I use validators to check both lenght and whether the pc is 4 digits? Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] ArrayCollection (AS) and ArrayList (java) not in sync)
Hi. Im having a problem retrieving a list of objects from the server. Im using blazeds and have successfully retrieved lists of objects using the following construct: Im dealing with a list that has Site Objects mx:RemoteObject id=srv destination=theService/ mx:DataGrid id=sites dataProvider={srv.getSites.lastResult}/ On the server the ArrayList is being generated correctly with 2 different Site objects. On the client side Im getting the last of the 2 sites twice. So I iterate through the ArrayCollection and there are 2 same Objects in there. Odd... Any suggestions would be welcome. Kind regards. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] ArrayCollection (AS) and ArrayList (java) not in sync)
Hi. As always. On further inspection the array on the server isnt getting it right. Sorry for the noise )-: Kr. L. Luke Vanderfluit wrote: Hi. Im having a problem retrieving a list of objects from the server. Im using blazeds and have successfully retrieved lists of objects using the following construct: Im dealing with a list that has Site Objects mx:RemoteObject id=srv destination=theService/ mx:DataGrid id=sites dataProvider={srv.getSites.lastResult}/ On the server the ArrayList is being generated correctly with 2 different Site objects. On the client side Im getting the last of the 2 sites twice. So I iterate through the ArrayCollection and there are 2 same Objects in there. Odd... Any suggestions would be welcome. Kind regards. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] passing parameters to components
Hi. I have a flex application that gets called from an html link and is passed a parameter. The param is personid. I retrieve the parameter in the flex application (BrowserManager). So I have access to it in the main application file. I have a number of components within the main application, that do server requests. In some of those requests I need to pass the personid (that I have retrieved from the browser url). My question is: What is the accepted method of passing variables (params) between components, specifically, in this case, from parent to child component? Thanks for your responses. Kind regards. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] passing parameters to components
Hi. In partial answer to my own question (and not seem a complete and utter idiot) here's what Im currently doing: In my component (SiteList) I have a setter function: private var personId:String; public function set setPersonId(p:String):void { personId = p; } In my main component: SiteList width=218 height=378 setPersonId={personId}/ Is this the recommended way? What are the alternatives? Thanks again. Kr. Luke. Luke Vanderfluit wrote: Hi. I have a flex application that gets called from an html link and is passed a parameter. The param is personid. I retrieve the parameter in the flex application (BrowserManager). So I have access to it in the main application file. I have a number of components within the main application, that do server requests. In some of those requests I need to pass the personid (that I have retrieved from the browser url). My question is: What is the accepted method of passing variables (params) between components, specifically, in this case, from parent to child component? Thanks for your responses. Kind regards. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] sending object to component
Hi. I have a component that displays a form. When the form displays I want to display different stuff based on whether a property of an object that I send to the form is null or not. Im calling the form component from the parent like this: OrgForm organisation={organisation}/ Now how do I access the properties of organisation inside the component before it displays? My component instantiates an AS Organisation object but I cant access it in a script block. My function to change the form is: private var saveOrUpdate:String = Update; if (organisation.organisationId == null) { saveOrUpdate = Save; } I guess I need some event to trigger the function. The event model and how that works is something that I havent quite grokked yet )-: I guess I could also pass another attribute along such as OrgForm organisation={organisation} something=no/ but how do I then access that attribute? Thanks very much for your help (-: -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] sending object to component
Hi Shaun. That helped. Thanks bud. Kr. Luke. shaun wrote: Luke Vanderfluit wrote: Hi. I have a component that displays a form. When the form displays I want to display different stuff based on whether a property of an object that I send to the form is null or not. Im calling the form component from the parent like this: OrgForm organisation={organisation}/ Now how do I access the properties of organisation inside the component before it displays? You could set the visible attribute to false OrgForm organisation={organisation} visible=false / then in your function set it to true once your UI logic has executed. [Bindable] //getter ommited. public funciton set organisation(o:Organisation):void{ _organisation = o; changeForm(); //changes visibility to true. } private var saveOrUpdate:String = Update; private function changeForm():void{ if (_organisation.organisationId == null) { saveOrUpdate = Save; } this.visible = true; } cheers, - shaun -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] sending object to component
Hi. I still cant get this to work the way I want it to. Perhaps I should be more clear. Here is the code for my component: http://edencane.pastebin.com/f6ff71721 What I want to do is change the lable on the button of the form depending on whether the organisation object is null. Thanks. Kind regards. Luke. Luke Vanderfluit wrote: Hi Shaun. That helped. Thanks bud. Kr. Luke. shaun wrote: Luke Vanderfluit wrote: Hi. I have a component that displays a form. When the form displays I want to display different stuff based on whether a property of an object that I send to the form is null or not. Im calling the form component from the parent like this: OrgForm organisation={organisation}/ Now how do I access the properties of organisation inside the component before it displays? You could set the visible attribute to false OrgForm organisation={organisation} visible=false / then in your function set it to true once your UI logic has executed. [Bindable] //getter ommited. public funciton set organisation(o:Organisation):void{ _organisation = o; changeForm(); //changes visibility to true. } private var saveOrUpdate:String = Update; private function changeForm():void{ if (_organisation.organisationId == null) { saveOrUpdate = Save; } this.visible = true; } cheers, - shaun -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] newbie question
Hi. Im relatively new to flex and am writing an application at work using flex! Yes! I want to get a log in page working in flex. Doing this in html/jsp one would create a page, submit the page and (if credentials are good) move to the next page. In flex, the concept of reloading pages is non-existent, I believe. So I know how to connect to a server from a flex client to test the user credentials... The question is: How do I allow the user to navigate from one page to the next? (I am currently using states. Is that the way?) My submit button will call an actionscript function that will test the credentials, but it should also put the user into the next step of the application, what is the accepted way of doing this? Thanks. Kind regards. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] newbie question
Hi Gordon. Gordon Smith wrote: How do I allow the user to navigate from one page to the next? You'd generally use a ViewStack if the pages have little UI in common with each other. Use states if they have a lot in common. You can also mix and match, using a ViewStack for part of the screen, etc. A ViewStack shows 1 of N of its child views. You change which child it displays by setting its selectedChild or selectedIndex property. Thanks very much for your reply... I have a component that displays a form (currently in selectedIndex 0), from this component I want the click to send me to ViewStack.selectedIndex 1. Is there something like parent.selectedIndex? Access the ViewStack (that contains the component as one of its children) directly from the component doesnt work. mx:Button label=Button click=myVS.selectedIndex='1';/ How would I do that? Kind regards. Luke. Gordon Smith Adobe Flex SDK Team *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Luke Vanderfluit *Sent:* Wednesday, April 16, 2008 5:49 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] newbie question Hi. Im relatively new to flex and am writing an application at work using flex! Yes! I want to get a log in page working in flex. Doing this in html/jsp one would create a page, submit the page and (if credentials are good) move to the next page. In flex, the concept of reloading pages is non-existent, I believe. So I know how to connect to a server from a flex client to test the user credentials... The question is: How do I allow the user to navigate from one page to the next? (I am currently using states. Is that the way?) My submit button will call an actionscript function that will test the credentials, but it should also put the user into the next step of the application, what is the accepted way of doing this? Thanks. Kind regards. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422 -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] Proof of concept with RemoteObject, Tree, BlazeDS and callback to server
Hi. Id like to share my experience in implementing Tree with drag and drop using RemoteObject and BlazeDS. What Im doing is this: I have a database table representing a group hierarchy. The hierarchy in the table is implemented with minsort and maxsort. So for example: Group Root: minsort 0, maxsort 9 (branch) Group Child 1: minsort 1, maxsort 2 (leaf) Group Child 2: minsort 3, maxsort 6 (branch) Group Grandchild 1 (Child of child 2): minsort 4, maxsort 5 (leaf) Group Child 3: minsort 7, maxsort 8 (leaf) This would give a simple hierarchy of Root with 3 children, one of which has its own child. Okay, you get the picture. I want to display this hierarchy as a Tree in flex. Then I want to drag and drop groups on to other groups and persist that back to the database. /~~~ I have a java class on the server that does a query on the database. The main work is done in the sql query where I get the groups more or less in order. More about this later. Flex on the server is using BlazeDS and RemoteObject. To get this working I did the following: 0. Installed a fresh instance of tomcat 6.0.16. 1. copied the jar files available in WEB-INF/lib of blazeds.war to the WEB-INF/lib of ROOT 2. copied the WEB-INF/flex directory from blazeds.war to WEB-INF/flex in tomcat ROOT/WEB-INF/ containing the following files: messaging-config.xml proxy-config.xml remoting-config.xml services-config.xml 3. add the listener, servlet and servlet mapping defined in web.xml in blazeds.war to the web.xml. /~~ Im using a directory (version controlled with bazaar) where my java files live. I use ant to compile the java files into a jar file and distribute them to WEB-INF/lib of the tomcat instance. My java files are here for viewing: http://edencane.pastebin.com/f6c3f8de2 I havent included the DAO stuff. Im assuming database connection infrastructure is present: For this example Ive used jdbc but it would work equally well with Hibernate. The GroupService class is the java class that I refer to in the remoting-config.xml, its id is set as 'groupPOC'. Thats what I use to access the java Class called 'GroupService' The remoting-config.xml file is here: http://edencane.pastebin.com/f2c2a1a32 as you can see in that file the relevant destination is set using: destination id=groupPOC properties sourcegroupFlexPOC.GroupService/source /properties /destination / I use Eclipse 3.3 on linux with flexbuilder3 plugin, license of which is running out today )-: With this I compile the flex stuff, src is under the same version control as the java code. I deploy to webapps/ROOT/groupPOC/ I could also compile the flex stuff with ant or from the command line (which I both tried and used successfully) but for the moment flexbuilder was least effort and fastest! These are my mxml and actionscript files http://edencane.pastebin.com/f34db9743 the groupPOC.mxml file has as its RemoteObject: mx:RemoteObject id=srv destination=groupPOC mx:method name=getGroups result=handleGetGroups(event) fault=Alert.show(event.fault.message)/ /mx:RemoteObject The method tag doesnt have to be in there but its handy coz with the mx:method tag I can set the result of the remote object call to be handled by a local actionscript function. / THe trick to getting the tree to display is having the arrays named 'children'. In the java class named Group there is an ArrayList named 'children'. This takes care of the hierarchy. The GroupService class has a 'getGroups' method which does the sql query and populates the Hierarchy. So then I have a 'Group' with a property of 'children', an ArrayList, which consists of 'Groups'. Each 'Group' in the 'children' ArrayList has its own 'children' ArrayList etc. When the Hierarchy is complete a Java ArrayList is returned by the GroupService class. The returned list contains all the top level 'Group' objects. ArrayList is 'all' Flex needs to translate it into actionscript. Magnificent! ArrayLists are automatically transformed to ArrayCollections on the actionscript side. Formidable! If a children ArrayList is null it is shown as a leaf otherwise its shown as a branch, all automagicallly. /~ Drag and drop is native in flex components but can be further customised to 'catch' more events (like dragEnter, dragComplete) and fire off handlers. A demo of this is shown in the 'dcHandler' actionscript function (see my actionscript code). At the end of the function I call a Java method on the server. This method currently only displays the name of the group, but the method will eventually have to update the minsort and maxsort integers of the group to
[flexcoders] arraycollection and tree
Hi. I am using remoteobject to get stuff from a database (java/mysql). I want to represent the List, generated on the server side and sent to the client as an arraycollection, as a tree. Does anyone have examples of how to do this. I have been reading the online docs but Im making very slow progress. Thanks. Kind regards. Luke.
Re: [flexcoders] flexmxmlservlet
Hi VELO. Thanks very much for your reply. VELO wrote: Hi Luke, Why you don't use flex-oem-compiler? http://livedocs.adobe.com/flex/3/compilerAPI_flex3.pdf Im now using flexbuilder plugin in eclipse on linux to compile my flex stuff. The stuff you pointed me to looks interesting. Thanks. I ran some tests with maven, and is faster them compc.jar tool http://flex-mojos.blogspot.com/ Good luck, and if you wanna help, and, wanna make an open source project, please, tell me, we can exchange some experiences. I cant commit time. Good luck. Kr. Luke. VELO On Sat, Mar 22, 2008 at 11:18 PM, Luke Vanderfluit [EMAIL PROTECTED] wrote: Hi. Im able to compile my mxml files with the mxmlc tool from both the command line and using ant. Now Im trying to compile using flexmxmlservlet. Ive moved all the right jars to the right spot (the compile is no longer complaining about missing classes etc.) and now I am receiving an error as follows: 23/03 12:47:29 ERROR java.lang.NoSuchFieldError: type at flex2.compiler.as3.reflect.Method.functionTypeName(Method.java:135) at flex2.compiler.as3.reflect.Method.init(Method.java:22) at flex2.compiler.as3.reflect.TypeTable.createMethod(TypeTable.java:106) at flex2.compiler.as3.reflect.Class.processDefinitions(Class.java:152) at flex2.compiler.as3.reflect.Class.init(Class.java:97) at flex2.compiler.as3.reflect.TypeTable.createClass(TypeTable.java:99) at flex2.compiler.as3.reflect.TypeTable.createClasses(TypeTable.java:90) at flex2.compiler.abc.Compiler.analyze4(Compiler.java:414) at flex2.compiler.API.analyze(API.java:2370) at flex2.compiler.API.analyze(API.java:2275) at flex2.compiler.API.batch2(API.java:360) at flex2.compiler.API.batch(API.java:1025) at flex2.compiler.API.compile(API.java:1211) at flex2.compiler.API.compile(API.java:1086) Can anybody help? Thanks. Kind regards. Luke. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] flexmxmlservlet
Hi. Im able to compile my mxml files with the mxmlc tool from both the command line and using ant. Now Im trying to compile using flexmxmlservlet. Ive moved all the right jars to the right spot (the compile is no longer complaining about missing classes etc.) and now I am receiving an error as follows: 23/03 12:47:29 ERROR java.lang.NoSuchFieldError: type at flex2.compiler.as3.reflect.Method.functionTypeName(Method.java:135) at flex2.compiler.as3.reflect.Method.init(Method.java:22) at flex2.compiler.as3.reflect.TypeTable.createMethod(TypeTable.java:106) at flex2.compiler.as3.reflect.Class.processDefinitions(Class.java:152) at flex2.compiler.as3.reflect.Class.init(Class.java:97) at flex2.compiler.as3.reflect.TypeTable.createClass(TypeTable.java:99) at flex2.compiler.as3.reflect.TypeTable.createClasses(TypeTable.java:90) at flex2.compiler.abc.Compiler.analyze4(Compiler.java:414) at flex2.compiler.API.analyze(API.java:2370) at flex2.compiler.API.analyze(API.java:2275) at flex2.compiler.API.batch2(API.java:360) at flex2.compiler.API.batch(API.java:1025) at flex2.compiler.API.compile(API.java:1211) at flex2.compiler.API.compile(API.java:1086) Can anybody help? Thanks. Kind regards. Luke.
Re: [flexcoders] DataGrid limit on amount of records or data?
Hi Jason. Merrill, Jason wrote: No, I guess I can't think of cases when showing 10,000 records with no filtering would be important in a Flex app. What examples were you thinking of? I am thinking of a tree. When I expand a node I might expand all the children down to the leaf node. Funny then, as per the topic title, I thought we were talking about DataGrid. Well. Im a newbie to flex and want to eventually move a whole heap of stuff to flex. To begin Id like to represent one of our company's structures as a tree in flex. As a starting point Ive tried to list that structure in a Datagrid. I hope that explains more where Im coming from. Sorry about the confusion. Kr. Luke. Jason Merrill *Bank of America * GTO LLD Solutions Design Development eTools Multimedia *Bank of America Flash Platform Developer Community* -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] DataGrid limit on amount of records or data?
Hi Seth. Seth Hodgson wrote: What type of channel/endpoint are you using between the client and server? Its rtmp, which is the default channel in data-management-config.xml default-channels channel ref=my-rtmp/ /default-channels If you're using RTMP, that protocol currently has a maximum underlying chunk size of 10M. If you're trying to return more than this amount of data in a single result the player will actually terminate the connection. AMF serialization handles the result object graph in a single pass, so there's no way to auto-magically split a serialized result that's larger than this out into separate result messages/chunks. OK that sounds like a reasonable explanation. If this is what you're running into, you can work around it by fetching your data set to the client in smaller pages, where each page doesn't approach this size limit individually. Or use one of the HTTP-based channels/endpoints which don't impose this resource limit. Or, as others have mentioned, for the use cases you have that require huge data sets on the client, try to compute a slimmer result on the server if that's reasonable rather than pulling your entire domain, or large portions of it, down to the client at once. Say you're wanting to generate a graph of 10K data points - rather than pulling down all 10K full objects, you could make a separate remote object call to the server to a method that just pulled out the specific property you're graphing from the database and returns a simple list of those values. Granted, if you're plotting or processing most of the properties in these objects this type of optimization would make much less sense. Best, Seth -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] DataGrid limit on amount of records or data?
Hi Jason. Merrill, Jason wrote: No, I guess I can't think of cases when showing 10,000 records with no filtering would be important in a Flex app. What examples were you thinking of? I am thinking of a tree. When I expand a node I might expand all the children down to the leaf node. Kr. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] DataGrid limit on amount of records or data?
Hi. I really appreciate everyones response (-: Gordon Smith wrote: You need to determine whether you're having a problem fetching the data from the server, or displaying the data in the DataGrid. The problem is in the rendering. I am able, with a simple jsp to fetch the data and display it in html. Kr. Luke. Gordon Smith Adobe Flex SDK Team *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Luke Vanderfluit *Sent:* Sunday, February 10, 2008 12:34 AM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] DataGrid limit on amount of records or data? Hi Alex. Thanks very very much for responding. Alex Harui wrote: The only limit should be the amount of memory, not some number. What problem did you see when you got above 5000? The problem was that the data simply did not render. I tested with 2 different datasets, gradually increasing the number of rows in the database table. One dataset rendered correctly up to 4128 rows in the database. Then increasing the data with one row caused nothing (blank page) to be displayed. This was retried with a server (tomcat) restart and without in both cases the same result. No errors or debug messages. The other dataset showed the same behaviour however the cut off point was up around 6030 records. After I had reached the upper limit where no data was displayed ( a blank page) I shrunk the data back a few rows in both cases and reloaded the page with data displaying again. What do you think? Shouldnt I be able to display that many rows if I want? Kind regards. Luke. -- *From:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] *On Behalf Of *Luke Vanderfluit *Sent:* Saturday, February 09, 2008 4:36 PM *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com; [EMAIL PROTECTED] mailto:javaflexcoders%40yahoogroups.com *Subject:* [flexcoders] DataGrid limit on amount of records or data? Hi. Im using flex with a hibernate backend. I have tables in a db that Id like to show using Datagrid. I have done tests and found that there is a limit to the number of records shown in the datagrid. Is this a limitation of the datagrid? How do I get around this? I currently am able to show around 5000 records. When I have tables of say 1 or 10 records, how do I show them? Thanks. Kind regards. Luke. -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
Re: [flexcoders] DataGrid limit on amount of records or data?
Hi Alex. Thanks very very much for responding. Alex Harui wrote: The only limit should be the amount of memory, not some number. What problem did you see when you got above 5000? The problem was that the data simply did not render. I tested with 2 different datasets, gradually increasing the number of rows in the database table. One dataset rendered correctly up to 4128 rows in the database. Then increasing the data with one row caused nothing (blank page) to be displayed. This was retried with a server (tomcat) restart and without in both cases the same result. No errors or debug messages. The other dataset showed the same behaviour however the cut off point was up around 6030 records. After I had reached the upper limit where no data was displayed ( a blank page) I shrunk the data back a few rows in both cases and reloaded the page with data displaying again. What do you think? Shouldnt I be able to display that many rows if I want? Kind regards. Luke. *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Luke Vanderfluit *Sent:* Saturday, February 09, 2008 4:36 PM *To:* flexcoders@yahoogroups.com; [EMAIL PROTECTED] *Subject:* [flexcoders] DataGrid limit on amount of records or data? Hi. Im using flex with a hibernate backend. I have tables in a db that Id like to show using Datagrid. I have done tests and found that there is a limit to the number of records shown in the datagrid. Is this a limitation of the datagrid? How do I get around this? I currently am able to show around 5000 records. When I have tables of say 1 or 10 records, how do I show them? Thanks. Kind regards. Luke.
Re: [flexcoders] DataGrid limit on amount of records or data?
Hi Jason. Thanks for your response. Merrill, Jason wrote: As a side note, taking a step back, why would you want to present that many records at a time to the user? It seems anything above a few hundred is overly cumbersome to wade through, and should perhaps instead be filtered further. No? True in most cases I guess, but I can think of a few use cases where Id want to load a severe amount of data. Can you? (-; Kind regards. Luke. Jason Merrill *Bank of America * GTO LLD Solutions Design Development eTools Multimedia *Bank of America Flash Platform Developer Community* *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Alex Harui *Sent:* Saturday, February 09, 2008 11:12 PM *To:* flexcoders@yahoogroups.com; [EMAIL PROTECTED] *Subject:* RE: [flexcoders] DataGrid limit on amount of records or data? The only limit should be the amount of memory, not some number. What problem did you see when you got above 5000? *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Luke Vanderfluit *Sent:* Saturday, February 09, 2008 4:36 PM *To:* flexcoders@yahoogroups.com; [EMAIL PROTECTED] *Subject:* [flexcoders] DataGrid limit on amount of records or data? Hi. Im using flex with a hibernate backend. I have tables in a db that Id like to show using Datagrid. I have done tests and found that there is a limit to the number of records shown in the datagrid. Is this a limitation of the datagrid? How do I get around this? I currently am able to show around 5000 records. When I have tables of say 1 or 10 records, how do I show them? Thanks. Kind regards. Luke.
[flexcoders] DataGrid limit on amount of records or data?
Hi. Im using flex with a hibernate backend. I have tables in a db that Id like to show using Datagrid. I have done tests and found that there is a limit to the number of records shown in the datagrid. Is this a limitation of the datagrid? How do I get around this? I currently am able to show around 5000 records. When I have tables of say 1 or 10 records, how do I show them? Thanks. Kind regards. Luke.
[flexcoders] flex hibernate probs
Hi. More of the same. Im starting to feel like a spammer. Are there so few people using java and flex? I have been trying for many days to get this working. I want proof of concept of connecting to a hibernate back end with flex front end. I need help! I have an mxml file that specifies a hibernate destination. The data-management-config.xml file is OK (uses HibernateAssembler. I have proven that my hibernate mappings work. (Hibernate is not the problem) I have all the jars in /WEB-INF/lib. (mxml compiles and swf loads). I can load the mxml page but I dont get data... Please help! I can post files if necessary. TIA Kr. Luke Vanderfluit
[flexcoders] help! flex hibernate probs
Hi. I posted this before, but got no response. I guess this might be the wrong list for this, any suggestions where to get help? ~ Im using flex2 and trying to connect to an existing hibernate back end. Using tomcat5022,hibernate30. I have put all the flex jar files in the WEB-INF/lib of the web app. /~ flex-bootstrap.jar flex-messaging-common.jar flex-messaging.jar flex-messaging-opt.jar flex-messaging-req.jar flex-spring-factory.jar \ I have modified the web.xml file, but had to comment out the MessageBroker Servlet stuff coz it was giving an error on tomcat startup. This is the start of the stack trace with MessageBroker servlet enabled in web.xml: /~ java.lang.NullPointerException at flex.management.BaseControl.getObjectName(BaseControl.java:287) at flex.management.BaseControl.register(BaseControl.java:148) at flex.messaging.MessageBroker.init(MessageBroker.java:146) at flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:84) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3951) \ Im not able to get the connection to the database as yet. ~~~ I am using an mxml file that uses an mx:DataService : mx:DataService id=ds destination=hibernate-product autoCommit=false autoSyncEnabled=false fault=faultHandler(event) conflict=conflictHandler(event)/ The mx:Application has the following attribute: creationComplete=ds.fill(products, 'all.products', []) products is an ArrayCollection: mx:ArrayCollection id=products/ all.products is a named query in hibernate (from the hbm.xml file): query name=all.productsFrom Prod/query (Prod is my entity/dbtable) data-management-config.xml defines the default channels to be my-rtmp default-channels channel ref=my-rtmp/ /default-channels When I connect to the mxml file, the page loads ok but without data. (Obviously I have a table in the database with data in it) I have checked all the mappings and they seem to be ok... After trying to add a new record I get the following error: /~~ [FaultEvent fault=[RPC Fault faultString=Send failed faultCode=Client.Error.MessageSend faultDetail=Channel.Connect.Failed error undefined url:'rtmp://localhost:2038'] messageId=AA880209-D7B9-7D8C-EC6E-DC678411A552 type=fault bubbles=false cancelable=true eventPhase=2] \__ The page is viewable at: http://203.55.21.10:7070/testFlex/inventory.mxml Please help me troubleshoot this: I can send/post/attach any files that are needed... -- Luke Vanderfluit Analyst / Web Programmer e3Learning.com.au 08 8221 6422
[flexcoders] flex, hibernate probs
Hi. I need help! Im using flex2 and trying to connect to an existing hibernate back end. Using tomcat5022,hibernate30. I have put all the flex jar files in the WEB-INF/lib of the web app. /~ flex-bootstrap.jar flex-messaging-common.jar flex-messaging.jar flex-messaging-opt.jar flex-messaging-req.jar flex-spring-factory.jar \ I have modified the web.xml file, but had to comment out the MessageBroker Servlet stuff coz it was giving an error on tomcat startup. This is the start of the stack trace with MessageBroker servlet enabled in web.xml: /~ java.lang.NullPointerException at flex.management.BaseControl.getObjectName(BaseControl.java:287) at flex.management.BaseControl.register(BaseControl.java:148) at flex.messaging.MessageBroker.init(MessageBroker.java:146) at flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:84) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3951) \ Im not able to get the connection to the database as yet. ~~~ I am using an mxml file that uses an mx:DataService : mx:DataService id=ds destination=hibernate-product autoCommit=false autoSyncEnabled=false fault=faultHandler(event) conflict=conflictHandler(event)/ The mx:Application has the following attribute: creationComplete=ds.fill(products, 'all.products', []) products is an ArrayCollection: mx:ArrayCollection id=products/ all.products is a named query in hibernate (from the hbm.xml file): query name=all.productsFrom Prod/query (Prod is my entity/dbtable) data-management-config.xml defines the default channels to be my-rtmp default-channels channel ref=my-rtmp/ /default-channels When I connect to the mxml file, the page loads ok but without data. (Obviously I have a table in the database with data in it) I have checked all the mappings and they seem to be ok... After trying to add a new record I get the following error: /~~ [FaultEvent fault=[RPC Fault faultString=Send failed faultCode=Client.Error.MessageSend faultDetail=Channel.Connect.Failed error undefined url:'rtmp://localhost:2038'] messageId=AA880209-D7B9-7D8C-EC6E-DC678411A552 type=fault bubbles=false cancelable=true eventPhase=2] \__ The page is viewable at: http://203.55.21.10:7070/testFlex/inventory.mxml Please help me troubleshoot this: I can send/post/attach any files that are needed... Kind regards. Luke Vanderfluit