Re: [flexcoders] Problems With my XML Created Array Collection

2010-04-19 Thread Robert Moss
We had the same issue, and in our case it was an easy fix.  When we read in the 
XML it was returning as an ArrayCollection as long as there were multiple 
nodes.  As you have found, if it was only one node it returned as a generic 
object not an ArrayCollection.  We were already looping through the 
ArrayCollection to populate value objects that we were using to populate our 
list.  So before the loop we added, if xmlObject is an ArrayCollection than 
loop else populate VO with returned data.  Worked without issues ever since.

Robert






From: thomas parquier mailingli...@web-attitude.fr
To: flexcoders@yahoogroups.com
Sent: Mon, April 19, 2010 9:27:13 AM
Subject: Re: [flexcoders] Problems With my XML Created Array Collection

  
what about xmllistcollection ?;

---
thomas parquier
http://www.web- attitude. fr/realisations/
msn : thomas.parquier@ web-attitude. fr
softphone : sip:webattitude@ ekiga.net
téléphone portable : +33601 822 056



2010/4/19 James garymoorcroft_ i...@yahoo. co.uk
















  


 
  
 
In my app I have an array collection which populates a tilelist. This array 
collection is populated by a remote xml file via a http request. Problem is if 
the xml only has 1 or no nodes I get a null object reference error. I know 
this is a known problem but I've never been able to find a valid solution for 
it which could be applied to my code. I've heard of looping through the xml to 
create an array collection or using xmllist collection but I don't know how 
these can be done whilst still allowing the data to be displayed in the 
tilelist. Can anyone help me out please?

The code for my httpservice, array collcection I'm trying to make and the 
result of the http service and the tilelist it populates is shown below. As I 
say this all works fine as long as the xml has more than 1 node but causes 
the error if it doesn't:-

mx:HTTPService id=LinksService result=linksResultHandler( event) 
resultFormat=object method=POST url=http://www.coolvisi ontest.com/ 
getlinks. php/

mx:Script
  ![CDATA[

  import mx.rpc.events. ResultEvent;
  import mx.collections. ArrayCollection;

  [Bindable] private var LinksFullAC: ArrayCollection;

  private function linksResultHandler( event:ResultEven t):void
  {
  LinksFullAC= LinksService. lastResult. categories. 
 category as ArrayCollection;
  }


  ]]
/mx:Script

mx:TileList id=linkChoice  dataProvider={LinksFullAC} height=365 
width=665/

Here's my xml structure:-

categories
 category
  id/id 
  label/label 
  icon/icon 
 /category
/categories

Obviously I need the array collection to be populated by id, label and icon.

Thanks for any suggestions.



 


  

Re: [flexcoders] Re: Problems With my XML Created Array Collection

2010-04-19 Thread Robert Moss
This is not exactly how I would implement, but you should get the idea.  If you 
have multiple category nodes, then your 
LinksService.lastResult.categories.category is returned as an ArrayCollection 
and your code works.  If it only has one node then 
LinksService.lastResult.categories.category is returned as an ObjectProxy.  So 
in your return method you could have the following.

if(LinksService.lastResult.categories.category is ArrayCollection){
 LinksFullAC=LinksService.lastResult.categories.category as 
ArrayCollection;
 }else
 {
 var oCat:Object = new Object();
 oCat.id = LinksService.lastResult.categories.category.id;
 oCat.label = LinksService.lastResult.categories.category.label;
 oCat.icon = LinksService.lastResult.categories.category.icon;
 LinksFullAC.addItem(oCat);  // NOTE: LinksFullAC needs to not only be 
previously declared, but must also me instantiated with new ArrayCollection() 
for this line to work.
 
 }






From: James garymoorcroft_...@yahoo.co.uk
To: flexcoders@yahoogroups.com
Sent: Mon, April 19, 2010 9:58:33 AM
Subject: [flexcoders] Re: Problems With my XML Created Array Collection

  
The thing is my xml is retrieved from a mysql database table which sometimes 
will have no records or 1 record which will mean the xml will have only 1 or no 
nodes which in turn causes the problem whereas sometimes it has many records 
therefore the xml file would have many nodes which would mean no problems.

