Re: [flexcoders] Re: Populate ComboBox from database - NOT using Flex Data Services

2007-03-03 Thread Steve Gustafson

First you need to change your mx:RemoteObject to

mx:RemoteObject id=jobSvc destination=ColdFusion source=path.to.cfc
showBusyCursor=true
   mx:method name=GetJob  result=getJobResult(event)/
/mx:RemoteObject

Then add a result handler:
private function getJobResult(event:Object):void
{
   jobNameCB.dataProvider = event.result as ArrayCollection;
}


Steve
On 3/2/07, April [EMAIL PROTECTED] wrote:


  Thank you very much for this response. I think this is still a bit over
my head at this point
(I have only done tutorials, and none of the tutorials interact with a
database the way I will
be) but I will give it a stab and see what I can do with it.

I was looking at an article on Ben Forta's blog (
http://www.forta.com/blog/index.cfm?
mode=eentry=1786) and following his example I did this... only it doesn't
work:

I'm very very new to Flash and we are using ColdFusion but are not using
Flex Data
Services. I've been trying to figure out how to populate a combobox from a
database and
I'm just not having any luck.

My project is called PreTraffic. I have my main file as JobSearch.mxml
and a folder
under the root named cfc with a file called job.cfc.

job.cfc contains the following code:

cfcomponent

!--- Get jobs ---
cffunction name=GetJob access=remote returntype=query
output=false

cfset var job=
cfset var results=

cfquery datasource=discsdev name=job
SELECT job_id, job_title
FROM job
WHERE status = 'O'
ORDER BY job_title
/cfquery
cfquery dbtype=query name=results
SELECT job_title AS label, job_id AS data
FROM job
ORDER BY label
/cfquery

cfreturn results

/cffunction

/cfcomponent

And JobSearch.mxml has the following code:

