[flexcoders] Re: Sideways text

2009-07-28 Thread postwick
In this example, you are not using an embedded font.  Google flex 3 embed 
font and you'll see what we mean.

--- In flexcoders@yahoogroups.com, Gordon Smith gosm...@... wrote:

 Really? When I try
 
 mx:Label x=100 y=100 text=Hello rotation=90 blendMode=layer/
 
 I don't see anything.
 
 Gordon Smith
 Adobe Flex SDK Team
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
 Behalf Of Amy
 Sent: Saturday, July 25, 2009 3:30 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Sideways text
 
 
 
 --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
 Gordon Smith gosmith@ wrote:
 
  If you use an embedded font I think you can rotate Flex 3 text components.
 
  But if you want to use a device font, you would have to develop custom 
  components that use FTE or TLF instead of TextField to render their text, 
  and you'd have to require Flash Player 10. Looking at how Flex 4 implements 
  its new text components would probably be useful if you're going to do this.
 
 I think an easier way is to just set the blendMode on the text component to 
 layer.
 
 -Amy





[flexcoders] Re: how to auto refresh datagrid using httpservice

2009-07-23 Thread postwick
You would use setInterval()

http://blog.flexexamples.com/2008/02/14/creating-timers-using-the-setinterval-method/

However, I recommend looking into LCDS (LiveCycle Data Services).  It does this 
automatically.

--- In flexcoders@yahoogroups.com, Shoukat Ali a.shou...@... wrote:

 this is my mxml file :: 
   
 ---
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
 creationComplete=realData.send()   
   mx:HTTPService id=realData 
 url=http://localhost:8080/real/test.jsp/
   mx:DataGrid x=63 y=53 id=sfssfs 
 dataProvider={realData.lastResult.response.data.row}  
   /mx:DataGrid  
 /mx:Application
 
 
 
 i am using jsp as dataprovider, now i want to refresh the page per 5 seconds, 
 so that the jsp is called per 5 sec. and pull the updated data from database. 
 database is being updated regularly by other application.





[flexcoders] Re: how to auto refresh datagrid using httpservice

2009-07-23 Thread postwick
I should have finished reading that blog post before I sent this.  I guess 
there is a more modern way to do this:

http://livedocs.adobe.com/flex/3/html/help.html?content=08_Dates_and_times_4.html

--- In flexcoders@yahoogroups.com, postwick p...@... wrote:

 You would use setInterval()
 
 http://blog.flexexamples.com/2008/02/14/creating-timers-using-the-setinterval-method/
 
 However, I recommend looking into LCDS (LiveCycle Data Services).  It does 
 this automatically.
 
 --- In flexcoders@yahoogroups.com, Shoukat Ali a.shoukat@ wrote:
 
  this is my mxml file :: 

  ---
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
  creationComplete=realData.send() 
  mx:HTTPService id=realData 
  url=http://localhost:8080/real/test.jsp/
  mx:DataGrid x=63 y=53 id=sfssfs 
  dataProvider={realData.lastResult.response.data.row}  
  /mx:DataGrid  
  /mx:Application
  
  
  
  i am using jsp as dataprovider, now i want to refresh the page per 5 
  seconds, so that the jsp is called per 5 sec. and pull the updated data 
  from database. database is being updated regularly by other application.
 





[flexcoders] Re: Horizontal List - the Images don't appear - help?!

2009-07-23 Thread postwick
You should populate an ArrayCollection or XMLListCollection, and then set that 
collection as the data provider for the horizontal list.

--- In flexcoders@yahoogroups.com, jamiebadman jamie.bad...@... wrote:

 Hi!
 
 I'm trying to display images in a Horizontal List. I receive the url's of the 
 images via a webservice at run time - so can't embed the images. I've tried 
 something like this:
 
 chartList.addItem({label:myLabel, icon:myImageURL});
 
 Where chartList is the dataprovider of the H-List... but this doesn't work - 
 I see the labels but no images.
 
 The url's are definitely correct - I can paste one into a browser and view 
 the image.
 
 Any ideas?
 
 Thanks,
 
 Jamie.





[flexcoders] Re: channel.connect.failed error netconnection.call.badversion Exception

2009-07-23 Thread postwick
It sounds like a generic error that isn't giving you real detail about what the 
true problem is.

This blog post explains how to solve that issue so you can see real info on the 
error.

http://www.5etdemi.com/blog/archives/2005/06/i-did-it-i-killed-netconnectioncallbadversion

--- In flexcoders@yahoogroups.com, b.kotireddy koti_reddy...@... wrote:

 Is some one could help me to start a way to explore this issue please.
 
 
 
 --- In flexcoders@yahoogroups.com, b.kotireddy koti_reddy972@ wrote:
 
  Hi,
  
  I could not able to find the way to solve this error message. We are in
  production now ans some of the users are getting
  Channel.Connection.Failed error NetConnection.Call.BadVersion
  
  We are not using any secure line to access this application.
  We used the flex sdk 3.1.0 version.
  
  The channels we declared in config file are
  channels
 channel ref=long-polling-amf/
 channel ref=polling-amf/
  /channels
  
  Do we need to make any changes to avoid this error message.
  
  I appreciate you response.
  
  Thanks in advance
  Koti
 





[flexcoders] Re: better option than repeater?

2009-07-23 Thread postwick
OK, thanks to the below example, I have made some progress on setting up
my first custom itemRenderer.  Code can be viewed here: 
http://www.ubeek.com/Flex/testrend.mxml

As I mentioned before, my goal is to display a list of Staff.  One of
the fields (moduleAccess) in the Staff record is a list of integers
(i.e.  1,3,17,25).  I have a table that contains a list of modules
(SEQ, MODULENAME).  For each Staff displayed by the List's itemRenderer,
I need to loop through all the modules and output a checkbox...and if
the module's SEQ is in the Staff's moduleAccess list then the box should
be checked.