I've heard of looping but can't figure out how to do it or apply it to my code. 
I've tried simply changing the array collection to xmllist collection but then 
the data doesn't seem to appear in my tilelist.

How would you loop using my specific code there because I always need it 
returned as an array collection to populate the tilelist but have no idea how 
to loop?

Cheers for your help so far.

--- In flexcod...@yahoogro ups.com, Robert Moss rdm0...@...  wrote:

 We had the same issue, and in our case it was an easy fix.  When we read in 
 the XML it was returning as an ArrayCollection as long as there were multiple 
 nodes.  As you have found, if it was only one node it returned as a generic 
 object not an ArrayCollection.  We were already looping through the 
 ArrayCollection to populate value objects that we were using to populate our 
 list.  So before the loop we added, if xmlObject is an ArrayCollection than 
 loop else populate VO with returned data.  Worked without issues ever since.
 
 Robert
 
 
 
 
 
  _ _ __
 From: thomas parquier mailinglists@ ...
 To: flexcod...@yahoogro ups.com
 Sent: Mon, April 19, 2010 9:27:13 AM
 Subject: Re: [flexcoders] Problems With my XML Created Array Collection
 
 
 what about xmllistcollection ?;
 
 ---
 thomas parquier
 http://www.web- attitude. fr/realisations/
 msn : thomas.parquier@ web-attitude. fr
 softphone : sip:webattitude@ ekiga.net
 téléphone portable : +33601 822 056
 
 
 
 2010/4/19 James garymoorcroft_ i...@yahoo. co.uk
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
   
 
 
  
  
  
 In my app I have an array collection which populates a tilelist. This array 
 collection is populated by a remote xml file via a http request. Problem is 
 if the xml only has 1 or no nodes I get a null object reference error. I 
 know this is a known problem but I've never been able to find a valid 
 solution for it which could be applied to my code. I've heard of looping 
 through the xml to create an array collection or using xmllist collection 
 but I don't know how these can be done whilst still allowing the data to be 
 displayed in the tilelist. Can anyone help me out please?
 
 The code for my httpservice, array collcection I'm trying to make and the 
 result of the http service and the tilelist it populates is shown below. As 
 I say this all works fine as long as the xml has more than 1 node but 
 causes the error if it doesn't:-
 
 http://www.coolvisi ontest.com/ getlinks. php/
 
 mx:Script
 ![CDATA[
 
 import mx.rpc.events. ResultEvent;
 import mx.collections. ArrayCollection;
 
 [Bindable] private var LinksFullAC: ArrayCollection;
 
 private function linksResultHandler( event:ResultEven t):void
 {
 LinksFullAC= LinksService. lastResult. categories. 
  category as ArrayCollection;
 }
 
 
 ]]
 /mx:Script
 
 mx:TileList id=linkChoice  dataProvider= {LinksFullAC}  height=365 
 width=665/ 
 
 Here's my xml structure:-
 
 categories
  category
   id/id 
   label/label 
   icon/icon 
  /category
 /categories
 
 Obviously I need the array collection to be populated by id, label and icon.
 
 Thanks for any suggestions.
 
 



 


  

Re: [flexcoders] Re: Problems With my XML Created Array Collection

2010-04-19 Thread Robert Moss
In essence yes, I do not think I would do it as part of the button click, but 
instead clear it before the IF in the result handler with LinksFullAC.source = 
new Array();  or LinksFullAC.removeAll();  I prefer the former.  

As for your error, I'm not sure what's happening, but you should be able to set 
a break in the result handler and see what is getting returned.  It looks like 
for the combination you describe, categories is not getting returned for some 
reason.  You'll need to figure out why and trap for it.  The same goes for 
returning 0 records.  See what is getting returned and trap for it.