?xml version=1.0 encoding=utf-8?
mx:Application
xmlns:mx=http://www.adobe.com/2006/mxml;
xmlns=*
layout=absolute
backgroundGradientColors=[#ff, #d0d0d0]
creationComplete=InitApp()

mx:Style source=style.css /

mx:Script
![CDATA[

public function InitApp():void {
jobSvc.GetJob();
}
]]
/mx:Script

!-- ColdFusion CFC (via AMF) --
mx:RemoteObject id=jobSvc destination=PreTraffic
showBusyCursor=true /

mx:VBox label=Job History width=100% height=100% x=10 y=92
mx:Label text=Search jobs by/
mx:Form label=Task width=100%
mx:FormItem label=Job Name:
mx:ComboBox id=jobNameCB dataProvider={jobSvc.GetJob.results}/
mx:ComboBox
/mx:FormItem
/mx:Form
mx:HBox
mx:Button label=Search/
mx:Button label=Clear/
/mx:HBox

/mx:VBox
/mx:Application

My Compiler thingy points to:
-services /Volumes/flexwwwroot/WEB-INF/flex/job-services-config.xml
-locale en_US

and job-services-config.xml contains the following code:

destination id=PreTraffic
channels
channel ref=my-cfamf/
/channels
properties
sourceflex.pretraffic.cfc.job/source
lowercase-keystrue/lowercase-keys
/properties
/destination

Well, when I run the app... the combobox is not populated... Can anyone
help with what
I've done wrong?

Thanks!

 



[flexcoders] Struggling with itemRenderer in DataGrid

2007-02-28 Thread Steve Gustafson

Help.

I'm trying to use an itemRenderer to create a comboBox in a DataGrid that is
being created with AS.

I can create the comboBox, but I am struggling with being able to change the
dataProvider for the rendered comboBox, and setting the selected index on
the comboBox.

The relevant code I am using is below.

Any help is GREATLY APPRECIATED as I am rapidly approaching a deadline.

Steve

public function createPositionTable():void
{
   _datagrid = positionsGrid;  // positionsGrid is an already created
DataGrid object
   _col1 = new DataGridColumn;
   _col2 = new DataGridColumn;
   _col3 = new DataGridColumn;
   _col4 = new DataGridColumn;
   _col5 = new DataGridColumn;

   _col1.headerText= Position;
   _col1.dataField = Description;
   _col1.editable = true;
   _col1.width = 100;

   _col2.dataField = Type;
   _col2.headerText= Type;
   _col2.editable = true;
   _col2.width = 50;

   _col3.dataField = levelCode;
   _col3.headerText = Level Code;
   _col3.width = 150;
   _col3.editable = false;
   _col3.itemRenderer = new ClassFactory(cbRender);  // HERE IS WHERE I AM
CREATING THE COMBO BOX
   _col3.editorDataField = levelCode;


   _columns = new Array(_col1,_col2,_col3);

   _datagrid.columns = _columns
   _datagrid.sortableColumns = false;
   _datagrid.dataProvider = objAdminTableGridDP;
   _datagrid.dragEnabled = false;
   _datagrid.dragMoveEnabled = false;
   _datagrid.dropEnabled = false;
   _datagrid.editable = true;
   _datagrid.rowHeight = 30;
   updateTablesButton.label = 'Update Positions Table';
}


cbRender.mxml

?xml version=1.0 encoding=utf-8?
mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml; width=50 height=25

mx:Script
   ![CDATA[
   import mx.utils.ObjectUtil;
   [Bindable]
   public var myLevels:Array =
   [{label:Accounting, data:accounting},
   {label: Administator, data:1},
   {label:Programmer, data:2},
   {label:Vice President, data:3},
   {label:President, data:4},];

   public var cboLevelID:String = '';

   public function get setLevel():String {
   return cboLevels.selectedItem.data;
   }
   ]]
/mx:Script
   mx:ComboBox id=cboLevels dataProvider={myFolders}/
/mx:VBox


[flexcoders] Help modifying Cache-Control setting

2006-12-03 Thread Steve Gustafson

I've run into an issue were fields are acting strangely in IE after being
populated via remoting.  I can't click anywhere on a text field to get a
cursor into the text field, there is just a very small 'hit area' in the
middle of the text fields.  This only happens in IE and only after
populating with a remoting call to a ColdFusion/JRun back-end.

I've been told there is an issue with IIS and the Cache-Control header, and
the setting needs to be changed.

I have changed the setting in IIS so now when I hit the directory with a
browser I get the following headers:

HTTP/1.1 200 OK
Cache-Control: no-cache, must-revalidate,no-cache
Content-Length: 3
Content-Type: text/html
Content-Location: http://192.1168.52.9/hr/model/test.html
Last-Modified: Fri, 01 Dec 2006 10:36:32 GMT
Accept-Ranges: bytes
ETag: 301b39913415c71:1ac9
Server: Microsoft-IIS/6.0
Date: Fri, 01 Dec 2006 10:37:21 GMT
Connection: close

However when I make a remoting call to the same directory the headers I get
are:

HTTP/1.1 200 OK
Connection: close
Date: Fri, 01 Dec 2006 10:37:50 GMT
Server: Microsoft-IIS/6.0
Set-Cookie: CFID=707;expires=Sun, 23-Nov-2036 10:37:50 GMT;path=/
Set-Cookie:
CFTOKEN=370e1048ea054ef2-3D976BA3-C293-CA84-B8ED78331616B8FC;expires=Sun,
23-Nov-2036 10:37:50 GMT;path=/
Expires: Sat, 25 Dec 1999 00:00:00 GMT
Cache-Control: no-cache
Content-Type: application/x-amf
Content-Length: 4803


Notice the difference in the Cache-Control.

I suspect the header is being set by CFMX/JRun and not IIS for the remoting
call, but I have not found a way to change the setting in CFMX/JRun for
remoting calls.

Any help would be greatly appreciated.

Thanks,
Gus

PS.  I know I can use a CFHEADER tag in a regular ColdFusion page, but I
don't believe can do this with a remoting call.


[flexcoders] Rotatation works with Label but not Button

2006-08-22 Thread Steve Gustafson



In the following code sample, the mx:Label rotates exactly as it should, the text displays vertically. However in the mx:Button, the button rotates but the text disappears.I have not found any work-arounds for displaying vertical buttons in buttons, tabNavigators or tabBars. 
Any help would be appreciated. ?xml version=1.0 encoding=utf-8?mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 layout=absolute fontFamily=Arialmx:Style @font-face {   font-family: flip;  src:url(resources/verdana.ttf); }  .mystyle1 {
 fontFamily:flip;  fontSize: 15pt; }/mx:Style mx:Label id =lbl1 styleName=mystyle1 text=This Rotates Fine rotation=90 x=100 y=100/
 mx:Button id=btnHistory x=381 y=74 label=History styleName=mystyle1 rotation=90//mx:ApplicationThanks,Steve Gustafson


__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



[flexcoders] Vertical TabNavigator or TabBar - Take 2

2006-08-18 Thread Steve Gustafson



I posted this a few days ago but got no response, so I'm trying again:It seems like this should be easy, but so far I am not making much progress.I am looking to create a tabNavigator or tabBar with a 90 degree rotation.
I've tried using embedded fonts but when I do the rotation the text does not show.
Any help is appreciated.Steve



__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



[flexcoders] Vertical TabNavigator or TabBar

2006-08-16 Thread Steve Gustafson



It seems like this should be easy, but so far I am not making much progress.I am looking to create a tabNavigator or tabBar with a 90 degree rotation.I've tried using embedded fonts but when I do the rotation the text does not show.
Any help is appreciated.Steve

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] Changing orientation of labels on chart

