RE: [flexcoders] Catching graphics update on UIComponent
Try calling validateNow() before taking the snapshot Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of richmcgillicuddy Sent: Saturday, July 11, 2009 6:53 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Catching graphics update on UIComponent I have a UIComponent that is a component made up of a label and a background image. I am running a loop to update the component, change the label and copy the resulting bitmap to a standard image. My result is that I get the image without any updates. The add function just pushes the counter of the label up 1 and updates the .text field of the label. The code looks like... I know invalidatedisplaylist just adds a flag to a future update but how should this be built. var curX :int = 10; var curY : int = 70; var anImage : Image; var imageBitmapData:BitmapData ; while (curY this.height) { bbMain.add(1); if (curX this.width) { curX += 60; } else { curY += 60; curX = 10; } this.invalidateDisplayList(); // Copy into new image anImage = new Image(); anImage.width = 54 anImage.height = 54; anImage.x = curX; anImage.y = curY; this.addChild(anImage); imageBitmapData = ImageSnapshot.captureBitmapData(bbMain); anImage.source = new Bitmap(imageBitmapData); }
Re: [flexcoders] newbie question : putting a semicolon in a mxml property
Not if there is just a single line of script within the quotation marks. If you wanted to do something like this though, mx:Button label=some label click=t1.text = t2.text; doSomethingElse(); t3.visible = false; / Then you do need the semi-colons. Most people just have the semi-colon there out of habit from when they write AS in .as files or within the mx:Script tags (they are needed in those cases). 2009/7/12 ew6014 ew6...@yahoo.com: hi guys i was reading the flex documentation and i noticed a ; inside a mxml property let me give you an example mx:Button label=some label click=t1.text = t2.text; / ive tried removing the semicolon ; and also tried leaving it there and there was no error of any kind. so im just wondering if this will cause issues or is something going on that i do not know thank you guys in advance -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] flash button in flex issue
I got another problem. In flex I can only reference the flash button by its ID property. Most of the time I can't know its ID. I need cover it to a super class like MovieClip Instead of that. How can I fix this ? mx:Script ![CDATA[ private function clickHandler(event:MouseEvent):void { /* not work */ MovieClip(event.target).gotoAndPlay(MovieClip(event.target).currentLabel); /* only this way can run */ query.gotoAndPlay(query.currentLabel); } ]] /mx:Script local:intergratedQueryButton id=query click=clickHandler(event) x=305 y=500/
[flexcoders] Re: This is not as easy as it seems ... apparently...
I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In flexcoders@yahoogroups.com, Craig cra...@... wrote: I am trying to access the value of a DataGridColumn and change the DataField for another column based on this value... Here is my code: ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=getDp() ... Datagrid mx:columns mx:DataGridColumn dataField=Ticker headerText=Ticker/ mx:DataGridColumn id=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd / mx:DataGridColumn id=Profit headerText=Profit/ ActionScript: private function getDp():void { if(Application.application.CnvPos.dgOrdExt.selectedItem.Kind==LONG)Pro\ \ fit.dataField=Profit;Application.application.CnvPos.dgOrdExt.refresh()\ \ ; } //This code works find if I use if(Kind.DataField=Kind)Profit.dataField=Profit; //above to test the rest of the code. I can not figure out how to access the value of the Datagridcolumn. I have tied using event listeners, etc.. which did not work. Please let me know if anyone can help this fairly simple dilemma.
[flexcoders] flash component in flex issue
I got another problem. In flex I can only reference the flash button by its ID property. Most of the time I can't know its ID. I need cover it to a super class like MovieClip Instead of that. How can I fix this ? mx:Script ![CDATA[ private function clickHandler(event:MouseEvent):void { /* not work */ MovieClip(event.target).gotoAndPlay(MovieClip(event.target).currentLabel); /* only this way can run */ query.gotoAndPlay(query.currentLabel); } ]] /mx:Script local:intergratedQueryButton id=query click=clickHandler(event) x=305 y=500/ 200万种商品,最低价格,疯狂诱惑你
[flexcoders] Re: Error: Unknown Property: 'constructor'. when using LCDS
I realize this is an old thread I'm digging up, but I am running into the same problem. I did the artists example from : http://www.adobe.com/devnet/coldfusion/articles/data_app.html The grid fills just fine but when I try to edit a cell I get: Error: Unknown Property: 'constructor' I looked around online and found others getting this error but no solutions. Thanks, Paul --- In flexcoders@yahoogroups.com, Jeff Vroom jvr...@... wrote: Do you know ActionScript your objects from CF land are getting converted to?Typically they come across as Objects unless you are mapping a strong type in which case you need to mark those classes with [Managed]. This appears to be something which does not extend Object - like maybe XML? If you can't tell, adding mx:TraceTarget/ in MXML and using the debug player you can get a flashlog.txt which should have that information (feel free to send that to me directly offlist). We use the constructor property in some cases to determine which class we are dealing with but there are other ways we could do that. Jeff From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Alexander Tsoukias Sent: Saturday, March 29, 2008 9:53 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Error: Unknown Property: 'constructor'. when using LCDS The fill method works great using RTMP and it fills a datagrid. When i make the datagrid editable and change a value, It returns this error: Error: Unknown Property: 'constructor'. The backend is connected with coldfusion CFCs. Again the fill method works great. Thanks, Alexander
[flexcoders] Re: This is not as easy as it seems ... apparently...
You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig cra...@... wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to access the value of a DataGridColumn and change the DataField for another column based on this value... Here is my code: ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=getDp() ... Datagrid mx:columns mx:DataGridColumn dataField=Ticker headerText=Ticker/ mx:DataGridColumn id=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd / mx:DataGridColumn id=Profit headerText=Profit/ ActionScript: private function getDp():void { if(Application.application.CnvPos.dgOrdExt.selectedItem.Kind==LONG)Pro\ \ fit.dataField=Profit;Application.application.CnvPos.dgOrdExt.refresh()\ \ ; } //This code works find if I use if(Kind.DataField=Kind)Profit.dataField=Profit; //above to test the rest of the code. I can not figure out how to access the value of the Datagridcolumn. I have tied using event listeners, etc.. which did not work. Please let me know if anyone can help this fairly simple dilemma.
[flexcoders] Image control reports wrong size
My app needs to display an image inside a VBox, with content auto-scaled to fit the width of its container, and the VBox height adjusted to accommodate its children. The problem arises when the loaded image has content width VBox width, i.e., when the image content is scaled to fit --VBox appears to be using he original, unscaled height of the image, rather than its scaled-down height, so I end up with extra whitespace below the image. Similar behavior when I put the image in a Canvas, so it's not the container, but the image that is reporting incorrect height after scaling. I've posted an example to demonstrate the issue, at: http://data.uniontrib.com/ScaleTest/ (view source enabled). I came up with an unsightly work-around that computes the proper height of the image once it has loaded and scaled, and assigns this to a bindable var that sets the height of the image... e.g.: mx:VBox id=myVb width=100 mx:Image id=myImg scaleContent=true source=fx.jpg width=100% height={properHeight} complete=computeProperHeight()/ /mx:VBox ... [Bindable] private var properHeight:Number; // run on complete of image load private function computeProperHeight():void { properHeight = (myImg.width/myImg.contentWidth)*myImg.contentHeight; } If anybody has a better idea, I'd love to hear it.
RE: [flexcoders] BrowserManager not working
Hi. Thanks for your response. After some more troubleshooting the problem is the following: the URL is returned correctly by the following code: import mx.managers.BrowserManager; import mx.managers.IBrowserManager; import mx.utils.URLUtil; import mx.utils.ObjectUtil; private var bman:IBrowserManager; private var url1:String; bman = BrowserManager.getInstance(); bman.init(); url1 = URLUtil.getServerNameWithPort(bman.url); trace(url1); but then I do this: if (true) { var u:URLRequest = new URLRequest(url1); navigateToURL(u,_self); } Basically I want to reload the original URL on certain conditions. This time when the page loads the bman instance is null. So the URLRequest object does not contain the information that BrowserManager needs. Would this be to do with the request headers...? How can I solve this...? Thanks Kr. Luke Vanderfluit Avid Flex Fan! Alex Harui wrote: Compare with the examples. You're not calling init() and you may need to add an event listener as well. Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of edencane Sent: Thursday, July 09, 2009 1:30 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] BrowserManager not working Hi. I want to get the information of the current URL This is my code. It aint workin'. What 'm I doing wrong? ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=init() mx:Script ![CDATA[ import mx.managers.BrowserManager; import mx.utils.URLUtil; import mx.controls.Alert; import mx.rpc.events.ResultEvent; import mx.collections.ArrayCollection; import mx.managers.IBrowserManager; import mx.utils.URLUtil; [Bindable] private var bman:IBrowserManager; [Bindable] private var foogie:String = bar; private function init():void { bman = BrowserManager.getInstance(); //bman.init(); trace(BMAN + bman); var baseURL:String = bman.base; var url:String = bman.url; bman.setTitle(foogoie); var fullURL:String = mx.utils.URLUtil.getFullURL(url, url); trace (BASEURL + baseURL + URL + fullURL); } ]] /mx:Script mx:Text id=foo x=94 y=97 text={bman.url}/ /mx:Application -- View this message in context: http://www.nabble.com/BrowserManager-not-working-tp24406204p24406204.html Sent from the FlexCoders mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/BrowserManager-not-working-tp24406204p24454477.html Sent from the FlexCoders mailing list archive at Nabble.com.
[flexcoders] Re: This is not as easy as it seems ... apparently...
Is there a particular row you want to update? If a row is selected, you would use... Profit.selectedItem[datafieldname] --- In flexcoders@yahoogroups.com, Craig cra...@... wrote: From within the custom component DataGrid Column I tried this code as you suggested at the initialize event but it errors: if(Application.application.CnvPos.dgOrdExt.selectedItem[Kind]==LONG) Profit.dataField=Profit; I don't think the selecteditem field is the answer. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to access the value of a DataGridColumn and change the DataField for another column based on this value... Here is my code: ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=getDp() ... Datagrid mx:columns mx:DataGridColumn dataField=Ticker headerText=Ticker/ mx:DataGridColumn id=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd / mx:DataGridColumn id=Profit headerText=Profit/ ActionScript: private function getDp():void { if(Application.application.CnvPos.dgOrdExt.selectedItem.Kind==LONG)Pro\ \ fit.dataField=Profit;Application.application.CnvPos.dgOrdExt.refresh()\ \ ; } //This code works find if I use if(Kind.DataField=Kind)Profit.dataField=Profit;
[flexcoders] Re: This is not as easy as it seems ... apparently...
Not sure why you have all the Application.application stuff on there. Just reference the datagrid by it's id. mx:DataGrid id=mygrid mygrid.selectedItem[columname] = some value --- In flexcoders@yahoogroups.com, Craig cra...@... wrote: From within the custom component DataGrid Column I tried this code as you suggested at the initialize event but it errors: if(Application.application.CnvPos.dgOrdExt.selectedItem[Kind]==LONG) Profit.dataField=Profit; I don't think the selecteditem field is the answer. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to access the value of a DataGridColumn and change the DataField for another column based on this value... Here is my code: ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=getDp() ... Datagrid mx:columns mx:DataGridColumn dataField=Ticker headerText=Ticker/ mx:DataGridColumn id=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd / mx:DataGridColumn id=Profit headerText=Profit/ ActionScript: private function getDp():void { if(Application.application.CnvPos.dgOrdExt.selectedItem.Kind==LONG)Pro\ \ fit.dataField=Profit;Application.application.CnvPos.dgOrdExt.refresh()\ \ ; } //This code works find if I use
[flexcoders] Re: This is not as easy as it seems ... apparently...
so if it's doing it row by row, then it would need to be a labelfunction event right? where would you suggest the code go? there needs to be an if (datagrid.seleteditem[Kind]==LONG)datagrid.selecteditem[Profit]=Profit; then another line that stipulate the other option: if (datagrid.selecteditem[Kind]==Short)datagrid.selecteditem[Profit]=ShProfit; --- In flexcoders@yahoogroups.com, postwick p...@... wrote: if you just did dataGrid.selectedItem then that would be the selected row. add [columnname] to get to the column, so: dataGrid.selectedItem[columnname] it's not the label, it's the data column name. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to access the value of a DataGridColumn and change the DataField for another column based on this value... Here is my code: ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=getDp() ... Datagrid mx:columns mx:DataGridColumn dataField=Ticker headerText=Ticker/ mx:DataGridColumn id=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd / mx:DataGridColumn id=Profit headerText=Profit/ ActionScript: private function getDp():void { if(Application.application.CnvPos.dgOrdExt.selectedItem.Kind==LONG)Pro\ \ fit.dataField=Profit;Application.application.CnvPos.dgOrdExt.refresh()\ \ ;
[flexcoders] Re: This is not as easy as it seems ... apparently...
cause I was doing it within the custom component (column) itself for the datagrid, which can not hold an Id value, I can put it in the parent component however i'll give that a whack. --- In flexcoders@yahoogroups.com, postwick p...@... wrote: Not sure why you have all the Application.application stuff on there. Just reference the datagrid by it's id. mx:DataGrid id=mygrid mygrid.selectedItem[columname] = some value --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: From within the custom component DataGrid Column I tried this code as you suggested at the initialize event but it errors: if(Application.application.CnvPos.dgOrdExt.selectedItem[Kind]==LONG) Profit.dataField=Profit; I don't think the selecteditem field is the answer. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to access the value of a DataGridColumn and change the DataField for another column based on this value... Here is my code: ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=getDp() ... Datagrid mx:columns mx:DataGridColumn dataField=Ticker headerText=Ticker/ mx:DataGridColumn id=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd /
[flexcoders] Re: This is not as easy as it seems ... apparently...
I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick p...@... wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to access the value of a DataGridColumn and change the DataField for another column based on this value... Here is my code: ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=getDp() ... Datagrid mx:columns mx:DataGridColumn dataField=Ticker headerText=Ticker/ mx:DataGridColumn id=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd / mx:DataGridColumn id=Profit headerText=Profit/ ActionScript: private function getDp():void { if(Application.application.CnvPos.dgOrdExt.selectedItem.Kind==LONG)Pro\ \ fit.dataField=Profit;Application.application.CnvPos.dgOrdExt.refresh()\ \ ; } //This code works find if I use if(Kind.DataField=Kind)Profit.dataField=Profit; //above to test the rest of the code. I can not figure out how to access the value of the Datagridcolumn. I have tied using event listeners, etc.. which did not work. Please let me know if anyone can help this fairly simple dilemma.
[flexcoders] Re: This is not as easy as it seems ... apparently...
if you just did dataGrid.selectedItem then that would be the selected row. add [columnname] to get to the column, so: dataGrid.selectedItem[columnname] it's not the label, it's the data column name. --- In flexcoders@yahoogroups.com, Craig cra...@... wrote: yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to access the value of a DataGridColumn and change the DataField for another column based on this value... Here is my code: ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=getDp() ... Datagrid mx:columns mx:DataGridColumn dataField=Ticker headerText=Ticker/ mx:DataGridColumn id=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd / mx:DataGridColumn id=Profit headerText=Profit/ ActionScript: private function getDp():void { if(Application.application.CnvPos.dgOrdExt.selectedItem.Kind==LONG)Pro\ \ fit.dataField=Profit;Application.application.CnvPos.dgOrdExt.refresh()\ \ ; } //This code works find if I use if(Kind.DataField=Kind)Profit.dataField=Profit; //above to test the rest of the code. I can not figure out how to access the value of the Datagridcolumn. I have tied using event listeners, etc.. which did not work. Please let me know if anyone can help this fairly simple dilemma.
[flexcoders] Re: This is not as easy as it seems ... apparently...
From within the custom component DataGrid Column I tried this code as you suggested at the initialize event but it errors: if(Application.application.CnvPos.dgOrdExt.selectedItem[Kind]==LONG) Profit.dataField=Profit; I don't think the selecteditem field is the answer. --- In flexcoders@yahoogroups.com, Craig cra...@... wrote: yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to access the value of a DataGridColumn and change the DataField for another column based on this value... Here is my code: ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=getDp() ... Datagrid mx:columns mx:DataGridColumn dataField=Ticker headerText=Ticker/ mx:DataGridColumn id=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd / mx:DataGridColumn id=Profit headerText=Profit/ ActionScript: private function getDp():void { if(Application.application.CnvPos.dgOrdExt.selectedItem.Kind==LONG)Pro\ \ fit.dataField=Profit;Application.application.CnvPos.dgOrdExt.refresh()\ \ ; } //This code works find if I use if(Kind.DataField=Kind)Profit.dataField=Profit; //above to test the rest of the code. I can not figure out how to access the value of the Datagridcolumn. I have tied using event listeners, etc.. which did not work. Please let me know if anyone can help this fairly simple dilemma.
[flexcoders] Trying to change Flex 3 ToggleButtonBar dataprovider on user or admin log in
Hi all,i'm trying to change Flex 3 ToggleButtonBar dataprovider on user or admin log in..I'm trying to use 2 viewstack,one for user,one for admin and i got a component where the login form is in the component..What should i do to define the dataprovider on the mainbased on user log in??Thanks a lot...
[flexcoders] Re: This is not as easy as it seems ... apparently...
Ok... In the parent component to the datagrid I used an initialize event: public function initDg():void { if(dgOrdExt.selectedItem[Kind]==LONG)dgOrdExt.Profit.dataField=Profit; if(dgOrdExt.selectedItem[Kind]==SHORT)dgOrdExt.Profit.dataField=ShProfit; } it does not work. but if I replace the code with dgOrdExt.dataField=Profit; which just sets the dataField without referencing the other column the code is all working... I also tried creationcomplete event and that did not work either. --- In flexcoders@yahoogroups.com, Craig cra...@... wrote: cause I was doing it within the custom component (column) itself for the datagrid, which can not hold an Id value, I can put it in the parent component however i'll give that a whack. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Not sure why you have all the Application.application stuff on there. Just reference the datagrid by it's id. mx:DataGrid id=mygrid mygrid.selectedItem[columname] = some value --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: From within the custom component DataGrid Column I tried this code as you suggested at the initialize event but it errors: if(Application.application.CnvPos.dgOrdExt.selectedItem[Kind]==LONG) Profit.dataField=Profit; I don't think the selecteditem field is the answer. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In
[flexcoders] Re: This is not as easy as it seems ... apparently...
You can't use selectedItem because there is no selectedItem. You haven't clicked a row. Try looping through the grid. In the end, I really don't understand why you don't do this in the dataCollection, or even in the source data. for (var i:Number = 0; i mygrid.numChildren; i++) { if (mygrid.getChildAt(i)[Kind] == LONG) { mygrid.getChildAt(i)[Profit] = Profit; } else { mygrid.getChildAt(i)[Profit] = ShProfit; } --- In flexcoders@yahoogroups.com, Craig cra...@... wrote: Ok... In the parent component to the datagrid I used an initialize event: public function initDg():void{ if(dgOrdExt.selectedItem[Kind]==LONG)dgOrdExt.Profit.dataField=Profit; if(dgOrdExt.selectedItem[Kind]==SHORT)dgOrdExt.Profit.dataField=ShProfit; } it does not work. but if I replace the code with dgOrdExt.dataField=Profit; which just sets the dataField without referencing the other column the code is all working... I also tried creationcomplete event and that did not work either. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: cause I was doing it within the custom component (column) itself for the datagrid, which can not hold an Id value, I can put it in the parent component however i'll give that a whack. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Not sure why you have all the Application.application stuff on there. Just reference the datagrid by it's id. mx:DataGrid id=mygrid mygrid.selectedItem[columname] = some value --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: From within the custom component DataGrid Column I tried this code as you suggested at the initialize event but it errors: if(Application.application.CnvPos.dgOrdExt.selectedItem[Kind]==LONG) Profit.dataField=Profit; I don't think the selecteditem field is the answer. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import
[flexcoders] Re: This is not as easy as it seems ... apparently...
Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig cra...@... wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to access the value of a DataGridColumn and change the DataField for another column based on this value... Here is my code: ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=getDp() ... Datagrid mx:columns mx:DataGridColumn dataField=Ticker headerText=Ticker/ mx:DataGridColumn id=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd / mx:DataGridColumn id=Profit headerText=Profit/ ActionScript: private function getDp():void { if(Application.application.CnvPos.dgOrdExt.selectedItem.Kind==LONG)Pro\ \ fit.dataField=Profit;Application.application.CnvPos.dgOrdExt.refresh()\ \ ; } //This code works find if I use if(Kind.DataField=Kind)Profit.dataField=Profit; //above to test the rest of the code. I can not figure out how to access the value of the Datagridcolumn. I have tied using event listeners, etc.. which did not work. Please let me know if anyone can help this fairly simple dilemma.
[flexcoders] Re: This is not as easy as it seems ... apparently...
yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick p...@... wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd/ positions:ProfitColumn id=Profit headerText=Profit/ mx:Script ![CDATA[ import mx.collections.ArrayCollection; import com.steury.baseClasses.*; import mx.core.Application; import mx.controls.dataGridClasses.DataGridListData; import flash.events.Event; import mx.core.ClassFactory; import com.steury.controls.positions.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; private function initTA():String { if (value[Kind.dataField]==LONG)Profit.dataField=Profit; if (value[Kind.dataField]==SHORT)Profit.dataField=ShProfit; Profit.itemRenderer=new ClassFactory(com.steury.baseClasses.CellFieldInt); return myDec.format(Profit)+%; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to access the value of a DataGridColumn and change the DataField for another column based on this value... Here is my code: ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; creationComplete=getDp() ... Datagrid mx:columns mx:DataGridColumn dataField=Ticker headerText=Ticker/ mx:DataGridColumn id=Kind dataField=Kind itemRenderer=com.steury.baseClasses.CellFieldTrd / mx:DataGridColumn id=Profit headerText=Profit/ ActionScript: private function getDp():void { if(Application.application.CnvPos.dgOrdExt.selectedItem.Kind==LONG)Pro\ \ fit.dataField=Profit;Application.application.CnvPos.dgOrdExt.refresh()\ \ ; } //This code works find if I use if(Kind.DataField=Kind)Profit.dataField=Profit; //above to test the rest of the code. I can not figure out how to access the value of the Datagridcolumn. I have tied using event listeners, etc.. which did not work. Please let me know if anyone can help this fairly simple dilemma.
[flexcoders] Re: This is not as easy as it seems ... apparently...
now we're getting somewhere! but will this update the value of the col2 or the value of col2 DataField? I am trying to change the value of col2 DataField to Profit not the value of col2 itself. Can I use: dgOrdExt.getChildAt(i)[Profit].dataField = Profit CS --- In flexcoders@yahoogroups.com, postwick p...@... wrote: You can't use selectedItem because there is no selectedItem. You haven't clicked a row. Try looping through the grid. In the end, I really don't understand why you don't do this in the dataCollection, or even in the source data. for (var i:Number = 0; i mygrid.numChildren; i++) { if (mygrid.getChildAt(i)[Kind] == LONG) { mygrid.getChildAt(i)[Profit] = Profit; } else { mygrid.getChildAt(i)[Profit] = ShProfit; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: Ok... In the parent component to the datagrid I used an initialize event: public function initDg():void { if(dgOrdExt.selectedItem[Kind]==LONG)dgOrdExt.Profit.dataField=Profit; if(dgOrdExt.selectedItem[Kind]==SHORT)dgOrdExt.Profit.dataField=ShProfit; } it does not work. but if I replace the code with dgOrdExt.dataField=Profit; which just sets the dataField without referencing the other column the code is all working... I also tried creationcomplete event and that did not work either. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: cause I was doing it within the custom component (column) itself for the datagrid, which can not hold an Id value, I can put it in the parent component however i'll give that a whack. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Not sure why you have all the Application.application stuff on there. Just reference the datagrid by it's id. mx:DataGrid id=mygrid mygrid.selectedItem[columname] = some value --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: From within the custom component DataGrid Column I tried this code as you suggested at the initialize event but it errors: if(Application.application.CnvPos.dgOrdExt.selectedItem[Kind]==LONG) Profit.dataField=Profit; I don't think the selecteditem field is the answer. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than others, but comparing values in a DataGrid is obviously impossible. Somehow I need the code to access ArrayCollection getItemat() but I can't do it! Please help! mx:DataGrid xmlns:mx=http://www.adobe.com/2006/mxml; initialize=initTA() positions:KindColumn id=Kind headerText=Kind dataField=Kind
[flexcoders] Re: This is not as easy as it seems ... apparently...
That'll update the value of the cell. You can't do what you're trying to do. You can't have a column with a different dataField per row. The dataField for the column is the same for every row. Is this data coming from a database, through a view? You really should do this there. You can set up a view column with an if/then that returns the column's value you want. --- In flexcoders@yahoogroups.com, Craig cra...@... wrote: now we're getting somewhere! but will this update the value of the col2 or the value of col2 DataField? I am trying to change the value of col2 DataField to Profit not the value of col2 itself. Can I use: dgOrdExt.getChildAt(i)[Profit].dataField = Profit CS --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You can't use selectedItem because there is no selectedItem. You haven't clicked a row. Try looping through the grid. In the end, I really don't understand why you don't do this in the dataCollection, or even in the source data. for (var i:Number = 0; i mygrid.numChildren; i++) { if (mygrid.getChildAt(i)[Kind] == LONG) { mygrid.getChildAt(i)[Profit] = Profit; } else { mygrid.getChildAt(i)[Profit] = ShProfit; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: Ok... In the parent component to the datagrid I used an initialize event: public function initDg():void{ if(dgOrdExt.selectedItem[Kind]==LONG)dgOrdExt.Profit.dataField=Profit; if(dgOrdExt.selectedItem[Kind]==SHORT)dgOrdExt.Profit.dataField=ShProfit; } it does not work. but if I replace the code with dgOrdExt.dataField=Profit; which just sets the dataField without referencing the other column the code is all working... I also tried creationcomplete event and that did not work either. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: cause I was doing it within the custom component (column) itself for the datagrid, which can not hold an Id value, I can put it in the parent component however i'll give that a whack. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Not sure why you have all the Application.application stuff on there. Just reference the datagrid by it's id. mx:DataGrid id=mygrid mygrid.selectedItem[columname] = some value --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: From within the custom component DataGrid Column I tried this code as you suggested at the initialize event but it errors: if(Application.application.CnvPos.dgOrdExt.selectedItem[Kind]==LONG) Profit.dataField=Profit; I don't think the selecteditem field is the answer. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or SHORT'). Here is where I'm at. I've tried putting code into customer DataGridColumns and labelFunctions and ItemRenderers... but can not do it. What seem to be working most are events in the DataGrid Component, better than
[flexcoders] Re: This is not as easy as it seems ... apparently...
--- In flexcoders@yahoogroups.com, postwick p...@... wrote: thank you, sir... I appreciate your help, I shall do as you say !! Craig That'll update the value of the cell. You can't do what you're trying to do. You can't have a column with a different dataField per row. The dataField for the column is the same for every row. Is this data coming from a database, through a view? You really should do this there. You can set up a view column with an if/then that returns the column's value you want. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: now we're getting somewhere! but will this update the value of the col2 or the value of col2 DataField? I am trying to change the value of col2 DataField to Profit not the value of col2 itself. Can I use: dgOrdExt.getChildAt(i)[Profit].dataField = Profit CS --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You can't use selectedItem because there is no selectedItem. You haven't clicked a row. Try looping through the grid. In the end, I really don't understand why you don't do this in the dataCollection, or even in the source data. for (var i:Number = 0; i mygrid.numChildren; i++) { if (mygrid.getChildAt(i)[Kind] == LONG) { mygrid.getChildAt(i)[Profit] = Profit; } else { mygrid.getChildAt(i)[Profit] = ShProfit; } --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: Ok... In the parent component to the datagrid I used an initialize event: public function initDg():void { if(dgOrdExt.selectedItem[Kind]==LONG)dgOrdExt.Profit.dataField=Profit; if(dgOrdExt.selectedItem[Kind]==SHORT)dgOrdExt.Profit.dataField=ShProfit; } it does not work. but if I replace the code with dgOrdExt.dataField=Profit; which just sets the dataField without referencing the other column the code is all working... I also tried creationcomplete event and that did not work either. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: cause I was doing it within the custom component (column) itself for the datagrid, which can not hold an Id value, I can put it in the parent component however i'll give that a whack. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Not sure why you have all the Application.application stuff on there. Just reference the datagrid by it's id. mx:DataGrid id=mygrid mygrid.selectedItem[columname] = some value --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: From within the custom component DataGrid Column I tried this code as you suggested at the initialize event but it errors: if(Application.application.CnvPos.dgOrdExt.selectedItem[Kind]==LONG) Profit.dataField=Profit; I don't think the selecteditem field is the answer. --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: yes the datagrid is bound to an array collection. I don't want to select any item, I want to change the value of a column's DataField to a one of two values based on the value of another column's output. I don't want to have to 'selecteditem' but I can try that code below are you suggesting that I use it in the labelfunction of the datagrid column that I am trying to change? --- In flexcoders@yahoogroups.com, postwick paul@ wrote: Is the datagrid bound to a collection? if so, change the value in the collection. or try... yourDataGrid.selectedItem[dataColumn1] = yourDataGrid.selectedItem[dataColumn2] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I am trying to set the value of a column based on the value of another column. If I use ...selectedItem... it does not work, unless I am mistaken. --- In flexcoders@yahoogroups.com, postwick paul@ wrote: You access the value in a column of a datagrid like this... yourDataGrid.selectedItem[dataColumnNameOfColumn] --- In flexcoders@yahoogroups.com, Craig craigj@ wrote: I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to an ArrayCollection. I need to change the value of one columen (Profit) based on the value of another column (Kind) ie.. the results (either 'LONG' or
[flexcoders] Loading External wysiwyg editor
Hey All, I have been playing with some options to try and get a better editor to work in Flex. As we all know, the RTE that comes as a standard control in Flex is a but limited, and I thought to try and get one of the javascript based editors to load. Does anyone know if it is possible to load lets say TinyMCE into a Flex app? If not, is anyone aware of a way to extend the functionality of the supplied Flex RTE to allow for additoinal html formatting? Thanks! Jonathan