From: James garymoorcroft_...@yahoo.co.uk
To: flexcoders@yahoogroups.com
Sent: Mon, April 19, 2010 12:47:15 PM
Subject: [flexcoders] Re: Problems With my XML Created Array Collection

  
Hi Robert. Thanks so much for that my friend. 

I have some problems with it though. You see I have an event in my app applied 
to a button (refresh button) which resends data via the LinksService i.e. 
LinksService. send and I've noticed that with your code if there is only 1 link 
i.e. 1 node and I click the refresh button it seems to keep recreating that 1 
over and over again as if it's recreating the same object in the array 
collection or something. This doesn't happen if their are 2 or more 
links/nodes/ objects. Perhaps I'll have to get the refresh button to empty the 
array collection first before sending the data i.e. it's click function would 
be LinksFullAC. flush; LinksService. send() Am I right?

I've also noticed now with your code applied if I select an item in the 
tilelist and click the reresh button I get the error Property categories not 
found on String and there is no default value which is indicating the error at 
the if statement in the code you gave me and the LinksService itself. Any idea 
what's causing this?

Another question though what if the xml contains no nodes? 

You see my xml file is dynamic, I have a variable in my app called categoryid 
and that variable is based on a category that the user selects in my app and is 
submitted to getlinks.php which gets all the records from my mysql table which 
contain that specific submitted categoryid and output them as the xml file. 
Some categoryids have no records (the user can add and delte records via my 
app). Is there any way of getting it to handle 0 records/nodes as well as 
handling muliple records/1record which it seems to already do?

Thanks so much for your help. Sorry to be a pain :-(

--- In flexcod...@yahoogro ups.com, Robert Moss rdm0...@...  wrote:

 This is not exactly how I would implement, but you should get the idea.  If 
 you have multiple category nodes, then your LinksService. lastResult. 
 categories. category is returned as an ArrayCollection and your code works.  
 If it only has one node then LinksService. lastResult. categories. category 
 is returned as an ObjectProxy.  So in your return method you could have the 
 following.
 
 if(LinksService. lastResult. categories. category is ArrayCollection) {
  LinksFullAC= LinksService. lastResult. categories. category as 
 ArrayCollection;
  }else
  {
  var oCat:Object = new Object();
 oCat.id = LinksService. lastResult. categories. category. id;
  oCat.label = LinksService. lastResult. categories. category. label;
  oCat.icon = LinksService. lastResult. categories. category. icon;
  LinksFullAC. addItem(oCat) ;  // NOTE: LinksFullAC needs to not only 
 be previously declared, but must also me instantiated with new 
 ArrayCollection( ) for this line to work.
 
  }
 
 
 
 
 
  _ _ __
 From: James garymoorcroft_ i...@...
 To: flexcod...@yahoogro ups.com
 Sent: Mon, April 19, 2010 9:58:33 AM
 Subject: [flexcoders] Re: Problems With my XML Created Array Collection
 
 
 The thing is my xml is retrieved from a mysql database table which sometimes 
 will have no records or 1 record which will mean the xml will have only 1 or 
 no nodes which in turn causes the problem whereas sometimes it has many 
 records therefore the xml file would have many nodes which would mean no 
 problems.
 
 I've heard of looping but can't figure out how to do it or apply it to my 
 code. I've tried simply changing the array collection to xmllist collection 
 but then the data doesn't seem to appear in my tilelist.
 
 How would you loop using my specific code there because I always need it 
 returned as an array collection to populate the tilelist but have no idea how 
 to loop?
 
 Cheers for your help so far.
 
 --- In flexcod...@yahoogro ups.com, Robert Moss rdm0004@  wrote:
 
  We had the same issue, and in our case it was an easy fix.  When we read in 
  the XML it was returning as an ArrayCollection as long as there were 
  multiple nodes.  As you have found, if it was only one node it returned as 
  a generic object not an ArrayCollection.  We were already looping through

Re: [flexcoders] Re: Problems With my XML Created Array Collection

2010-04-19 Thread Robert Moss
Yes use a third if statement like:  if(event.result.categories)   
if(event.result.categories != null) should also work

Notice I used event.result instead of LinksService.lastResult.  Small change, 
but you should get in the habit as LinksService.lastResult will cause some pain 
in the future if you decide to change it's name for some reason.  

Amy suggested using e4x which is probably the correct answer as e4x grants you 
consistency ( you do not have the arrayCollection returned sometimes and 
ObjectProxy others) and allows you to work with XML in actionscript like XML 
was meant to be accessed.  You will still have to trap for the same issues, 
just implemented in a different way.   We do not always use e4x although we 
probably should, being lazy will probably bite us one of these days.





From: James garymoorcroft_...@yahoo.co.uk
To: flexcoders@yahoogroups.com
Sent: Mon, April 19, 2010 2:11:16 PM
Subject: [flexcoders] Re: Problems With my XML Created Array Collection

  
You were right about removeall (flush ha whoops) helping. I applied removeall 
before the if statements like you said and the first error is now gone.

The only problem I have now is the error which occurs when there are NO nodes 
in the xml i.e. all items have been removed and there are no values in my mysql 
table which relate to that specific category id.

I've changed the code to this:-

private function linksResultHandler( event:ResultEven t):void
{
LinksFullAC. removeAll( );
if(LinksService. lastResult. categories. category is ArrayCollection) {
LinksFullAC= LinksService. lastResult. categories. category as ArrayCollection;
}else if (LinksService. lastResult. categories. category is ObjectProxy)
{
var oCat:Object = new Object();
oCat.linkid = LinksService. lastResult. categories. category. linkid;
oCat.categoryid = LinksService. lastResult. categories. category. categoryid; 
oCat.label = LinksService. lastResult. categories. category. label;
oCat.icon = LinksService. lastResult. categories. category. icon;
oCat.link = LinksService. lastResult. categories. category. link;
LinksFullAC. addItem(oCat) ; 
}
}

The thing is though in that code I have the first if statement to check for if 
the result is an array collection which sets it as an array collection, the 
second if statement which if it is an object proxy adds the single object to 
the array collection but I think what I'll need is a third if statement which 
checks if the xml is empty/null or something and assign what will happen if it 
is null. Do you know of any way to do this and if so what do you think is best 
to set as the operation of such an if statement to make sure this error doesn't 
occur anymore? I thought it might be something like:-

if(LinksService. lastResult. categories. category is null)

but there seems to be no such thing. Any ideas?

Sorry to keep hassling but it's pretty much the last hiccup I've got in my app 
and I always try to pick the brains of guys who know their stuff as much as I 
can :-)