2006-08-11 Thread Steve Gustafson



Thanks Brendan, that did the trick!SteveOn 8/11/06, Brendan Meutzner [EMAIL PROTECTED] wrote:













  



Hey Steve,mx:Style@font-face {fontFamily: labelFont;src:url(../resources/arial.ttf);
}BarChart{fontFamily: labelFont;}/mx:Stylemx:Bar
Chart dataProvider={expenses} showDataTips=truemx:horizontalAxisRenderermx:AxisRenderer label
Rotation=45//mx:horizontalAxisRenderermx:verticalAxisRenderermx:AxisRenderer 
labelRotation=45//mx:verticalAxisRenderer
.../mx:BarChartThe trick is... you have to use an embedded font as the example above shows... if not, no dice...
BrendanOn 8/11/06, 
Steve Gustafson [EMAIL PROTECTED] wrote:














  



Hi,I am looking to change the orientation of labels on a Column chart. Basically I want to be able to render the label vertically instead of horizontally. A real bonus would be to render the label text on an angle.
I can do this with the chart component in ColdFusion, so I assume there is a way to do it with Flex.As always, any help is appreciated.Steve

  















  















__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



[flexcoders] Re: Search Flex2 LiveDocs Bookmarklet

2006-08-10 Thread Steve Gustafson



Oops.It occurred to me that saving the bookmarklet from some peoples email program may not work, so I put up a quick webpage that should work for anyone. You should be able to test and load the Flex2 LiveDocs search bookmarklet from the link below.
http://www.jaxfusion.org/gus/flexbookmarklet.htmlGusOn 8/10/06, Steve Gustafson
 [EMAIL PROTECTED] wrote:
Greetings,I've created a bookmarklet that uses Google to search the Flex 2 Live Docs. I find this to be the fastest way to deal with Live Docs.Firefox users:Right click this link, and save as a bookmark. I keep mine on my bookmarks toolbar for quick access.
IE Users:Right click this link, click Add To Favorites, you will get a security alert, Click Yes. Again, I keep mine on the links toolbar for quick access.
Search Flex Live DocsYou can click the link to test it.I hope some of you find this useful.Gus



__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



[flexcoders] Search Flex2 LiveDocs Bookmarklet

2006-08-10 Thread Steve Gustafson



Greetings,I've created a bookmarklet that uses Google to search the Flex 2 Live Docs. I find this to be the fastest way to deal with Live Docs.Firefox users:Right click this link, and save as a bookmark. I keep mine on my bookmarks toolbar for quick access.
IE Users:Right click this link, click Add To Favorites, you will get a security alert, Click Yes. Again, I keep mine on the links toolbar for quick access.
Search Flex Live DocsYou can click the link to test it.I hope some of you find this useful.Gus

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] Re: Search Flex2 LiveDocs Bookmarklet