I tried setting up a remoteObject inside the custom renderer, but no
matter where I put it it gave me a parse error.  I guess it doesn't like
mx:RemoteObject inside a component.  So I put it outside the component,
but then the script function inside the component didn't seem able to
access the RemoteObject's data.  Although it was what I initially tried
to do (with the RO inside the component) I don't really want to do that
as it seems highly inefficient to query the database for every Staff
record.  It seems I should be able to execute the RO just once and then
pass the resulting list of modules to the component so I can loop
through it to output all the checkboxes (and for each record check the
SEQ against the Staff's moduleAccess, which I know how to do).

So the question is - how do call the RO just once and pass the result
into the component (as an ArrayCollection or something) so I can loop
over it repeatedly instead of actually calling it and hitting the
database repeatedly?

Thanks,
Paul


--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 As a quick and dirty...

 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=vertical
  xmlns:custom=Components.*
  mx:Script
  ![CDATA[
  import mx.collections.ArrayCollection;

  [Bindable] private var staffArrColl:ArrayCollection;
  ]]
  /mx:Script
  mx:Repeater id=myStaff dataProvider={staffArrColl}
  custom:CheckBoxComponent id=checkBoxs
 person={Person(myStaff.currentItem)} /
  /mx:Repeater
 /mx:Application

 CheckBoxComponent.mxml:
 ?xml version=1.0 encoding=utf-8?
 mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml;
 creationComplete=onCreationComplete()
  mx:Script
  ![CDATA[
  import ValueObjects.Person;

  public var person:Person;

  private function onCreationComplete():void
  {
  // From person object make a remote object call to
get
 Modules and Queues
  // When remote object calls return, create checkboxes
 appropriately
  }
  ]]
  /mx:Script
 /mx:VBox

 Person.as:
 package ValueObjects
 {
  [RemoteClass(alias=Classes.Testing.Person)]
  [Bindable]
  public class Person
  {
  //instance variables
  private var _name:String;
  private var _id:String;

  //accessor methods
  public function get name():String {return _name;}
  public function get id():String {return _id;}

  //mutator methods
  public function set name(name:String):void {_name = name;}
  public function set id(id:String):void {_id = id;}
  } // end class
 }//end package

 I have not included any remote object calls or result handlers. I'll
 leave that up to you.

 Keep in mind that Flex is object oriented. One of the ideas behind OOP
 is encapsulation. If you can encapsulate all the properties and
methods
 of something and then repeat that, the possibilities are endless.


 HTH



 Steve

 --- In flexcoders@yahoogroups.com, postwick paul@ wrote:
 
  Can you give me a brief example of code that would achieve the part
 where you say create a component?
 
  Keep in mind the number of checkboxes and their labels is not
static.
 There are three tables involved: staff, modules, and queues.  The
 checkboxes are created dynamically from the records returned from the
 modules and queues tables.
 
  --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote:
  
   I use repeaters quite a lot and like them.
  
   What I do is to create a component (Which sometimes contains other
 components) and the repeat that.
  
   In your situation, I would create a component with all of your
check
 boxes and save button. This component would have all of the
 functionality to display which check boxes are selected as well as the
 save button click handler. It would also have a public property that
 would take a data object. On creation complete of this component, it
 would check the values of the data object and set the check boxes
 appropriately.
  
   Then, I would repeat this component passing in the data objects
 returned from the remote object call...
  
   mx:Repeater id=myStaff dataProvider={staffArrColl}
   custom:CheckBoxComponent id=checkBoxs
 person={Person

[flexcoders] Re: better option than repeater?

2009-07-23 Thread postwick
Sorry, link should have been http://www.ubeek.com/Flex/testrend.txt

--- In flexcoders@yahoogroups.com, postwick p...@... wrote:

 OK, thanks to the below example, I have made some progress on setting up
 my first custom itemRenderer.  Code can be viewed here: 
 http://www.ubeek.com/Flex/testrend.mxml
 
 As I mentioned before, my goal is to display a list of Staff.  One of
 the fields (moduleAccess) in the Staff record is a list of integers
 (i.e.  1,3,17,25).  I have a table that contains a list of modules
 (SEQ, MODULENAME).  For each Staff displayed by the List's itemRenderer,
 I need to loop through all the modules and output a checkbox...and if
 the module's SEQ is in the Staff's moduleAccess list then the box should
 be checked.
 
 I tried setting up a remoteObject inside the custom renderer, but no
 matter where I put it it gave me a parse error.  I guess it doesn't like
 mx:RemoteObject inside a component.  So I put it outside the component,
 but then the script function inside the component didn't seem able to
 access the RemoteObject's data.  Although it was what I initially tried
 to do (with the RO inside the component) I don't really want to do that
 as it seems highly inefficient to query the database for every Staff
 record.  It seems I should be able to execute the RO just once and then
 pass the resulting list of modules to the component so I can loop
 through it to output all the checkboxes (and for each record check the
 SEQ against the Staff's moduleAccess, which I know how to do).
 
 So the question is - how do call the RO just once and pass the result
 into the component (as an ArrayCollection or something) so I can loop
 over it repeatedly instead of actually calling it and hitting the
 database repeatedly?
 
 Thanks,
 Paul
 
 
 --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote:
 
  As a quick and dirty...
 
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  layout=vertical
   xmlns:custom=Components.*
   mx:Script
   ![CDATA[
   import mx.collections.ArrayCollection;
 
   [Bindable] private var staffArrColl:ArrayCollection;
   ]]
   /mx:Script
   mx:Repeater id=myStaff dataProvider={staffArrColl}
   custom:CheckBoxComponent id=checkBoxs
  person={Person(myStaff.currentItem)} /
   /mx:Repeater
  /mx:Application
 
  CheckBoxComponent.mxml:
  ?xml version=1.0 encoding=utf-8?
  mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml;
  creationComplete=onCreationComplete()
   mx:Script
   ![CDATA[
   import ValueObjects.Person;
 
   public var person:Person;
 
   private function onCreationComplete():void
   {
   // From person object make a remote object call to
 get
  Modules and Queues
   // When remote object calls return, create checkboxes
  appropriately
   }
   ]]
   /mx:Script
  /mx:VBox
 
  Person.as:
  package ValueObjects
  {
   [RemoteClass(alias=Classes.Testing.Person)]
   [Bindable]
   public class Person
   {
   //instance variables
   private var _name:String;
   private var _id:String;
 
   //accessor methods
   public function get name():String {return _name;}
   public function get id():String {return _id;}
 
   //mutator methods
   public function set name(name:String):void {_name = name;}
   public function set id(id:String):void {_id = id;}
   } // end class
  }//end package
 
  I have not included any remote object calls or result handlers. I'll
  leave that up to you.
 
  Keep in mind that Flex is object oriented. One of the ideas behind OOP
  is encapsulation. If you can encapsulate all the properties and
 methods
  of something and then repeat that, the possibilities are endless.
 
 
  HTH
 
 
 
  Steve
 
  --- In flexcoders@yahoogroups.com, postwick paul@ wrote:
  
   Can you give me a brief example of code that would achieve the part
  where you say create a component?
  
   Keep in mind the number of checkboxes and their labels is not
 static.
  There are three tables involved: staff, modules, and queues.  The
  checkboxes are created dynamically from the records returned from the
  modules and queues tables.
  
   --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote:
   
I use repeaters quite a lot and like them.
   
What I do is to create a component (Which sometimes contains other
  components) and the repeat that.
   
In your situation, I would create a component with all of your
 check
  boxes and save button. This component would have all of the
  functionality to display which check boxes are selected as well as the
  save button click handler. It would also have a public property that
  would take a data object. On creation complete of this component, it
  would check the values of the data object and set

[flexcoders] Re: variables name are in array

2009-07-22 Thread postwick
This is very dangerous, IMO.  It opens you up for getting things misaligned 
and then you have the wrong value in the wrong variable.

Why aren't you storing the variable name AND the value in the same array?

--- In flexcoders@yahoogroups.com, markflex2007 markflex2...@... wrote:

 Hi,
 
 Do you have a idea if I want to assign values in for loop?I already have two 
 arrays(one is for variable names,other is for variable values)
 
 I have many values to assign and I want to assign them in loop.otherwise I 
 have to repeat many same assign statements.
 
 Do you have a idea how to do this.
 
 Thanks
 
 Mark





[flexcoders] Re: Event's cancelable

2009-07-22 Thread postwick
Events propagate through the hierarchy of objects.  If necessary, you can stop 
them (cancel them) once they get to a certain point in the propagation.

http://livedocs.adobe.com/flex/3/html/help.html?content=events_08.html

Specifically, the section on Bubbling answers your question.

--- In flexcoders@yahoogroups.com, markflex2007 markflex2...@... wrote:

 The format for Event constructor like this
 Event(event_type:String, bubbles:Boolean, cancelable:Boolean)
 
 I do not understand what the cancelable used for and how to use  it.
 
 Please give me a idea.
 
 Thanks
 
 
 Mark





[flexcoders] better option than repeater?

2009-07-20 Thread postwick
I don't like repeaters.  They are too clumsy.  The biggest drawback is an 
inability to access values after the repeater has finish executing.  It's not 
the same as, for example, looping over values and generating static HTML using 
ColdFusion.  I seem to always end up having to navigate up and down through the 
parents/children of the objects and storing values I need in properties like 
name, automationName, etc.  This is clumsy and messy.

As an example, I have a section of my application where I want to list the 
names of people from a table, and for each person generate a set of checkboxes 
that designate access to certain areas of the application.  For example: 
http://www.ubeek.com/images/staffrepeater.jpg

That is one main repeater that loops through the staff (records returned from 
remoteObject) and inside that repeater two other repeaters (also from 
remoteObjects) that generate the checkboxes.

I can't simply pass the primary key of the staff for which the Save button was 
clicked, by putting click=saveClick({staffRepeater.currentItem.SEQ}) into the 
button object.  When I do that and click it I get an error about repeater is 
not currently executing or something like that.

I don't want to resort to a datagrid and then click to edit then bring up a 
form kind of process.  I want it as few clicks as possible.

Is there a better way to display data in a custom way like this, without using 
repeaters, so that I can more easily access the child objects and their 
properties?

Thanks,
Paul



[flexcoders] Re: better option than repeater?

2009-07-20 Thread postwick
Can you give me a brief example of code that would achieve the part where you 
say create a component?

Keep in mind the number of checkboxes and their labels is not static.  There 
are three tables involved: staff, modules, and queues.  The checkboxes are 
created dynamically from the records returned from the modules and queues 
tables.

--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 I use repeaters quite a lot and like them.
 
 What I do is to create a component (Which sometimes contains other 
 components) and the repeat that.
 
 In your situation, I would create a component with all of your check boxes 
 and save button. This component would have all of the functionality to 
 display which check boxes are selected as well as the save button click 
 handler. It would also have a public property that would take a data object. 
 On creation complete of this component, it would check the values of the data 
 object and set the check boxes appropriately.
 
 Then, I would repeat this component passing in the data objects returned from 
 the remote object call...
 
 mx:Repeater id=myStaff dataProvider={staffArrColl}
 custom:CheckBoxComponent id=checkBoxs 
 person={Person(myStaff.currentItem)} /
 /mx:Repeater
 
 
 HTH
 
 
 
 Steve
 
 
 --- In flexcoders@yahoogroups.com, postwick paul@ wrote:
 
  I don't like repeaters.  They are too clumsy.  The biggest drawback is an 
  inability to access values after the repeater has finish executing.  It's 
  not the same as, for example, looping over values and generating static 
  HTML using ColdFusion.  I seem to always end up having to navigate up and 
  down through the parents/children of the objects and storing values I need 
  in properties like name, automationName, etc.  This is clumsy and messy.
  
  As an example, I have a section of my application where I want to list the 
  names of people from a table, and for each person generate a set of 
  checkboxes that designate access to certain areas of the application.  For 
  example: http://www.ubeek.com/images/staffrepeater.jpg
  
  That is one main repeater that loops through the staff (records returned 
  from remoteObject) and inside that repeater two other repeaters (also from 
  remoteObjects) that generate the checkboxes.
  
  I can't simply pass the primary key of the staff for which the Save button 
  was clicked, by putting click=saveClick({staffRepeater.currentItem.SEQ}) 
  into the button object.  When I do that and click it I get an error about 
  repeater is not currently executing or something like that.
  
  I don't want to resort to a datagrid and then click to edit then bring up 
  a form kind of process.  I want it as few clicks as possible.
  
  Is there a better way to display data in a custom way like this, without 
  using repeaters, so that I can more easily access the child objects and 
  their properties?
  
  Thanks,
  Paul
 





[flexcoders] Re: better option than repeater?

2009-07-20 Thread postwick
Can you give me a brief example of how you would convert a single repeater with 
two nested repeaters into a List with custom item renderers?

Thanks,
Paul

--- In flexcoders@yahoogroups.com, claudiu ursica the_bran...@... wrote:

 I'd use lists with custom item renderers. Repeaters are killers for 
 perormance even when you tell them to cache children 
 
 C
 
 
 
 
 
 From: valdhor valdhorli...@...
 To: flexcoders@yahoogroups.com
 Sent: Monday, July 20, 2009 9:45:44 PM
 Subject: [flexcoders] Re: better option than repeater?
 
   
 I use repeaters quite a lot and like them.
 
 What I do is to create a component (Which sometimes contains other 
 components) and the repeat that.
 
 In your situation, I would create a component with all of your check boxes 
 and save button. This component would have all of the functionality to 
 display which check boxes are selected as well as the save button click 
 handler. It would also have a public property that would take a data object. 
 On creation complete of this component, it would check the values of the data 
 object and set the check boxes appropriately.
 
 Then, I would repeat this component passing in the data objects returned from 
 the remote object call...
 
 mx:Repeater id=myStaff dataProvider= {staffArrColl} 
 custom:CheckBoxCom ponent id=checkBoxs person={Person( myStaff.currentI 
 tem)} /
 /mx:Repeater
 
 HTH
 
 Steve
 
 --- In flexcod...@yahoogro ups.com, postwick paul@ wrote:
 
  I don't like repeaters.  They are too clumsy.  The biggest drawback is an 
  inability to access values after the repeater has finish executing.  It's 
  not the same as, for example, looping over values and generating static 
  HTML using ColdFusion.  I seem to always end up having to navigate up and 
  down through the parents/children of the objects and storing values I need 
  in properties like name, automationName, etc.  This is clumsy and messy.
  
  As an example, I have a section of my application where I want to list the 
  names of people from a table, and for each person generate a set of 
  checkboxes that designate access to certain areas of the application.  For 
  example: http://www.ubeek. com/images/ staffrepeater. jpg
  
  That is one main repeater that loops through the staff (records returned 
  from remoteObject) and inside that repeater two other repeaters (also from 
  remoteObjects) that generate the checkboxes.
  
  I can't simply pass the primary key of the staff for which the Save button 
  was clicked, by putting click=saveClick( {staffRepeater. currentItem. 
  SEQ}) into the button object.  When I do that and click it I get an error 
  about repeater is not currently executing or something like that.
  
  I don't want to resort to a datagrid and then click to edit then bring up 
  a form kind of process.  I want it as few clicks as possible.
  
  Is there a better way to display data in a custom way like this, without 
  using repeaters, so that I can more easily access the child objects and 
  their properties?
  
  Thanks,
  Paul
 





[flexcoders] Re: better option than repeater?

2009-07-20 Thread postwick
Thanks for the example.  I know that I could make certain things a lot easier 
by setting up classes and components, but I don't have a lot of practice at it. 
 Hopefully this will get me started and I'll get it figured out.  I know it 
would simplify my code - there are many places where I repeat the same kind of 
display, with different data, and so far just write functions that are result 
handlers from remoteobjects and the functions spit out the objects I need and 
addChild them.  At the moment I am a bit mired in the repeat over a recordset 
and spit out code mode of thinking, thanks to years ColdFusion, Perl, asp, 
HTML, etc.

--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 As a quick and dirty...
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=vertical
  xmlns:custom=Components.*
  mx:Script
  ![CDATA[
  import mx.collections.ArrayCollection;
 
  [Bindable] private var staffArrColl:ArrayCollection;
  ]]
  /mx:Script
  mx:Repeater id=myStaff dataProvider={staffArrColl}
  custom:CheckBoxComponent id=checkBoxs
 person={Person(myStaff.currentItem)} /
  /mx:Repeater
 /mx:Application
 
 CheckBoxComponent.mxml:
 ?xml version=1.0 encoding=utf-8?
 mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml;
 creationComplete=onCreationComplete()
  mx:Script
  ![CDATA[
  import ValueObjects.Person;
 
  public var person:Person;
 
  private function onCreationComplete():void
  {
  // From person object make a remote object call to get
 Modules and Queues
  // When remote object calls return, create checkboxes
 appropriately
  }
  ]]
  /mx:Script
 /mx:VBox
 
 Person.as:
 package ValueObjects
 {
  [RemoteClass(alias=Classes.Testing.Person)]
  [Bindable]
  public class Person
  {
  //instance variables
  private var _name:String;
  private var _id:String;
 
  //accessor methods
  public function get name():String {return _name;}
  public function get id():String {return _id;}
 
  //mutator methods
  public function set name(name:String):void {_name = name;}
  public function set id(id:String):void {_id = id;}
  } // end class
 }//end package
 
 I have not included any remote object calls or result handlers. I'll
 leave that up to you.
 
 Keep in mind that Flex is object oriented. One of the ideas behind OOP
 is encapsulation. If you can encapsulate all the properties and methods
 of something and then repeat that, the possibilities are endless.
 
 
 HTH
 
 
 
 Steve
 
 --- In flexcoders@yahoogroups.com, postwick paul@ wrote:
 
  Can you give me a brief example of code that would achieve the part
 where you say create a component?
 
  Keep in mind the number of checkboxes and their labels is not static. 
 There are three tables involved: staff, modules, and queues.  The
 checkboxes are created dynamically from the records returned from the
 modules and queues tables.
 
  --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote:
  
   I use repeaters quite a lot and like them.
  
   What I do is to create a component (Which sometimes contains other
 components) and the repeat that.
  
   In your situation, I would create a component with all of your check
 boxes and save button. This component would have all of the
 functionality to display which check boxes are selected as well as the
 save button click handler. It would also have a public property that
 would take a data object. On creation complete of this component, it
 would check the values of the data object and set the check boxes
 appropriately.
  
   Then, I would repeat this component passing in the data objects
 returned from the remote object call...
  
   mx:Repeater id=myStaff dataProvider={staffArrColl}
   custom:CheckBoxComponent id=checkBoxs
 person={Person(myStaff.currentItem)} /
   /mx:Repeater
  
  
   HTH
  
  
  
   Steve
  
  
   --- In flexcoders@yahoogroups.com, postwick paul@ wrote:
   
I don't like repeaters.  They are too clumsy.  The biggest
 drawback is an inability to access values after the repeater has finish
 executing.  It's not the same as, for example, looping over values and
 generating static HTML using ColdFusion.  I seem to always end up having
 to navigate up and down through the parents/children of the objects and
 storing values I need in properties like name, automationName, etc. 
 This is clumsy and messy.
   
As an example, I have a section of my application where I want to
 list the names of people from a table, and for each person generate a
 set of checkboxes that designate access to certain areas of the
 application.  For example: http://www.ubeek.com/images/staffrepeater.jpg
   
That is one main repeater that loops through the staff (records
 returned from

[flexcoders] Re: Drag and drop

2009-07-20 Thread postwick
I had the same question regarding drag and drop and this is an excellent 
answer.  I would expect it to be a little more automatic to drop an element at 
its dragged-to position rather than having to go through this but it's not that 
complex of a solution.


--- In flexcoders@yahoogroups.com, dingpeng cao caodingp...@... wrote:

 you can do this with a trick:
 when you start drag
 remember the mouseX and mouseY.
 code list this:
 // The mouseMove event handler for the Image control
 // initiates the drag-and-drop operation.
 private function mouseMoveHandler(event:
 
 MouseEvent):void
 {
 var dragInitiator:Image=Image(event.currentTarget);
 var ds:DragSource = new DragSource();
 ds.addData(dragInitiator, img);
 
 var point:Point=new Point(dragInitiator.mouseX,dragInitiator.mouseY);
 ds.addData(point, mouseOffset);
 
 
 DragManager.doDrag(dragInitiator, ds, event);
 }
 and when you drop this target, minus mouseOffset.
 code like this:// The dragDrop event handler for the Canvas container
 // sets the Image control's position by
 // dropping it in its new location.
 private function dragDropHandler(event:DragEvent):void {
 
 var ds:DragSource=event.dragSource;
 var p:Point=ds.dataForFormat(mouseOffset) as Point;
 
 Image(event.dragInitiator).x =Canvas(event.currentTarget).mouseX - p.x;
 Image(event.dragInitiator).y =Canvas(event.currentTarget).mouseY - p.y;
 }
 
 
 On Mon, Jul 20, 2009 at 6:28 PM, kk4Nabble kavya@... wrote:
 
 
 
 
  Hi all, Am new to flex. Was learning with examples given in flex3 livedoc.
 
  http://livedocs.adobe.com/flex/3/html/help.html?content=dragdrop_1.html
 
  There i came across this drag and drop example.
 
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 
  mx:Script
  ![CDATA[
  //Import classes so you don't have to use full names.
  import mx.managers.DragManager;
  import mx.core.DragSource;
  import mx.events.DragEvent;
  import flash.events.MouseEvent;
 
  // Embed icon image.
  [Embed(source='assets/globe.jpg')]
  public var globeImage:Class;
 
  // The mouseMove event handler for the Image control
  // initiates the drag-and-drop operation.
  private function mouseMoveHandler(event:MouseEvent):void
  {
  var dragInitiator:Image=Image(event.currentTarget);
  var ds:DragSource = new DragSource();
  ds.addData(dragInitiator, img);
 
  DragManager.doDrag(dragInitiator, ds, event);
  }
 
 
 and
 
 
 
  // The dragEnter event handler for the Canvas container
  // enables dropping.
  private function dragEnterHandler(event:DragEvent):void {
  if (event.dragSource.hasFormat(img))
  {
  DragManager.acceptDragDrop(Canvas(event.currentTarget));
  }
  }
 
  // The dragDrop event handler for the Canvas container
  // sets the Image control's position by
  // dropping it in its new location.
  private function dragDropHandler(event:DragEvent):void {
  Image(event.dragInitiator).x =
  Canvas(event.currentTarget).mouseX;
  Image(event.dragInitiator).y =
  Canvas(event.currentTarget).mouseY;
  }
  ]]
  /mx:Script
 
  !-- The Canvas is the drag target --
  mx:Canvas id=v1
  width=500 height=500
  borderStyle=solid
  backgroundColor=#DD
  dragEnter=dragEnterHandler(event);
  dragDrop=dragDropHandler(event);
 
  !-- The image is the drag initiator. --
  mx:Image id=myimg
  source=@Embed(source='assets/globe.jpg')
  mouseMove=mouseMoveHandler(event);/
  /mx:Canvas
  /mx:Application
 
  here to set drag initiator , Canvas(event.currentTarget).mouseX;
  this x will be the x during mouse button release .
 
  Instead , I want the x and y of the
  shadow of the image (ie the border of the image). How will i set it?
  Please help.
  --
  View this message in context:
  http://www.nabble.com/Drag-and-drop-tp24567297p24567297.html
  Sent from the FlexCoders mailing list archive at Nabble.com.
 
   
 
 
 
 
 -- 
Dingpeng Cao
 Email:   caodingp...@...





[flexcoders] ColdFusion service restart not picking up new LCDS destinations

2009-07-18 Thread postwick
I added a couple destinations to the data-management-config.xml file and 
restarted ColdFusion.  My Flex app gave an error that the destination was not 
found.  I restarted and tried again, same thing.  Did this a few times and 
nothing.  Then I went in and add a single space to the xml file, restarted the 
service, and it picked up the changes.

Any idea why this would happen?

Also, is there any way to make it so I don't have to restart the CF service in 
order for it to pick up changes to my CFCs?

Thanks,
Paul



[flexcoders] LCDS data service error in IE (but not in Firefox)

2009-07-17 Thread postwick
I have a destination set up and in Firefox and IE all creates, updates, and 
fills work fine.  Delete works fine in Firefox but when I do a delete in 
Internet Explorer I get the following error:

[FaultEvent fault=[RPC Fault faultString=Item with id 
'449F8202-2B8F-C91B-D0B2-8B70B3D940D3' not managed by this service.  Error on 
destination 'DataElementDestination'. faultCode=Local.Call.Failed 
faultDetail=null] messageId=E4CD7ED3-4E49-15B2-542A-8B70B3E9BB71 
type=fault bubbles=false cancelable=true eventPhase=2]


I was only able to find one thread online that mentions this error.

Can anybody give any insight why it would work in Firefox but not IE?  This 
tells me there is something wrong with Flash for IE, because I know the 
server-side elements are correct (since it works with Firefox).

Thanks,
Paul



[flexcoders] Re: look for a actionscript function?

2009-07-16 Thread postwick
Assuming you're doing this in Flex, use a formatter:

http://livedocs.adobe.com/flex/3/html/help.html?content=formatters_4.html

--- In flexcoders@yahoogroups.com, markflex2007 markflex2...@... wrote:

 I have a number 0.3563567,I want to convert it to 0.36,which function can do 
 this?I check Math class at
 http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Math.html
 
 but I can not get right one.
 
 Thanks for your help
 
 Mark





[flexcoders] bind one arraycollection to another

2009-07-16 Thread postwick
I have an arraycollection that has two columns.  the second column actually 
stores an object that has properties on it.  I want to put those values into a 
second datagrid.  Can I do this using binding?  I was able to use a loop to 
fill the second arraycollection, to which a datagrid is bound, by triggering 
the loop function from the first arraycollection's collectionChange event.

However, I don't like this approach because it'll probably cause issues with 
selectedItem on the datagrid (removeAll then repopulate would throw it off), as 
well as a noticeable flicker when dealing with a large dataset.

If there's another format for the second column in the first arraycollection 
that would work better than an object, I'm open to that too.



[flexcoders] Re: bind one arraycollection to another

2009-07-16 Thread postwick
The object is being passed to the first arraycollection through LCDS, and in 
the CFC I am creating a struct.  I have no problem with the idea of converting 
it to another data type such as an XML string.  The problem is I can't bind it 
to one ROW and column, I need to bind it to the second column of all rows - 
basically the first grid is the primary key in column one, and the property 
with all other columns and values in the object.

If I have a row selected in the second grid, or it's sorted or filtered in some 
way, and I do a removeall and then repopulate it...what will happen?  I suppose 
I can store the sort, filter, and selectedIndex, and then reapply them after 
the refill - but I want to avoid any kind of flicker that the user would see.

--- In flexcoders@yahoogroups.com, Tracy Spratt tr...@... wrote:

 You can't use an Object as a dataProvider.  So you either need to loop using
 for-each, or use a different data type for the second column.
 
  
 
 An ArrayCollection might be best,  then you could bind the second DG:
 
 dataProvider={dg1.selectedItem.acCol2}
 
  
 
 Tracy Spratt,
 
 Lariat Services, development services available
 
   _  
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of postwick
 Sent: Thursday, July 16, 2009 5:43 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] bind one arraycollection to another
 
  
 
   
 
 I have an arraycollection that has two columns. the second column actually
 stores an object that has properties on it. I want to put those values into
 a second datagrid. Can I do this using binding? I was able to use a loop to
 fill the second arraycollection, to which a datagrid is bound, by triggering
 the loop function from the first arraycollection's collectionChange event.
 
 However, I don't like this approach because it'll probably cause issues with
 selectedItem on the datagrid (removeAll then repopulate would throw it off),
 as well as a noticeable flicker when dealing with a large dataset.
 
 If there's another format for the second column in the first arraycollection
 that would work better than an object, I'm open to that too.





[flexcoders] Re: create class on the fly

2009-07-15 Thread postwick
I cannot predict at compile-time what the name (or properties) of the class 
will be.  I need to CREATE the class at runtime, AND add the properties to it.  
It seems, so far, that this is not possible.

However, what I'm doing sounds very similar to your project.  It's not so much 
the sheer number of tables (although a few dozen) but the fact that the 
application allows the creation of new tables (so I need a new class) and 
columns (so the properties might change).

I can easily have my app write new destinations to the config file for any new 
table created.  I can even write the necessary CFCs to disk based upon schema 
changes within the app.  But I cannot find a way to get the classes I need.

All tables share the same foreign key column name, which is helpful.  My idea 
is this...set up one class that has two properties - the foreign key and a 
second column.  I would have one destination for each table, but all 
destinations will point to the same class.  When my CFCs pull data, I will have 
them return the primary key along with all other data encoded (XML or 
something) into the second property.  Then on the client side I can manage it 
by filling an ArrayCollection, then having a function that parses the actual 
columns and rows (from the second property) into a second ArrayCollection that 
my datagrid is actually bound to.  Creates/updates would go in the reverse 
direction - placed into the second ArrayCollection and then processed up to the 
two-property format for the first one, at which point LCDS will take over.

As I think through it, this should work.  Thoughts?

--- In flexcoders@yahoogroups.com, wrhinfl wrhi...@... wrote:

 Ok, I think the way your question is worded can cause problems with the 
 answer you get.
 
 If your real question was Can a class be modified during runtime and how?  
 Would this be the same question you are asking?
 
 I searched the ASDocs and found Dynamic Class, which allows you to add 
 variables and functions to an instance of a class.  I created a simple 
 application and uses one AS class twice, creating different variables and 
 functions in the two instances.
 
 The project I am working on is trying to do something very similar where I 
 don't want hundreds of classes to match the hundreds of tables (and would 
 require hundreds of java classes on the server).  
 
 And your question made me do some searching, so let me know if this question 
 and answer are closer to what you are trying to accomplish in your project 
 and I can share my simple code (two files with 70 lines of code, no comments).
 
 --- In flexcoders@yahoogroups.com, postwick paul@ wrote:
 
  I want to store descriptions of classes in an external file (such as XML) 
  or database, and use them in my Flex application such that I can add, 
  remove, or change the classes in the external file with recompling the Flex 
  application.
  
  Is there any way to do this?  In a nutshell, is there a way to create a 
  class through an Actionscript function, with a for loop where the 
  information that is looped over contains the definitions of the classes 
  loaded from an external source?
 





[flexcoders] Re: create class on the fly

2009-07-15 Thread postwick
Thanks for pointing me in the right direction.  I had no idea how well passing 
Flex Objects and CF Structures back-and-forth works.  It's so simple, and CF 
Structures are fast.  At the moment it displays object [Object] in the grid :-) 
but I'm able to bind a form to the properties of the object in that grid 
column, which is pretty cool.

I'm a couple small steps away from having the complete solution I have been 
looking for: using LCDS with multiple tables but only ONE generic class.

Here's a bonus question.  Within a data service can you have subtopics like 
you can have for messaging services?  If so, then I'd be able to get away with 
having only one destination.  Otherwise, I'll need a destination for every 
table, but that's not such a big deal.

--- In flexcoders@yahoogroups.com, jer_ela g...@... wrote:

 Just have your cfc return the results as a query, or as an array of structs.  
 The first will be converted into an ArrayCollection of generic objects in 
 Flex, and the second into an Array of objects.  Each of these objects will 
 have a property for each column in the record.  
 
 Flex will be quite happy with these object and will let you do pretty much 
 anything you want to do with them.
 
 You can use 
 
 for (var key:String in recordObject) 
 
 to get the property names.  Since your queries are going to be dynamic you 
 are going to have to process them dynamically and this is how you do it.
 
 You could also have your cfc return metadata about the result set, to tell 
 you which properties are the primary keys, and anything else you need to know 
 about the result to process it correctly.
 
 Having the server return objects that automatically get converted to typed 
 flex objects is great when you know what type of objects are going to be 
 returned.  But if you don't Flex can handle untyped dynamic objects just 
 fine, and you should use them when the results of a service can't be known at 
 compile time.
 
 --- In flexcoders@yahoogroups.com, postwick paul@ wrote:
 
  I cannot predict at compile-time what the name (or properties) of the class 
  will be.  I need to CREATE the class at runtime, AND add the properties to 
  it.  It seems, so far, that this is not possible.
  
  However, what I'm doing sounds very similar to your project.  It's not so 
  much the sheer number of tables (although a few dozen) but the fact that 
  the application allows the creation of new tables (so I need a new class) 
  and columns (so the properties might change).
  
  I can easily have my app write new destinations to the config file for any 
  new table created.  I can even write the necessary CFCs to disk based upon 
  schema changes within the app.  But I cannot find a way to get the classes 
  I need.
  
  All tables share the same foreign key column name, which is helpful.  My 
  idea is this...set up one class that has two properties - the foreign key 
  and a second column.  I would have one destination for each table, but all 
  destinations will point to the same class.  When my CFCs pull data, I will 
  have them return the primary key along with all other data encoded (XML or 
  something) into the second property.  Then on the client side I can manage 
  it by filling an ArrayCollection, then having a function that parses the 
  actual columns and rows (from the second property) into a second 
  ArrayCollection that my datagrid is actually bound to.  Creates/updates 
  would go in the reverse direction - placed into the second ArrayCollection 
  and then processed up to the two-property format for the first one, at 
  which point LCDS will take over.
  
  As I think through it, this should work.  Thoughts?
  
  --- In flexcoders@yahoogroups.com, wrhinfl wrhinfl@ wrote:
  
   Ok, I think the way your question is worded can cause problems with the 
   answer you get.
   
   If your real question was Can a class be modified during runtime and 
   how?  Would this be the same question you are asking?
   
   I searched the ASDocs and found Dynamic Class, which allows you to add 
   variables and functions to an instance of a class.  I created a simple 
   application and uses one AS class twice, creating different variables and 
   functions in the two instances.
   
   The project I am working on is trying to do something very similar where 
   I don't want hundreds of classes to match the hundreds of tables (and 
   would require hundreds of java classes on the server).  
   
   And your question made me do some searching, so let me know if this 
   question and answer are closer to what you are trying to accomplish in 
   your project and I can share my simple code (two files with 70 lines of 
   code, no comments).
   
   --- In flexcoders@yahoogroups.com, postwick paul@ wrote:
   