--- In flexcod...@yahoogro ups.com, Robert Moss rdm0...@...  wrote:

 In essence yes, I do not think I would do it as part of the button click, but 
 instead clear it before the IF in the result handler with LinksFullAC. source 
 = new Array();  or LinksFullAC. removeAll( );  I prefer the former. 
 
 As for your error, I'm not sure what's happening, but you should be able to 
 set a break in the result handler and see what is getting returned.  It looks 
 like for the combination you describe, categories is not getting returned for 
 some reason.  You'll need to figure out why and trap for it.  The same goes 
 for returning 0 records.  See what is getting returned and trap for it.
 
 
 
 
 
  _ _ __
 From: James garymoorcroft_ i...@...
 To: flexcod...@yahoogro ups.com
 Sent: Mon, April 19, 2010 12:47:15 PM
 Subject: [flexcoders] Re: Problems With my XML Created Array Collection
 
 
 Hi Robert. Thanks so much for that my friend. 
 
 I have some problems with it though. You see I have an event in my app 
 applied to a button (refresh button) which resends data via the LinksService 
 i.e. LinksService. send and I've noticed that with your code if there is only 
 1 link i.e. 1 node and I click the refresh button it seems to keep recreating 
 that 1 over and over again as if it's recreating the same object in the array 
 collection or something. This doesn't happen if their are 2 or more 
 links/nodes/ objects. Perhaps I'll have to get the refresh button to empty 
 the array collection first before sending the data i.e. it's click function 
 would be LinksFullAC. flush; LinksService. send() Am I right?
 
 I've also noticed now with your code applied if I select an item in the 
 tilelist and click the reresh button I get the error Property categories not 
 found on String and there is no default value which is indicating the error 
 at the if statement in the code you gave me and the LinksService