2006-08-10 Thread Steve Gustafson



Hey Paul,I did see that. I thought I'd make the bookmarklet available so non-firefox users had an option too. SteveOn 8/10/06, Paul BH
 [EMAIL PROTECTED] wrote:












  



hi steve - dunno if you saw my post about a similar thing yesterday - lets you search livedocs  flexcoders at the same time...
http://www.eyefodder.com/blog/2006/08/finding_flex_facts_faster.shtml
now if I could only get livedocs pages to load quicker...On 8/10/06, Steve Gustafson 
[EMAIL PROTECTED]
 wrote:












  



Oops.It occurred to me that saving the bookmarklet from some peoples email program may not work, so I put up a quick webpage that should work for anyone. You should be able to test and load the Flex2 LiveDocs search bookmarklet from the link below.
http://www.jaxfusion.org/gus/flexbookmarklet.htmlGus

On 8/10/06, Steve Gustafson
 [EMAIL PROTECTED] wrote:


Greetings,I've created a bookmarklet that uses Google to search the Flex 2 Live Docs. I find this to be the fastest way to deal with Live Docs.Firefox users:Right click this link, and save as a bookmark. I keep mine on my bookmarks toolbar for quick access.
IE Users:Right click this link, click Add To Favorites, you will get a security alert, Click Yes. Again, I keep mine on the links toolbar for quick access.
Search Flex Live DocsYou can click the link to test it.I hope some of you find this useful.Gus



  















  















__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] Excel Export

2006-06-14 Thread Steve Gustafson



Jim,What I mean by true Excel files is a binary file that is native to Excel. Not a delimited text file, or HTML file that Excel can open.The difference is that by generating a true Excel file with POI-HSSF, you have the ability to:
create multiple worksheetssplit and freeze panesdraw shapesoutliningset the data format of cellsmerge cellsset print areacolor cells and text
use formulasreference other cells and worksheets etc. etc. etc. Some of this can be done with HTML, but not all.Using CFCONTENT does not generate a binary Excel file, it simply sets the MIME type to application/msexcel but the file is still a text file that is either delimited or HTML.
This may be more than the original poster was looking to do, and in many cases a CSV or HTML file is adequate, however POI-HSSF brings a whole 'nother level of power to using server data with Excel.Here is a link to 
Busy Develepors Guide to HSSF FeaturesGusOn 6/13/06, Jim Robson 
[EMAIL PROTECTED] wrote:








  











Steve,



Not sure what you mean by "true"
Excel files, but CF does natively provide the ability to generate .xls files
using the cfcontent tag:




http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentationfile=part_cfm.htm



-Jim



__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] Excel Export

2006-06-13 Thread Steve Gustafson



The Time Tracker application is not really exporting to excel. it is just saving HTML with a .xls extension.ColdFusion does not have a native way of generating true Excel files either.As far as I know, the two ways to create native excel files on the server side is using COM, or POI-HSSF.
POI-HSSF is part of the Apache-Jakarta project, open source, and plays nicely with ColdFusion MX or any other J2EE server.Check it out here: POI-HSSF
GusOn 6/12/06, vestcomprogrammer [EMAIL PROTECTED] wrote:









  



Does anyone know how to export to excel, like they do on the 
timetracker application on the showcase page on 
http://labs.adobe.com/showcase/.

Thanks
Bill


  















__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] Sleep function in ActionScript?

2006-05-31 Thread Steve Gustafson



Sho has a 3 part post on how to handle async events. Here is the link to part 1http://kuwamoto.org/2006/05/16/dealing-with-asynchronous-events-part-1/
Gus






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  









[flexcoders] Release Dates?

2006-05-16 Thread Steve Gustafson



Has Adobe given any indications on when FlexBuilder and Flash 9 will be released?I'm starting a project for a client and Flex is the right tool... but it has to be out of beta to give to the client.Any insights would be helpful.
Thanks.






--
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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  