I want to store descriptions of classes in an external file (such as 
XML) or database, and use them in my Flex application such that I can 
add, remove, or change the classes in the external file

[flexcoders] Re: create class on the fly

2009-07-14 Thread postwick
If I compile the class as a module, can I then load it in without having to 
statically reference it in my compiled code?  I can predict the package name 
based on data from my database ie com.something.somethingelse etc.  Then I 
could compile new classes as needed and load them.

--- In flexcoders@yahoogroups.com, Alan Shaw noden...@... wrote:

 There are a number of important techniques for manipulating classes (as 
 detailed
 in my post http://nodename.com/blog/2008/06/15/upon-reflection/ ), but
 unfortunately
 creating a class at runtime is not possible in AS3.
 
 On Mon, Jul 13, 2009 at 8:23 PM, postwickp...@... wrote:
 
 
  I want to store descriptions of classes in an external file (such as XML) or
  database, and use them in my Flex application such that I can add, remove,
  or change the classes in the external file with recompling the Flex
  application.
 
  Is there any way to do this? In a nutshell, is there a way to create a class
  through an Actionscript function, with a for loop where the information that
  is looped over contains the definitions of the classes loaded from an
  external source?
 
 





[flexcoders] Re: create class on the fly

2009-07-14 Thread postwick
From your blog post...

var myClass:Class = getDefinitionByName(com.myDomain.myPackage.SomeClass);


Does this mean I don't have to create the class as a .as file and compile it 
into the SWF, I can just reference it this way?  Then I could add a new class 
to myPackage and tell my app (via db, XML, etc) that there is a new class there 
to load?

The point to all of this is a dynamic application where an end user can add 
their own tables, and I need classes for those objects so that I can pass them 
back and forth with data messaging. 


--- In flexcoders@yahoogroups.com, Alan Shaw noden...@... wrote:

 There are a number of important techniques for manipulating classes (as 
 detailed
 in my post http://nodename.com/blog/2008/06/15/upon-reflection/ ), but
 unfortunately
 creating a class at runtime is not possible in AS3.
 
 On Mon, Jul 13, 2009 at 8:23 PM, postwickp...@... wrote:
 
 
  I want to store descriptions of classes in an external file (such as XML) or
  database, and use them in my Flex application such that I can add, remove,
  or change the classes in the external file with recompling the Flex
  application.
 
  Is there any way to do this? In a nutshell, is there a way to create a class
  through an Actionscript function, with a for loop where the information that
  is looped over contains the definitions of the classes loaded from an
  external source?
 
 





[flexcoders] Re: create class on the fly

2009-07-14 Thread postwick
Yeah, I saw your post in my hours of Googling last night.  Seems very 
promising.  The idea is to have a database table that stores a list of classes 
and their properties, and instantiate them at runtime without having to 
recompile the app - so that if a new class is added to the db my app can use it 
on the fly.

Would your method of using Modules solve this?  It appears so, but I haven't 
had a chance to try it out. In your post you say:

This setup is very flexible because I can return both instances and classes 
from the Module.

Can you give me an example of how you would return a Class?

--- In flexcoders@yahoogroups.com, ag_rcuren robert.vancuren...@... wrote:

 This might help you, its a little something I wrote a little while ago.
 
 http://flexinonroids.wordpress.com/2009/05/27/flex-3-dynamically-loading-components-at-runtime/
 
 
 --- In flexcoders@yahoogroups.com, postwick paul@ wrote:
 
  If I compile the class as a module, can I then load it in without having to 
  statically reference it in my compiled code?  I can predict the package 
  name based on data from my database ie com.something.somethingelse etc.  
  Then I could compile new classes as needed and load them.
  
  --- In flexcoders@yahoogroups.com, Alan Shaw nodename@ wrote:
  
   There are a number of important techniques for manipulating classes (as 
   detailed
   in my post http://nodename.com/blog/2008/06/15/upon-reflection/ ), but
   unfortunately
   creating a class at runtime is not possible in AS3.
   
   On Mon, Jul 13, 2009 at 8:23 PM, postwickpaul@ wrote:
   
   
I want to store descriptions of classes in an external file (such as 
XML) or
database, and use them in my Flex application such that I can add, 
remove,
or change the classes in the external file with recompling the Flex
application.
   
Is there any way to do this? In a nutshell, is there a way to create a 
class
through an Actionscript function, with a for loop where the information 
that
is looped over contains the definitions of the classes loaded from an
external source?
   
   
  
 





[flexcoders] Re: create class on the fly

2009-07-14 Thread postwick
Thanks for everyone's help.  I think this points me in the right direction.

Of course, if there's a way to successfully use data messaging without 
instantiating classes...that would eliminate my need to do this.  But I don't 
think there is...

--- In flexcoders@yahoogroups.com, ag_rcuren robert.vancuren...@... wrote:

 Yes you could create the class and build it into an RSL. Once the RSL is 
 loaded you can just reference it by name. When you add or make changes you 
 just need to rebuild the RSL or push a new RSL out and have a way for your 
 app to know whats available.
 
 I found it easier to use Modules, because they are easier to build. I have 
 examples of both RSL and Modules on that blog both have source enabled so you 
 can take a look.
 
 I have an app that lets users pick and choose widgets they want and I load 
 only the components they want into the app via a config file. When ever I 
 want to add new components I just publish a new module and update my database 
 so my apps knows about it.
 
 --- In flexcoders@yahoogroups.com, postwick paul@ wrote:
 
  From your blog post...
  
  var myClass:Class = getDefinitionByName(com.myDomain.myPackage.SomeClass);
  
  
  Does this mean I don't have to create the class as a .as file and compile 
  it into the SWF, I can just reference it this way?  Then I could add a new 
  class to myPackage and tell my app (via db, XML, etc) that there is a new 
  class there to load?
  
  The point to all of this is a dynamic application where an end user can add 
  their own tables, and I need classes for those objects so that I can pass 
  them back and forth with data messaging. 
  
  
  --- In flexcoders@yahoogroups.com, Alan Shaw nodename@ wrote:
  
   There are a number of important techniques for manipulating classes (as 
   detailed
   in my post http://nodename.com/blog/2008/06/15/upon-reflection/ ), but
   unfortunately
   creating a class at runtime is not possible in AS3.
   
   On Mon, Jul 13, 2009 at 8:23 PM, postwickpaul@ wrote:
   
   
I want to store descriptions of classes in an external file (such as 
XML) or
database, and use them in my Flex application such that I can add, 
remove,
or change the classes in the external file with recompling the Flex
application.
   
Is there any way to do this? In a nutshell, is there a way to create a 
class
through an Actionscript function, with a for loop where the information 
that
is looped over contains the definitions of the classes loaded from an
external source?
   
   
  
 





[flexcoders] Re: Livecycle DS with Flex Questions

2009-07-14 Thread postwick
1 - as far as I know, it doesn't care what app it is.  if you're subscribed to 
that data service, that's all that matters.

2 - yes.  I get to go back to the drawing board on about 40% of my app because 
I just learned how to use the data service...and everything so far is 
remoteobjects.  but it's going to make life S much easier.

3 - here is a great tutorial: 
http://www.adobe.com/devnet/coldfusion/articles/data_app.html

--- In flexcoders@yahoogroups.com, Wally Kolcz wko...@... wrote:

 I am trying to get into using LiveCycle DS with my Flex app. I have a couple 
 question for anyone who uses it and understands it.
 
 1.) If I were to have 2 seperate applications (swfs, client / admin) that 
 both subscribe to the same destination, when a change is made (say a admin 
 adds a records) would the client be notified of the change or doe it all have 
 to be a single application? My site has 2 Flex application in different 
 folders. I would like the changes to be reflected on the public's application 
 if the admins make a change.
 
 2.) I have used RemoteObject extensively with my CFC's to push data to my 
 application. Does DataService replace RemoteObject by connecting to my CFCs 
 and using them to connect to my SQL server?
 
 3.) Does anyone know a good tutorial on how to create a destination in the  
 data-management-config.xml file to point to a CFC?
 
 Thanks!





[flexcoders] LCDS without a class for every table?

2009-07-14 Thread postwick
OK, so I was the one looking for a way to do classes at runtime.  The bottom 
line is I want to use LCDS because it's, well, fantastic.  However, in my app I 
cannot know at compile time all the tables (and columns in them) that will need 
to be accessed.

Is there a way to use one single class which has a property on which I attach 
an object that contains the properties I need (probably in XML format) based on 
the table that should be updated, then modify the CFCs so that they extract the 
data, create/update/delete the correct table, and then pass the necessary 
information back to LCDS so that it pushes the update out to the clients?

On the datagrid side, instead of binding the grid to an ArrayCollection, I 
could bind it to a function that parses the XML property on the returned 
ArrayCollection and returns a new ArrayCollection (or populates a second one) 
with the correct data for the grid.

Does this sound reasonable and doable?  Is there any other way to use LCDS 
without having a class for every single table?

Thanks,
Paul



[flexcoders] create class on the fly

2009-07-13 Thread postwick
I want to store descriptions of classes in an external file (such as XML) or 
database, and use them in my Flex application such that I can add, remove, or 
change the classes in the external file with recompling the Flex application.

Is there any way to do this?  In a nutshell, is there a way to create a class 
through an Actionscript function, with a for loop where the information that is 
looped over contains the definitions of the classes loaded from an external 
source?



[flexcoders] Re: Error: Unknown Property: 'constructor'. when using LCDS

2009-07-12 Thread postwick
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...

2009-07-12 Thread postwick
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] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread postwick
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...

2009-07-12 Thread postwick
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...

2009-07-12 Thread postwick
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...

2009-07-12 Thread postwick
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...

2009-07-12 Thread postwick
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...

2009-07-12 Thread postwick
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