Re: [flexcoders] How to tell if colorpicker is open

2010-02-27 Thread Robert Moss
I was hoping to not have to keep track with flags in my code, but interrogate 
the component for it's state.  However, using flags is still better than using 
mx_internal.  Thanks.

--- On Sat, 2/27/10, Alex Harui aha...@adobe.com wrote:

From: Alex Harui aha...@adobe.com
Subject: Re: [flexcoders] How to tell if colorpicker is open
To: flexcoders@yahoogroups.com flexcoders@yahoogroups.com
Date: Saturday, February 27, 2010, 1:04 AM







 



  



  
  
  

There should be open/close events





On 2/26/10 2:29 PM, Robert Moss rdm0...@yahoo. com wrote:



 

 

 

   



I can not seem to find a way to tell programmatically if the colorpicker is 
open.  Internally it uses the showingDropdown property, but it is not exposed.  
I could use myColorPicker. mx_internal: :showingDropdown but there has to be a 
better way.  I'm sure I'm just missing it.



 

   







-- 

Alex Harui

Flex SDK Team

Adobe System, Inc.

http://blogs. adobe.com/ aharui








 





 



  






  

[flexcoders] How to tell if colorpicker is open

2010-02-26 Thread Robert Moss
I can not seem to find a way to tell programmatically if the colorpicker is 
open.  Internally it uses the showingDropdown property, but it is not exposed.  
I could use myColorPicker.mx_internal::showingDropdown but there has to be a 
better way.  I'm sure I'm just missing it.


  


Re: [flexcoders] Need light shed on Array issue

2006-12-12 Thread Robert Moss



Sorry for bumping this, just hoping someone has an idea.

Thanks,
Robert "Robert Moss" [EMAIL PROTECTED] 12/8/2006 4:47 pm 


In Adobe's dashboard sample app, http://www.adobe.com/devnet/flex/samples/dashboard/ it assigns a charting component's dataProvider to an ArrayCollection's source(e.g. revenueData="{slicedRegionData.source}") In the regionChange() function it sets the array regionData and assigns it to slicedRegionData.source 

My question is, the delivered code

slicedRegionData.source = regionData.slice(slider.values[0], slider.values[1] + 1); Alert.show(ObjectUtil.toString(slicedRegionData.source));

and

slicedRegionData.source = regionData; Alert.show(ObjectUtil.toString(slicedRegionData.source));

Without the .slice, output the exact same data, but the region detail does not auto update without using the .slice code. WHY??? Thanks for any insight on this.

Robert** Confidentiality Notice: This e-mail and any files transmitted with it are confidential to the extent permitted by law and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the originator of the message and destroy all copies. **



** Confidentiality Notice: This e-mail and any files transmitted with it are confidential to the extent permitted by law and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the originator of the message and destroy all copies. **



gif4Ne10jRYNs.gif
Description: GIF image


binhh6RmXERXy.bin
Description: image/xxx


[flexcoders] Need light shed on Array issue

2006-12-08 Thread Robert Moss
In Adobe's dashboard sample app,
http://www.adobe.com/devnet/flex/samples/dashboard/  it assigns a
charting component's dataProvider to an ArrayCollection's source (e.g.
revenueData={slicedRegionData.source})  In the regionChange() function
it sets the array regionData and assigns it to slicedRegionData.source 
 
My question is, the delivered code
 
slicedRegionData.source = regionData.slice(slider.values[0],
slider.values[1] + 1); 
Alert.show(ObjectUtil.toString(slicedRegionData.source));
 
and
 
slicedRegionData.source = regionData; 
Alert.show(ObjectUtil.toString(slicedRegionData.source));
 
Without the .slice,  output the exact same data, but the region detail
does not auto update without using the .slice code. WHY???  Thanks for
any insight on this.
 
Robert