[flexcoders] FB2B3 programmatically select an item in a ComboBox

2006-05-15 Thread Steve Gustafson



Greetings and thanks in advance for your help!I have a ComboBox that displays a countries. The label is a country Name The data is a country codeI then retrieve a users record via AMF. Standard stuff with First Name, Last Name etc.
I am populating various fields with the retrieved data, which is working fine.Where I am stuck is on the country ComboBox. I want to select the appropriate country for the user.I expected something like this to work:
for(var i:Number = 0; i  cboCountry.length; i++) { if(cboCountry.getItemAt(i).data == event.result.COUNTRY)  { cboCountry.selectedIndex = i; break; }
}I have yet to figure out how to loop through the ComboBox to match the users country. Or if I even need to run a loop in FB2B3.This has got to be a very common task, yet I am not finding any decent info on an approach.
Any help is greatly appreciated.Steve






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  









Re: [flexcoders] FB2B3 programmatically select an item in a ComboBox

2006-05-15 Thread Steve Gustafson



That solved it! The key is using the dataProvider.length instead of the ComboBox .lengthI shortened the code block a little to:for(var i:Number = 0; i  cboCountry.dataProvider.length; i++){
 if (cboCountry.dataProvider.getItemAt(i).data == event.result.COUNTRY) {  cboCountry.selectedIndex = i;  break; }}Thanks for the help!Steve
On 5/15/06, jeremy lu [EMAIL PROTECTED] wrote:




well, I believe all the getItemAt() methods are removed from List-base components like Combobox, List, DataGrid in F2B3.

to do the loop correctly, try this:

for(var i:Number = 0; i  cboCountry.dataProvider.length; i++) 
{
 var itm:* = cboCountry.dataProvider.getItemAt(i);

 if( itm.data == event.result.COUNTRY ) 
 {
 cboCountry.selectedIndex = i;
 break;
 }

}On 5/16/06, Simeon Bateman [EMAIL PROTECTED]
 wrote:

Well I dont know exactly what is wrong, but using flex builder it would
be pretty easy to set a break point on the if line of code and then
step through the loop to ensure that those to variables are what you
think they should be.
I use a mac and so my solution is to just use an alert to pop up the 2 items each loop so I can compare them.Give it a look, you might find that the two don't actually match up.The
other thing, is that if you are doing this on a tabnavigator or
accordian and the page you are setting has not yet been drawn then the
items wont get selected even if they match. If this is the case
you might have to look into the creationPolicy for the parent, to
ensure the children are all created before you try to set properties on
them.
Hope that helps.simeonOn 5/15/06, Steve Gustafson
 [EMAIL PROTECTED] wrote:



Greetings and thanks in advance for your help!I have a ComboBox that displays a countries. The label is a country Name The data is a country codeI then retrieve a users record via AMF. Standard stuff with First Name, Last Name etc.
I am populating various fields with the retrieved data, which is working fine.Where I am stuck is on the country ComboBox. I want to select the appropriate country for the user.I expected something like this to work:
for(var i:Number = 0; i  cboCountry.length; i++) { if(cboCountry.getItemAt(i).data == event.result.COUNTRY)  { cboCountry.selectedIndex = i; break; }



}I
have yet to figure out how to loop through the ComboBox to match the
users country. Or if I even need to run a loop in FB2B3.This has got to be a very common task, yet I am not finding any decent info on an approach.
Any help is greatly appreciated.Steve






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt



Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com











  
  
SPONSORED LINKS
  
  
  




Web site design development
  
  



Computer software development
  
  



Software design and development
  
  





Macromedia flex
  
  



Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group flexcoders on the web.



  To unsubscribe from this group, send an email to:


[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service


.



  















--
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



  Visit your group flexcoders on the web.

  To unsubscribe from this group, send an email to:

[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
.




  















--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt

Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com









  
  
SPONSORED LINKS
  
  
  


Web site design development
  
  

Computer software development
  
  

Software design and development
  
  



Macromedia flex
  
  

Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group flexcoders on the web.

  To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
.



  















--
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



  Visit your group "flexcoders" on the web.
  To unsubs