** Confidentiality Notice: This e-mail and any files transmitted with it are 
confidential to the extent permitted by law and intended solely for the use of 
the individual or entity to whom they are addressed. If you have received this 
e-mail in error please notify the originator of the message and destroy all 
copies. **


[flexcoders] itemEditEnd event on datagrid

2006-10-02 Thread Robert Moss




in the following code, which I copied out of the livedocs and modified to throw an alert when the itemEditEnd event is fired, it seems that every time the cell you are editingloses focus,the event gets kicked off 5 times, the first 4 times with a reason of "other" and the last with "new_column".What am I missing. I'm trying to kick off code when a cell is changed, but I do not want it to run 5 times. Thanks.

Robert

?xml version="1.0"?mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*"

 mx:Script ![CDATA[  import mx.controls.TextInput; import mx.events.DataGridEvent; import mx.controls.Alert; import mx.utils.ObjectUtil;  private var initDG:Array = [ {Company: 'Acme', Contact: 'Bob Jones',  Phone: '413-555-1212', City: 'Boston', State: 'MA'}, {Company: 'Allied', Contact: 'Jane Smith',  Phone: '617-555-3434', City: 'SanFrancisco', State: 'CA'}  ];  public function validateData(event:DataGridEvent):void {  Alert.show(ObjectUtil.toString(event.reason)); }  ]] /mx:Script  mx:DataGrid id="myGrid" dataProvider="{initDG}" editable="true" itemEditEnd="validateData(event)" mx:columns mx:DataGridColumn dataField="Company" editable="false"/ mx:DataGridColumn dataField="Contact"/ mx:DataGridColumn dataField="Phone"/ mx:DataGridColumn dataField="City"/ mx:DataGridColumn dataField="State"/ /mx:columns /mx:DataGrid/mx:Application


** Confidentiality Notice: This e-mail and any files transmitted with it are confidential to the extent permitted by law and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the originator of the message and destroy all copies. **

__._,_.___





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








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  






  
  Your email settings: Individual Email|Traditional 
  Change settings via the Web (Yahoo! ID required) 
  Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured 
   
Visit Your Group 
   |
  
Yahoo! Groups Terms of Use
   |
  
   Unsubscribe 
   
 

  




__,_._,___



Re: [flexcoders] Problem closing pop up on datagrid cellpress

2005-03-02 Thread Robert Moss
Thanks Manish!!! That seems to work. 

I wnat to use cellPress because I have an HR application that allows
department contacts to request specific forms for employees based on
department, type of action, exempt / non-exempt, etc... So when I ask
for an employee ID number, I need to have a mechanism that allows them
to search for the ID. I've decided to use a pop up and allow for search
of Name, Job Code, Position #, Department, etc... The results of the
search are returned in a DataGrid. Upon selecting the desired employee,
I want the pop up to close and return the selected employee to the main
app. I could allow them to select the employee in the datagrid and then
click a continue button or something, but using the cellPress I think
makes more sense. If you have any ideas on a better way of doing this,
please let me know.

Robert

 [EMAIL PROTECTED] 03/02 12:13 PM 
Robert Moss wrote:

 If you use the buttons, the window closes and you can hit search
 again to get a new window, however if you select an item in the
 datagrid the window closes, but you can not select the search button
 again to get a new window, ultimately everything on the main app
 freezes up.

I don't know what's happening, but uses doLater() seems to fix it.

cellPress=doLater(this, 'deletePopUp')

I wonder why you'd want to close the window on cellPress though.

Manish

Yahoo! Groups SponsorADVERTISEMENT

Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/ 
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED] 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.






Class Diagram for Cairngorm?

2005-02-09 Thread Robert Moss


Does anyone happen to have a class diagram for Cairngorm? As a coldfusion programmer brand new to Flex/AS/Java, Iunderstand the basics of what Cairngorm is doing and have been able to create a few simple appsadding my own views and events, but it's still pretty much a black box. I'm ready to get under the hood.

Also how exactly is Cairngorm pronounced.

Thanks,
Robert