[flexcoders] ArrayCollection of a specific type?

2010-02-11 Thread Nick Middleweek
Hello,

Is it possible to specifc a class property to be an ArrayCollection of a
certain Interface rather than just an ArrayCollection?


Thanks,
Nick


[flexcoders] ArrayCollection, addAll and Refresh

2010-02-11 Thread johncch85
I understand that ArrayCollection.addAll was added in flex sdk 3.4. I'm coding 
a simple application and I'm hitting this problem. I would like to ask if 
anyone knows what's happening:

Here's the source, just a simple mxml:

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
creationComplete=creationComplete()
mx:Script
![CDATA[
import mx.collections.ArrayCollection;
private var a:Array = [
{ key: a, value: b },
{ key: a, value: b },
{ key: a, value: x },
{ key: a, value: b }
];

private var b:Array = [
{ key: b, value: c },
{ key: b, value: x },
{ key: b, value: c },
{ key: b, value: c }
];

private var c:Array = [
{ key: d, value: x },
{ key: d, value: e },
{ key: d, value: e },
{ key: d, value: e }
];

[Bindable] public var xx:ArrayCollection = new 
ArrayCollection();

public function creationComplete():void {
var i:int;
xx.filterFunction = filter;
xx.addAll(new ArrayCollection(a));
/*for (i = 0; i  a.length; i++) {
xx.addItem(a[i]);
}*/
trace(Refresh is  + xx.refresh());
xx.addAll(new ArrayCollection(b));
/*for (i = 0; i  b.length; i++) {
xx.addItem(b[i]);
}*/
trace(Refresh is  + xx.refresh());
xx.addAll(new ArrayCollection(c));
/*for (i = 0; i  c.length; i++) {
xx.addItem(c[i]);
}*/
trace(Refresh is  + xx.refresh());
}

private function filter(item:*):Boolean {
if (item.value == x) return false;
return true;
}

]]
/mx:Script
mx:DataGrid id=dg dataProvider={xx}/mx:DataGrid
/mx:Application

When I compile and run I get:

RangeError: Index '5' specified is out of bounds.

What I'm doing basically is to add some random array of objects into an 
ArrayCollection binded to the DataGrid. And because there is a filter function 
associated with the ArrayCollection, I call refresh() every time something is 
added. The original use case is that this is like a drop object method for the 
datagrid, so it's possible for it to be called multiple times.

I'm just curious why is this happening. Is this the desired behaviour? I'll 
look into the source code later when I'm free, but this is just to get a 
general feeling of the problem.



RE: [flexcoders] ArrayCollection of VO's Memory Leak??

2009-10-23 Thread Alex Harui
The profiler should be able to show you who is still referencing the objects.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Jake Churchill
Sent: Thursday, October 22, 2009 10:57 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection of VO's Memory Leak??



Hi all,

I have a charting application where I have an ArrayCollection of VO's.  The 
chart has several series, each looking at one property in the VO.

There are several controls that when changed, require a re-calculation of the 
VO's in the ArrayCollection.  Before I do the re-calculation, I call 
.removeAll() on the ArrayCollection and re-populate it with new VO's.

When I run the profiler, my VO instances grow with each re-calculation.  So, 
why doesn't the garbage collector take care of the objects that got removed 
from the ArrayCollection?  How can I fix this?

Please help.

Thanks!

-Jake



Re: [flexcoders] ArrayCollection of VO's Memory Leak??

2009-10-23 Thread Jake Churchill
Where do you go to see that?  All I can see is the number of instances an
object has and the memory those instances take up?

On Fri, Oct 23, 2009 at 1:10 AM, Alex Harui aha...@adobe.com wrote:



  The profiler should be able to show you who is still referencing the
 objects.



 Alex Harui

 Flex SDK Developer

 Adobe Systems Inc. http://www.adobe.com/

 Blog: http://blogs.adobe.com/aharui



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Jake Churchill
 *Sent:* Thursday, October 22, 2009 10:57 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] ArrayCollection of VO's Memory Leak??





 Hi all,

 I have a charting application where I have an ArrayCollection of VO's.  The
 chart has several series, each looking at one property in the VO.

 There are several controls that when changed, require a re-calculation of
 the VO's in the ArrayCollection.  Before I do the re-calculation, I call
 .removeAll() on the ArrayCollection and re-populate it with new VO's.

 When I run the profiler, my VO instances grow with each re-calculation.
 So, why doesn't the garbage collector take care of the objects that got
 removed from the ArrayCollection?  How can I fix this?

 Please help.

 Thanks!

 -Jake

   



RE: [flexcoders] ArrayCollection of VO's Memory Leak??

2009-10-23 Thread Alex Harui
Double click on the object and it should show you all references to that object.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Jake Churchill
Sent: Friday, October 23, 2009 9:30 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection of VO's Memory Leak??



Where do you go to see that?  All I can see is the number of instances an 
object has and the memory those instances take up?
On Fri, Oct 23, 2009 at 1:10 AM, Alex Harui 
aha...@adobe.commailto:aha...@adobe.com wrote:

The profiler should be able to show you who is still referencing the objects.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.commailto:flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.commailto:flexcoders@yahoogroups.com] On 
Behalf Of Jake Churchill
Sent: Thursday, October 22, 2009 10:57 AM
To: flexcoders@yahoogroups.commailto:flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection of VO's Memory Leak??



Hi all,

I have a charting application where I have an ArrayCollection of VO's.  The 
chart has several series, each looking at one property in the VO.

There are several controls that when changed, require a re-calculation of the 
VO's in the ArrayCollection.  Before I do the re-calculation, I call 
.removeAll() on the ArrayCollection and re-populate it with new VO's.

When I run the profiler, my VO instances grow with each re-calculation.  So, 
why doesn't the garbage collector take care of the objects that got removed 
from the ArrayCollection?  How can I fix this?

Please help.

Thanks!

-Jake




Re: [flexcoders] ArrayCollection of VO's Memory Leak??

2009-10-23 Thread Jake Churchill
Ah, for anyone else curious, you have to take a memory snapshot before this
will work

On Fri, Oct 23, 2009 at 3:06 PM, Alex Harui aha...@adobe.com wrote:



  Double click on the object and it should show you all references to that
 object.



 Alex Harui

 Flex SDK Developer

 Adobe Systems Inc. http://www.adobe.com/

 Blog: http://blogs.adobe.com/aharui



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Jake Churchill
 *Sent:* Friday, October 23, 2009 9:30 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] ArrayCollection of VO's Memory Leak??





 Where do you go to see that?  All I can see is the number of instances an
 object has and the memory those instances take up?

 On Fri, Oct 23, 2009 at 1:10 AM, Alex Harui aha...@adobe.com wrote:



 The profiler should be able to show you who is still referencing the
 objects.



 Alex Harui

 Flex SDK Developer

 Adobe Systems Inc. http://www.adobe.com/

 Blog: http://blogs.adobe.com/aharui



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Jake Churchill
 *Sent:* Thursday, October 22, 2009 10:57 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] ArrayCollection of VO's Memory Leak??





 Hi all,

 I have a charting application where I have an ArrayCollection of VO's.  The
 chart has several series, each looking at one property in the VO.

 There are several controls that when changed, require a re-calculation of
 the VO's in the ArrayCollection.  Before I do the re-calculation, I call
 .removeAll() on the ArrayCollection and re-populate it with new VO's.

 When I run the profiler, my VO instances grow with each re-calculation.
 So, why doesn't the garbage collector take care of the objects that got
 removed from the ArrayCollection?  How can I fix this?

 Please help.

 Thanks!

 -Jake



   



[flexcoders] ArrayCollection of VO's Memory Leak??

2009-10-22 Thread Jake Churchill
Hi all,

I have a charting application where I have an ArrayCollection of VO's.  The
chart has several series, each looking at one property in the VO.

There are several controls that when changed, require a re-calculation of
the VO's in the ArrayCollection.  Before I do the re-calculation, I call
.removeAll() on the ArrayCollection and re-populate it with new VO's.

When I run the profiler, my VO instances grow with each re-calculation.  So,
why doesn't the garbage collector take care of the objects that got removed
from the ArrayCollection?  How can I fix this?

Please help.

Thanks!

-Jake


[flexcoders] ArrayCollection back to Query

2009-08-11 Thread Warren
I'm using Remote Objects in Flex with Cold Fusion 8 to retrieve data.  Flex 
makes a call to a Cold Fusion CFC which runs a query and sends that back to 
Flex.  I pick it up in Flex and attach it to an ArrayCollection which powers my 
grids.  No problems.  

Now I want to go the other way.  I want to send the same ArrayCollection back 
to a CFC and have it show up as a query.  I thought if you pass an Flex 
ArrayCollection to ColdFusion it would be automatically interpreted as a 
ColdFusion query object.

Either this is not the case or I am (again) doing something wrong.  Has anyone 
tried this?  Maybe share some codes examples?

Thanks!

Warren

RE: [flexcoders] ArrayCollection filterFunction returning item in array;

2009-08-08 Thread Alex Harui
I think you want

return statusGroup.indexOf(item.STATUSID) != -1

Make sure STATUSID is a number/int and not a String, or convert it.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of kpjj31
Sent: Friday, August 07, 2009 3:02 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection filterFunction returning item in array;



Is it possible to use the ArrayCollection filterFunction that returns items 
from an Array?

This returns null...

private function filterStatus(item:Object):Boolean {

var statusgroup:Array = [0, 1, 88, 44];
return item.STATUSID in (statusgroup);

}



[flexcoders] ArrayCollection filterFunction returning item in array;

2009-08-07 Thread kpjj31

Is it possible to use the ArrayCollection filterFunction that returns items 
from an Array?


This returns null...

private function filterStatus(item:Object):Boolean {   

var statusgroup:Array = [0, 1, 88, 44];
return item.STATUSID in (statusgroup);
   
} 





RE: [flexcoders] ArrayCollection filterFunction returning item in array;

2009-08-07 Thread Tracy Spratt
No, the in operator is used to determine if an object has a particular
property.  With Array, it will tell you if an index is within the bounds of
the array.

 

In your case, if STATUSID is an integer, it will return true for value
0,1,2,3.

 

I am not sure why it is returning null.  Split the code up into smaller
parts and debug it.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of kpjj31
Sent: Friday, August 07, 2009 6:02 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection filterFunction returning item in
array;

 

  


Is it possible to use the ArrayCollection filterFunction that returns items
from an Array?

This returns null...

private function filterStatus(item:Object):Boolean { 

var statusgroup:Array = [0, 1, 88, 44];
return item.STATUSID in (statusgroup);

} 





Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

2009-08-03 Thread Angelo Anolin
Hi Tracy,
apologies that it took me quite a while to reply and continue this. been 
sidetracked on another project.

anyway, when I have passed the xmllistcollection as string to .net, what method 
would i use to parse the information in the .net side?

thanks.

regards,

Angelo




From: Tracy Spratt tr...@nts3rd.com
To: flexcoders@yahoogroups.com
Sent: Wednesday, 8 July, 2009 12:48:27
Subject: RE: [flexcoders] ArrayCollection Does Not Show Items In Order When 
Passed to .NET WebService





var sXML:String = “root”;
sXML += myXMLListCollection .toXMLSTring( );
sXML+= “/root”;
myWebService. setUserPermits( sXML,sSID) ;
 
on the .net side:
WebMethod(Descripti on:=Updates multiple UserPermit records) _
  Public Function setUserPermits(ByVal sRowsXml As String, ByVal sSId As 
String) As DataTable
…
 
 
 
Tracy Spratt,
Lariat Services, development services available



From:flexcod...@yahoogro ups.com [mailto: flexcod...@yahoogro ups.com ] On 
Behalf Of Angelo Anolin
Sent: Tuesday, July 07, 2009 8:09 PM
To: flexcod...@yahoogro ups.com
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When 
Passed to .NET WebService
 




Hi Tracy,
 
I would certainly appreciate if you could point me in the right direction on 
using XMLListCollection and sending it back to .NET as a string.  
 
Thanks.
 
Regards,
 
Angelo
 



From:Tracy Spratt tr...@nts3rd. com
To: flexcod...@yahoogro ups.com
Sent: Tuesday, 7 July, 2009 4:45:56
Subject: RE: [flexcoders] ArrayCollection Does Not Show Items In Order When 
Passed to .NET WebService
Why not use XMLListCollection and send the xml to .net as a string?  There is 
little value in building an ArrayCollection of generic obects.  You can 
sort/filter an XMLListCollection.
 
XML is more verbose than some other methods, but if bandwidth is truly an 
issue, then you should be looking at a binary protocol.
 
Tracy Spratt,
Lariat Services, development services available



From:flexcod...@yahoogro ups.com [mailto: flexcod...@yahoogro ups.com ] On 
Behalf Of Angelo Anolin
Sent: Friday, July 03, 2009 2:09 AM
To: flexcod...@yahoogro ups.com
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When 
Passed to .NET WebService
 



Hi Sam,
Basically this is the process which I am using.
 
.NET
Retrieve records from Oracle DB and store the same into a dataset.  Return the 
dataset as XML string via the command DataSet.GetXML.
 
Flex
In the event handler of my webservice method call, I parse the string into XML, 
then ArrayCollection via the following codes:
 
private var _xmlData:XML;
[Bindable] private var arrDP:ArrayCollecti on = new ArrayCollection;
_xmlData = XML(event.result) ;
var oTemp:Object;
var xl:XMLList = _xmlData.children( );
var i:int;
for(i = 0; i  xl.length(); i++)  
{
 oTemp = {NAME:xl[i]. NAME.text( ), TEAM:xl[i].TEAM. text(), 
    JERSEY :xl[i] .JERSEY.text( ), MANAGER:xl[i] .MANAGER. text()};
 arrDP.addItem( oTemp);
}
 
and in my datagrid, I am setting its dataProvider to the arrDP variable.
 
I used Array Collection because I implemented a search and filter functionality 
which searches and filters the data accordingly for the dataprovider which is 
then reflected back to the datagrid.
Now, when I need to return the ArrayCollection to .NET, I simply pass the same 
as a parameter to a .NET function which accepts ArrayList as parameter.
 
.NET
Once the function receieves the arraycollection (which is then now an array 
list), I get the arrays inside the arraylist and get the values inside the 
array. 
 
I think by doing things like this, it may not be the best way.
 
You mentioned you'd map the XML to typed objects in .NET.  How can I do this?
 
Instead of using arraycollection as dataprovider in my datagrid, can I use 
another which would be much easier when I pass back to the .NET function?
 
Whats the best way to interact large set of data (datasets) between .NET and 
Flex?
 
Thanks a lot.

 
 



From:Sam Lai samuel@gmail. com
To: flexcod...@yahoogro ups.com
Sent: Friday, 3 July, 2009 13:52:12
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When 
Passed to .NET WebService
Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin angelo_anolin@ yahoo.com:


 Hi Sam,

 Care to show some examples? I am parsing the arrayCollection into an
 ArrayList on .NET.  This is particularly not too appealing since I just
 discovered that for example, if one of the objects

Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

2009-07-07 Thread Angelo Anolin
Hi Sam Lai,

THanks for the input and my apologies for replying late since I felt the need 
to get deeper on the issue I am encountering.

In my web service, the arraycollection is received as an array list and yes, it 
is like an array of xml nodes.

In my arraycollection, say I have 5 columns and when one of the columns 
contains an empty string, when I pass it to my .NET webservice, the arraylist 
will have an array which only contains 4 columns (instead of the expected 5).  
That is why the empty field is actually causing me some problems.

I am trying to find some E4x documentation / article specifically tackling this 
kind of .NET and Flex integration. Do you know of some?

Thanks and regards,

Angelo





From: Sam Lai samuel@gmail.com
To: flexcoders@yahoogroups.com
Sent: Saturday, 4 July, 2009 12:54:53
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When 
Passed to .NET WebService





I just wrote up a simple C# web service that accepts an ArrayList:

[WebMethod]
public bool ArrayListTest( System.Collectio ns.ArrayList a)
{ ... }

Then in Flex I wrote this,

mx:Script
![CDATA[
import mx.collections. ArrayCollection;
private function sendWebServiceCall( ):void
{
trace(appComplete );
ws.ArrayListTest( new ArrayCollection( [ {name:bob, id:808 }, {
name:fred, id: }]));
}
]]
/mx:Script
mx:WebService wsdl=http://localhost: 63868/Service1. asmx?WSDL id=ws
mx:operation name=ArrayListTest  result=trace( event.result) 
fault=trace( event.fault. faultString) /
/mx:WebService

When sendWebServiceCall is triggered, it calls the C# web service and
passes the ArrayCollection to it.

In the web service, the ArrayCollection is received as an array list
of XmlNodes. Each XmlNode contains a node for each field, even if it
is an empty string.

tns:id xmlns:tns=http://tempuri. org/808/tns:id
tns:name xmlns:tns=http://tempuri. org/bob/tns:name

tns:id xmlns:tns=http://tempuri. org//tns:id
tns:name xmlns:tns=http://tempuri. org/fred/tns: name

Is this anything like what you're getting? The edge case you described
in another email about an empty string causing problems doesn't seem
to cause problems.

Also see inline.

2009/7/3 Angelo Anolin angelo_anolin@ yahoo.com:
 I think by doing things like this, it may not be the best way.

 You mentioned you'd map the XML to typed objects in .NET.  How can I do
 this?

As you're using a dataset, this isn't really an option. A dataset as
opposed to a collection of typed objects are two ways of handling data
from data sources; it is arguable which way is better.

The problem in your case, is that the XML generated as a result of
passing an ArrayCollection to a web service method cannot be passed
into the dataset's readXml method. (Even if it could by inferring a
schema, it would be different to your database's schema.)

The only way I know of to do seamless transfer of data without having
to parse XML is to use WebORB. Otherwise you will have to parse the
XML produced on both sides to re-create the dataset/object.

 Instead of using arraycollection as dataprovider in my datagrid, can I use
 another which would be much easier when I pass back to the .NET function?

I wonder if it is possible to bind your datagrid directly to the e4x
XML? That way you can pass the entire XML doc back to .NET via the web
service, and hence you can re-create the dataset using
dataset.readXML.

  _ _ __
 From: Sam Lai samuel@gmail. com
 To: flexcod...@yahoogro ups.com
 Sent: Friday, 3 July, 2009 13:52:12
 Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
 Passed to .NET WebService

 Instead of using an array list and trying to emulate the type-less
 abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
 does the XML from your Flex app differ too wildly to do this?

 Are you using the XmlSerializer to deserialize this? Or are you using
 WCF? Or are you doing it some other way, or manually?

 I'd provide an example, but I don't know enough details on your
 situation to give something useful :)

 2009/7/3 Angelo Anolin angelo_anolin@ yahoo.com:


 Hi Sam,

 Care to show some examples? I am parsing the arrayCollection into an
 ArrayList on .NET.  This is particularly not too appealing since I just
 discovered that for example, if one of the objects in the arraycollection
 would have an empty string value, the number of items inside the array is
 not reflected properly in .NET.

 Like:

 private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:001 ,
 Value:Select },
 {ID:002,
 Value:Choose },
     {ID:003,
 Value:},]) ;

 When I pass this var arrR into a .NET webservice and delegate it to an
 ArrayList, the items in the array list will have one of the arrays only
 containing 1 item (instead of 2).

 Adding to my problem is the fact that the arrays inside the array

Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

2009-07-07 Thread Angelo Anolin
Hi Tracy,

I would certainly appreciate if you could point me in the right direction on 
using XMLListCollection and sending it back to .NET as a string.  

Thanks.

Regards,

Angelo





From: Tracy Spratt tr...@nts3rd.com
To: flexcoders@yahoogroups.com
Sent: Tuesday, 7 July, 2009 4:45:56
Subject: RE: [flexcoders] ArrayCollection Does Not Show Items In Order When 
Passed to .NET WebService





Why not use XMLListCollection and send the xml to .net as a string?  There is 
little value in building an ArrayCollection of generic obects.  You can 
sort/filter an XMLListCollection.
 
XML is more verbose than some other methods, but if bandwidth is truly an 
issue, then you should be looking at a binary protocol.
 
Tracy Spratt,
Lariat Services, development services available



From:flexcod...@yahoogro ups.com [mailto: flexcod...@yahoogro ups.com ] On 
Behalf Of Angelo Anolin
Sent: Friday, July 03, 2009 2:09 AM
To: flexcod...@yahoogro ups.com
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When 
Passed to .NET WebService
 




Hi Sam,
Basically this is the process which I am using.
 
.NET
Retrieve records from Oracle DB and store the same into a dataset.  Return the 
dataset as XML string via the command DataSet.GetXML.
 
Flex
In the event handler of my webservice method call, I parse the string into XML, 
then ArrayCollection via the following codes:
 
private var _xmlData:XML;
[Bindable] private var arrDP:ArrayCollecti on = new ArrayCollection;
_xmlData = XML(event.result) ;
var oTemp:Object;
var xl:XMLList = _xmlData.children( );
var i:int;
for(i = 0; i  xl.length(); i++)  
{
 oTemp = {NAME:xl[i]. NAME.text( ), TEAM:xl[i].TEAM. text(), 
    JERSEY :xl[i] .JERSEY.text( ), MANAGER:xl[i] .MANAGER. text()};
 arrDP.addItem( oTemp);
}
 
and in my datagrid, I am setting its dataProvider to the arrDP variable.
 
I used Array Collection because I implemented a search and filter functionality 
which searches and filters the data accordingly for the dataprovider which is 
then reflected back to the datagrid.
Now, when I need to return the ArrayCollection to .NET, I simply pass the same 
as a parameter to a .NET function which accepts ArrayList as parameter.
 
.NET
Once the function receieves the arraycollection (which is then now an array 
list), I get the arrays inside the arraylist and get the values inside the 
array. 
 
I think by doing things like this, it may not be the best way.
 
You mentioned you'd map the XML to typed objects in .NET.  How can I do this?
 
Instead of using arraycollection as dataprovider in my datagrid, can I use 
another which would be much easier when I pass back to the .NET function?
 
Whats the best way to interact large set of data (datasets) between .NET and 
Flex?
 
Thanks a lot.

 
 



From:Sam Lai samuel@gmail. com
To: flexcod...@yahoogro ups.com
Sent: Friday, 3 July, 2009 13:52:12
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When 
Passed to .NET WebService
Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin angelo_anolin@ yahoo.com:


 Hi Sam,

 Care to show some examples? I am parsing the arrayCollection into an
 ArrayList on .NET.  This is particularly not too appealing since I just
 discovered that for example, if one of the objects in the arraycollection
 would have an empty string value, the number of items inside the array is
 not reflected properly in .NET.

 Like:

 private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:001 ,
 Value:Select },
 {ID:002,
 Value:Choose },
     {ID:003,
 Value:},]) ;

 When I pass this var arrR into a .NET webservice and delegate it to an
 ArrayList, the items in the array list will have one of the arrays only
 containing 1 item (instead of 2).

 Adding to my problem is the fact that the arrays inside the array list when
 read in .NET should have the object ID and Value be in order but they are
 not.  This is further true when there are many items in the array
 collection.  Sometimes, the first item becomes the last one in the array
 list, and sometimes the order is not well.

 In any case, I am finding a solution on how I would be able to pass an
 ArrayCollection to .NET and be able to parse it properly.

 Thanks.

  _ _ __
 From: Sam Lai samuel@gmail. com
 To: flexcod...@yahoogro ups.com
 Sent: Thursday, 2 July, 2009 15:46:58
 Subject: Re: [flexcoders

RE: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

2009-07-07 Thread Tracy Spratt
var sXML:String = root;

sXML += myXMLListCollection.toXMLSTring();

sXML+= /root;

myWebService.setUserPermits(sXML,sSID);

 

on the .net side:

WebMethod(Description:=Updates multiple UserPermit records) _

  Public Function setUserPermits(ByVal sRowsXml As String, ByVal sSId As
String) As DataTable

.

 

 

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Angelo Anolin
Sent: Tuesday, July 07, 2009 8:09 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

 






Hi Tracy,

 

I would certainly appreciate if you could point me in the right direction on
using XMLListCollection and sending it back to .NET as a string.  

 

Thanks.

 

Regards,

 

Angelo

 

  _  

From: Tracy Spratt tr...@nts3rd.com
To: flexcoders@yahoogroups.com
Sent: Tuesday, 7 July, 2009 4:45:56
Subject: RE: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

Why not use XMLListCollection and send the xml to .net as a string?  There
is little value in building an ArrayCollection of generic obects.  You can
sort/filter an XMLListCollection.

 

XML is more verbose than some other methods, but if bandwidth is truly an
issue, then you should be looking at a binary protocol.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcod...@yahoogro ups.com [mailto: flexcod...@yahoogro ups.com ] On
Behalf Of Angelo Anolin
Sent: Friday, July 03, 2009 2:09 AM
To: flexcod...@yahoogro ups.com
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

 





Hi Sam,

Basically this is the process which I am using.

 

.NET
Retrieve records from Oracle DB and store the same into a dataset.  Return
the dataset as XML string via the command DataSet.GetXML.

 

Flex
In the event handler of my webservice method call, I parse the string into
XML, then ArrayCollection via the following codes:

 

private var _xmlData:XML;
[Bindable] private var arrDP:ArrayCollecti on = new ArrayCollection;

_xmlData = XML(event.result) ;
var oTemp:Object;
var xl:XMLList = _xmlData.children( );

var i:int;
for(i = 0; i  xl.length(); i++)  
{
 oTemp = {NAME:xl[i]. NAME.text( ), TEAM:xl[i].TEAM. text(), 
JERSEY :xl[i] .JERSEY.text( ), MANAGER:xl[i] .MANAGER. text()};
 arrDP.addItem( oTemp);
}

 

and in my datagrid, I am setting its dataProvider to the arrDP variable.

 

I used Array Collection because I implemented a search and filter
functionality which searches and filters the data accordingly for the
dataprovider which is then reflected back to the datagrid.

Now, when I need to return the ArrayCollection to .NET, I simply pass the
same as a parameter to a .NET function which accepts ArrayList as parameter.

 

.NET
Once the function receieves the arraycollection (which is then now an array
list), I get the arrays inside the arraylist and get the values inside the
array. 

 

I think by doing things like this, it may not be the best way.

 

You mentioned you'd map the XML to typed objects in .NET.  How can I do
this?

 

Instead of using arraycollection as dataprovider in my datagrid, can I use
another which would be much easier when I pass back to the .NET function?

 

Whats the best way to interact large set of data (datasets) between .NET and
Flex?

 

Thanks a lot.


 

 

  _  

From: Sam Lai samuel@gmail. com
To: flexcod...@yahoogro ups.com
Sent: Friday, 3 July, 2009 13:52:12
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin angelo_anolin@ mailto:angelo_anolin%40yahoo.com
yahoo.com:


 Hi Sam,

 Care to show some examples? I am parsing the arrayCollection into an
 ArrayList on .NET.  This is particularly not too appealing since I just
 discovered that for example, if one of the objects in the arraycollection
 would have an empty string value, the number of items inside the array is
 not reflected properly in .NET.

 Like:

 private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:001 ,
 Value:Select },
 {ID:002,
 Value:Choose },
 {ID:003,
 Value:},]) ;

 When I pass this var arrR into a .NET webservice and delegate it to an
 ArrayList, the items in the array list will have one of the arrays only
 containing 1 item (instead of 2

RE: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

2009-07-06 Thread Tracy Spratt
Why not use XMLListCollection and send the xml to .net as a string?  There
is little value in building an ArrayCollection of generic obects.  You can
sort/filter an XMLListCollection.

 

XML is more verbose than some other methods, but if bandwidth is truly an
issue, then you should be looking at a binary protocol.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Angelo Anolin
Sent: Friday, July 03, 2009 2:09 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

 






Hi Sam,

Basically this is the process which I am using.

 

.NET
Retrieve records from Oracle DB and store the same into a dataset.  Return
the dataset as XML string via the command DataSet.GetXML.

 

Flex
In the event handler of my webservice method call, I parse the string into
XML, then ArrayCollection via the following codes:

 

private var _xmlData:XML;
[Bindable] private var arrDP:ArrayCollection = new ArrayCollection;

_xmlData = XML(event.result);
var oTemp:Object;
var xl:XMLList = _xmlData.children();

var i:int;
for(i = 0; i  xl.length(); i++)  
{
 oTemp = {NAME:xl[i].NAME.text(), TEAM:xl[i].TEAM.text(), 
JERSEY:xl[i].JERSEY.text(), MANAGER:xl[i].MANAGER.text()};
 arrDP.addItem(oTemp);
}

 

and in my datagrid, I am setting its dataProvider to the arrDP variable.

 

I used Array Collection because I implemented a search and filter
functionality which searches and filters the data accordingly for the
dataprovider which is then reflected back to the datagrid.

Now, when I need to return the ArrayCollection to .NET, I simply pass the
same as a parameter to a .NET function which accepts ArrayList as parameter.

 

.NET
Once the function receieves the arraycollection (which is then now an array
list), I get the arrays inside the arraylist and get the values inside the
array. 

 

I think by doing things like this, it may not be the best way.

 

You mentioned you'd map the XML to typed objects in .NET.  How can I do
this?

 

Instead of using arraycollection as dataprovider in my datagrid, can I use
another which would be much easier when I pass back to the .NET function?

 

Whats the best way to interact large set of data (datasets) between .NET and
Flex?

 

Thanks a lot.


 

 

  _  

From: Sam Lai samuel@gmail.com
To: flexcoders@yahoogroups.com
Sent: Friday, 3 July, 2009 13:52:12
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin angelo_anolin@ mailto:angelo_anolin%40yahoo.com
yahoo.com:


 Hi Sam,

 Care to show some examples? I am parsing the arrayCollection into an
 ArrayList on .NET.  This is particularly not too appealing since I just
 discovered that for example, if one of the objects in the arraycollection
 would have an empty string value, the number of items inside the array is
 not reflected properly in .NET.

 Like:

 private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:001 ,
 Value:Select },
 {ID:002,
 Value:Choose },
 {ID:003,
 Value:},]) ;

 When I pass this var arrR into a .NET webservice and delegate it to an
 ArrayList, the items in the array list will have one of the arrays only
 containing 1 item (instead of 2).

 Adding to my problem is the fact that the arrays inside the array list
when
 read in .NET should have the object ID and Value be in order but they are
 not.  This is further true when there are many items in the array
 collection.  Sometimes, the first item becomes the last one in the array
 list, and sometimes the order is not well.

 In any case, I am finding a solution on how I would be able to pass an
 ArrayCollection to .NET and be able to parse it properly.

 Thanks.

  _ _ __
 From: Sam Lai samuel@gmail. com mailto:samuel.lai%40gmail.com 
 To: flexcod...@yahoogro ups.com mailto:flexcoders%40yahoogroups.com 
 Sent: Thursday, 2 July, 2009 15:46:58
 Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order
When
 Passed to .NET WebService

 How is it being parsed in .NET? You can parse it into a hashtable, or
 better yet, use a pre-defined object.

 Not sure why the order is different, but it is probably fragile to
 rely on the order in this case.

 2009/7/2 Angelo Anolin angelo_anolin@ yahoo.com:


 Hi FlexCoders,

 I have an array

Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

2009-07-03 Thread Angelo Anolin
Hi Sam,
Basically this is the process which I am using.

.NET
Retrieve records from Oracle DB and store the same into a dataset.  Return the 
dataset as XML string via the command DataSet.GetXML.

Flex
In the event handler of my webservice method call, I parse the string into XML, 
then ArrayCollection via the following codes:

private var _xmlData:XML;
[Bindable] private var arrDP:ArrayCollection = new ArrayCollection;
_xmlData = XML(event.result);
var oTemp:Object;
var xl:XMLList = _xmlData.children();
var i:int;
for(i = 0; i  xl.length(); i++)  
{
 oTemp = {NAME:xl[i].NAME.text(), TEAM:xl[i].TEAM.text(), 
    JERSEY:xl[i].JERSEY.text(), MANAGER:xl[i].MANAGER.text()};
 arrDP.addItem(oTemp);
}

and in my datagrid, I am setting its dataProvider to the arrDP variable.

I used Array Collection because I implemented a search and filter functionality 
which searches and filters the data accordingly for the dataprovider which is 
then reflected back to the datagrid.
Now, when I need to return the ArrayCollection to .NET, I simply pass the same 
as a parameter to a .NET function which accepts ArrayList as parameter.

.NET
Once the function receieves the arraycollection (which is then now an array 
list), I get the arrays inside the arraylist and get the values inside the 
array. 

I think by doing things like this, it may not be the best way.

You mentioned you'd map the XML to typed objects in .NET.  How can I do this?

Instead of using arraycollection as dataprovider in my datagrid, can I use 
another which would be much easier when I pass back to the .NET function?

Whats the best way to interact large set of data (datasets) between .NET and 
Flex?

Thanks a lot.

 




From: Sam Lai samuel@gmail.com
To: flexcoders@yahoogroups.com
Sent: Friday, 3 July, 2009 13:52:12
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When 
Passed to .NET WebService





Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin angelo_anolin@ yahoo.com:


 Hi Sam,

 Care to show some examples? I am parsing the arrayCollection into an
 ArrayList on .NET.  This is particularly not too appealing since I just
 discovered that for example, if one of the objects in the arraycollection
 would have an empty string value, the number of items inside the array is
 not reflected properly in .NET.

 Like:

 private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:001 ,
 Value:Select },
 {ID:002,
 Value:Choose },
     {ID:003,
 Value:},]) ;

 When I pass this var arrR into a .NET webservice and delegate it to an
 ArrayList, the items in the array list will have one of the arrays only
 containing 1 item (instead of 2).

 Adding to my problem is the fact that the arrays inside the array list when
 read in .NET should have the object ID and Value be in order but they are
 not.  This is further true when there are many items in the array
 collection.  Sometimes, the first item becomes the last one in the array
 list, and sometimes the order is not well.

 In any case, I am finding a solution on how I would be able to pass an
 ArrayCollection to .NET and be able to parse it properly.

 Thanks.

  _ _ __
 From: Sam Lai samuel@gmail. com
 To: flexcod...@yahoogro ups.com
 Sent: Thursday, 2 July, 2009 15:46:58
 Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
 Passed to .NET WebService

 How is it being parsed in .NET? You can parse it into a hashtable, or
 better yet, use a pre-defined object.

 Not sure why the order is different, but it is probably fragile to
 rely on the order in this case.

 2009/7/2 Angelo Anolin angelo_anolin@ yahoo.com:


 Hi FlexCoders,

 I have an array collection which I am populating as follows:

 var oTemp:Object;
 var xl:XMLList = _xmlData.children( );
 var i:int;
 for(i = 0; i  xl.length(); i++)
 {
  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
 DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
 IND_TAG:xl[i] .IND.text( )};
  arrDP.addItem( oTemp);
 }
 Now, when I pass back this Array Collection back into a web service, the
 fields are not in order as I have added them into the array collection.

 I am expecting that in my Web Service, when I parse this arraycollection
 (via arraylist), I would be getting the same order of columns as I have
 added them, i.e. the first array in the array list would have element 0 to
 be the value I placed in the ID.

 Since the arraylist does

Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

2009-07-03 Thread Sam Lai
I just wrote up a simple C# web service that accepts an ArrayList:

[WebMethod]
public bool ArrayListTest(System.Collections.ArrayList a)
{ ... }

Then in Flex I wrote this,

mx:Script
![CDATA[
import mx.collections.ArrayCollection;
private function sendWebServiceCall():void
{
trace(appComplete);
ws.ArrayListTest(new ArrayCollection([ 
{name:bob, id:808 }, {
name:fred, id: }]));
}
]]
/mx:Script
mx:WebService wsdl=http://localhost:63868/Service1.asmx?WSDL; id=ws
mx:operation name=ArrayListTest result=trace(event.result)
 fault=trace(event.fault.faultString)/
/mx:WebService

When sendWebServiceCall is triggered, it calls the C# web service and
passes the ArrayCollection to it.

In the web service, the ArrayCollection is received as an array list
of XmlNodes. Each XmlNode contains a node for each field, even if it
is an empty string.

tns:id xmlns:tns=http://tempuri.org/;808/tns:id
tns:name xmlns:tns=http://tempuri.org/;bob/tns:name

tns:id xmlns:tns=http://tempuri.org/;/tns:id
tns:name xmlns:tns=http://tempuri.org/;fred/tns:name

Is this anything like what you're getting? The edge case you described
in another email about an empty string causing problems doesn't seem
to cause problems.

Also see inline.

2009/7/3 Angelo Anolin angelo_ano...@yahoo.com:
 I think by doing things like this, it may not be the best way.

 You mentioned you'd map the XML to typed objects in .NET.  How can I do
 this?

As you're using a dataset, this isn't really an option. A dataset as
opposed to a collection of typed objects are two ways of handling data
from data sources; it is arguable which way is better.

The problem in your case, is that the XML generated as a result of
passing an ArrayCollection to a web service method cannot be passed
into the dataset's readXml method. (Even if it could by inferring a
schema, it would be different to your database's schema.)

The only way I know of to do seamless transfer of data without having
to parse XML is to use WebORB. Otherwise you will have to parse the
XML produced on both sides to re-create the dataset/object.

 Instead of using arraycollection as dataprovider in my datagrid, can I use
 another which would be much easier when I pass back to the .NET function?

I wonder if it is possible to bind your datagrid directly to the e4x
XML? That way you can pass the entire XML doc back to .NET via the web
service, and hence you can re-create the dataset using
dataset.readXML.

 
 From: Sam Lai samuel@gmail.com
 To: flexcoders@yahoogroups.com
 Sent: Friday, 3 July, 2009 13:52:12
 Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
 Passed to .NET WebService

 Instead of using an array list and trying to emulate the type-less
 abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
 does the XML from your Flex app differ too wildly to do this?

 Are you using the XmlSerializer to deserialize this? Or are you using
 WCF? Or are you doing it some other way, or manually?

 I'd provide an example, but I don't know enough details on your
 situation to give something useful :)

 2009/7/3 Angelo Anolin angelo_anolin@ yahoo.com:


 Hi Sam,

 Care to show some examples? I am parsing the arrayCollection into an
 ArrayList on .NET.  This is particularly not too appealing since I just
 discovered that for example, if one of the objects in the arraycollection
 would have an empty string value, the number of items inside the array is
 not reflected properly in .NET.

 Like:

 private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:001 ,
 Value:Select },
 {ID:002,
 Value:Choose },
     {ID:003,
 Value:},]) ;

 When I pass this var arrR into a .NET webservice and delegate it to an
 ArrayList, the items in the array list will have one of the arrays only
 containing 1 item (instead of 2).

 Adding to my problem is the fact that the arrays inside the array list
 when
 read in .NET should have the object ID and Value be in order but they are
 not.  This is further true when there are many items in the array
 collection.  Sometimes, the first item becomes the last one in the array
 list, and sometimes the order is not well.

 In any case, I am finding a solution on how I would be able to pass an
 ArrayCollection to .NET and be able to parse it properly.

 Thanks.

  _ _ __
 From: Sam Lai samuel@gmail. com
 To: flexcod...@yahoogro ups.com
 Sent: Thursday, 2 July, 2009 15:46:58
 Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order
 When
 Passed to .NET WebService

 How is it being parsed in .NET? You can parse it into a hashtable, or
 better yet, use a pre-defined object.

 Not sure why the order

Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

2009-07-02 Thread Sam Lai
How is it being parsed in .NET? You can parse it into a hashtable, or
better yet, use a pre-defined object.

Not sure why the order is different, but it is probably fragile to
rely on the order in this case.

2009/7/2 Angelo Anolin angelo_ano...@yahoo.com:


 Hi FlexCoders,

 I have an array collection which I am populating as follows:

 var oTemp:Object;
 var xl:XMLList = _xmlData.children();
 var i:int;
 for(i = 0; i  xl.length(); i++)
 {
  oTemp = {ID_TAG:xl[i].ID.text(), CAT_TAG:xl[i].CAT.text(),
 DET_TAG:xl[i].DET.text(), REP_DATE_TAG:xl[i].REP_DATE.text(),
 IND_TAG:xl[i].IND.text()};
  arrDP.addItem(oTemp);
 }
 Now, when I pass back this Array Collection back into a web service, the
 fields are not in order as I have added them into the array collection.

 I am expecting that in my Web Service, when I parse this arraycollection
 (via arraylist), I would be getting the same order of columns as I have
 added them, i.e. the first array in the array list would have element 0 to
 be the value I placed in the ID.

 Since the arraylist does not have the field tag (represented by ID_TAG,
 DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on my
 part since I can only reference the value via the index on the array.

 Now, how would I be able to include the tags inside array collection such
 that when I read them as an array list in my .NET webservice, I know which
 element I am referring to in a particular index.

 Thanks.

 Regards,
 Angelo


 


Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

2009-07-02 Thread Angelo Anolin
Hi Sam,

Care to show some examples? I am parsing the arrayCollection into an ArrayList 
on .NET.  This is particularly not too appealing since I just discovered that 
for example, if one of the objects in the arraycollection would have an empty 
string value, the number of items inside the array is not reflected properly in 
.NET.

Like:

private var arrR:ArrayCollection = new ArrayCollection([{ID:001, 
Value:Select},
{ID:002, 
Value:Choose},
    {ID:003, Value:},]);

When I pass this var arrR into a .NET webservice and delegate it to an 
ArrayList, the items in the array list will have one of the arrays only 
containing 1 item (instead of 2).

Adding to my problem is the fact that the arrays inside the array list when 
read in .NET should have the object ID and Value be in order but they are not.  
This is further true when there are many items in the array collection.  
Sometimes, the first item becomes the last one in the array list, and sometimes 
the order is not well.

In any case, I am finding a solution on how I would be able to pass an 
ArrayCollection to .NET and be able to parse it properly.

Thanks.





From: Sam Lai samuel@gmail.com
To: flexcoders@yahoogroups.com
Sent: Thursday, 2 July, 2009 15:46:58
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When 
Passed to .NET WebService





How is it being parsed in .NET? You can parse it into a hashtable, or
better yet, use a pre-defined object.

Not sure why the order is different, but it is probably fragile to
rely on the order in this case.

2009/7/2 Angelo Anolin angelo_anolin@ yahoo.com:


 Hi FlexCoders,

 I have an array collection which I am populating as follows:

 var oTemp:Object;
 var xl:XMLList = _xmlData.children( );
 var i:int;
 for(i = 0; i  xl.length(); i++)
 {
  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
 DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
 IND_TAG:xl[i] .IND.text( )};
  arrDP.addItem( oTemp);
 }
 Now, when I pass back this Array Collection back into a web service, the
 fields are not in order as I have added them into the array collection.

 I am expecting that in my Web Service, when I parse this arraycollection
 (via arraylist), I would be getting the same order of columns as I have
 added them, i.e. the first array in the array list would have element 0 to
 be the value I placed in the ID.

 Since the arraylist does not have the field tag (represented by ID_TAG,
 DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on my
 part since I can only reference the value via the index on the array.

 Now, how would I be able to include the tags inside array collection such
 that when I read them as an array list in my .NET webservice, I know which
 element I am referring to in a particular index.

 Thanks.

 Regards,
 Angelo


 




  

Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

2009-07-02 Thread Sam Lai
Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin angelo_ano...@yahoo.com:


 Hi Sam,

 Care to show some examples? I am parsing the arrayCollection into an
 ArrayList on .NET.  This is particularly not too appealing since I just
 discovered that for example, if one of the objects in the arraycollection
 would have an empty string value, the number of items inside the array is
 not reflected properly in .NET.

 Like:

 private var arrR:ArrayCollection = new ArrayCollection([{ID:001,
 Value:Select},
 {ID:002,
 Value:Choose},
     {ID:003,
 Value:},]);

 When I pass this var arrR into a .NET webservice and delegate it to an
 ArrayList, the items in the array list will have one of the arrays only
 containing 1 item (instead of 2).

 Adding to my problem is the fact that the arrays inside the array list when
 read in .NET should have the object ID and Value be in order but they are
 not.  This is further true when there are many items in the array
 collection.  Sometimes, the first item becomes the last one in the array
 list, and sometimes the order is not well.

 In any case, I am finding a solution on how I would be able to pass an
 ArrayCollection to .NET and be able to parse it properly.

 Thanks.

 
 From: Sam Lai samuel@gmail.com
 To: flexcoders@yahoogroups.com
 Sent: Thursday, 2 July, 2009 15:46:58
 Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
 Passed to .NET WebService

 How is it being parsed in .NET? You can parse it into a hashtable, or
 better yet, use a pre-defined object.

 Not sure why the order is different, but it is probably fragile to
 rely on the order in this case.

 2009/7/2 Angelo Anolin angelo_anolin@ yahoo.com:


 Hi FlexCoders,

 I have an array collection which I am populating as follows:

 var oTemp:Object;
 var xl:XMLList = _xmlData.children( );
 var i:int;
 for(i = 0; i  xl.length(); i++)
 {
  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
 DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
 IND_TAG:xl[i] .IND.text( )};
  arrDP.addItem( oTemp);
 }
 Now, when I pass back this Array Collection back into a web service, the
 fields are not in order as I have added them into the array collection.

 I am expecting that in my Web Service, when I parse this arraycollection
 (via arraylist), I would be getting the same order of columns as I have
 added them, i.e. the first array in the array list would have element 0 to
 be the value I placed in the ID.

 Since the arraylist does not have the field tag (represented by ID_TAG,
 DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
 my
 part since I can only reference the value via the index on the array.

 Now, how would I be able to include the tags inside array collection such
 that when I read them as an array list in my .NET webservice, I know which
 element I am referring to in a particular index.

 Thanks.

 Regards,
 Angelo






 


[flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

2009-07-01 Thread Angelo Anolin
Hi FlexCoders,

I have an array collection which I am populating as follows:

var oTemp:Object;
var xl:XMLList = _xmlData.children();
var i:int;
for(i = 0; i  xl.length(); i++)  
{
 oTemp = {ID_TAG:xl[i].ID.text(), CAT_TAG:xl[i].CAT.text(), 
DET_TAG:xl[i].DET.text(), REP_DATE_TAG:xl[i].REP_DATE.text(), 
IND_TAG:xl[i].IND.text()};
 arrDP.addItem(oTemp);
}

Now, when I pass back this Array Collection back into a web service, the fields 
are not in order as I have added them into the array collection.

I am expecting that in my Web Service, when I parse this arraycollection (via 
arraylist), I would be getting the same order of columns as I have added them, 
i.e. the first array in the array list would have element 0 to be the value I 
placed in the ID.

Since the arraylist does not have the field tag (represented by ID_TAG, 
DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on my 
part since I can only reference the value via the index on the array.

Now, how would I be able to include the tags inside array collection such that 
when I read them as an array list in my .NET webservice, I know which element I 
am referring to in a particular index.

Thanks.

Regards,
Angelo


  

[flexcoders] ArrayCollection/Min Max Problem

2009-06-30 Thread Sherif Abdou
I have an array collection and I am trying to find the Min/Max of the values in 
groups. For Example my array collection has 100 values. I want to find the Min 
Value/Max Value between 1 to 26, 2 to 27, 3 to 28 , etc I tried to create 2 
for loops in each other but for some reason during debugging/tracing it outputs 
wrong numbers, but if i do breakpoint then step in. I get the correct values. 
So the question is is there a better way than what i am doing. I am just trying 
to create a Stochastic formula. 


  

Re: [flexcoders] ArrayCollection/Min Max Problem

2009-06-30 Thread Sam Lai
Maybe your trace statement is in the wrong place? Seeing your code
would help in solving the problem.

Another way to solve these problems is to sort the data (sub)set, then
just pull the first and last elements. Depending on what you want to
do with the data after, this may be faster.

2009/7/1 Sherif Abdou sherif...@yahoo.com:


 I have an array collection and I am trying to find the Min/Max of the values
 in groups. For Example my array collection has 100 values. I want to find
 the Min Value/Max Value between 1 to 26, 2 to 27, 3 to 28 , etc I tried
 to create 2 for loops in each other but for some reason during
 debugging/tracing it outputs wrong numbers, but if i do breakpoint then step
 in. I get the correct values. So the question is is there a better way than
 what i am doing. I am just trying to create a Stochastic formula.



 


[flexcoders] ArrayCollection and Datagrid Binding and DataProvider Question

2009-06-11 Thread Angelo Anolin
Good day.

Learning Flex here for the past two (like three actually) weeks.  Using only 
mxml compiler.

I have a question with regards to the above subject:

Assuming I declared an ArrayCollection as follows:

[Bindable] private var _arrItems:ArrayCollection = new 
ArrayCollection([{itemNo:1, testItem:Angelo}, {itemNo:2, 
testItem:Dinah}]);

This array I am binding to a datagrid as follows:

mx:DataGrid id=dgOutwardList 
  dataProvider={_arrItems} 
  useRollOver=false 
  height=450
  width=100% 
  verticalScrollPolicy=auto 
  sortableColumns=false 
  draggableColumns=false 
  resizableColumns=false
 mx:columns
 mx:DataGridColumn headerText= dataField=itemNo width=20/
 mx:DataGridColumn headerText=Name of Passengers dataField=testItem 
width=200
  mx:itemRenderer
   mx:Component
mx:TextInput width=100% /
   /mx:Component
  /mx:itemRenderer
 /mx:DataGridColumn
 
 /mx:columns
/mx:DataGrid

No problem initially, as the itemNo and the testItem values are displayed 
properly on the datagrid.

Now for example, if I modified my first row which contains itemNo:1 and 
testItem:Angelo, where I changed Angelo to Mickey, will the dataprovider 
reflect the change in the said row?
How do I make so that the changes in the datagrid be reflected into the 
ArrayCollection?  such that when I changed the testItem data for the first row 
and access the item, via:

_arrItems.getItemAt(arrLength -1).itemNo
_arrItems.getItemAt(arrLength -1).testItem

The result would be 1 and Mickey respectively?

I am a bit puzzled on how databinding actually works in Flex. Is it like a 
two-way live update (such that when you modify the value in the datagrid, it is 
reflected back to the arraycollection)?

Would love to hear your inputs.

Thanks and regards,
Angelo


  

[flexcoders] ArrayCollection to Delimited String

2009-06-04 Thread Angelo Anolin
Hi FlexCoders,

Supposed I have an ArrayCollection variable represented like below:

mx:ArrayCollection id=myAC
 mx:Array id=myArray
  mx:Object label=MI data=Lansing/
  mx:Object label=MO data=Jefferson City/
  mx:Object label=MA data=Boston/
  mx:Object label=MT data=Helena/
  mx:Object label=ME data=Augusta/
  mx:Object label=MS data=Jackson/
  mx:Object label=MN data=Saint Paul/
 /mx:Array
/mx:ArrayCollection

I want to store the same in a String variable where the resulting string would 
be like:

var ResultString:String;
ResultString = MI|Lansing||MO|Jefferson 
City||MA|Boston||MT|Helena||ME|Augusta||MS|Jackson||MN|Saint Paul||

How do I achieve this?

Inputs highly appreciated. Thanks.

Regards,

Angelo


  

[flexcoders] ArrayCollection | DataGrid | SortonColumn

2009-04-08 Thread ilikeflex
Hi 

I have datagrid with 150 records. I do sorting when someone clicks on datagrid. 
And i am using the ArrayCollection as dataprovider to the datagrid.When user 
changes the option in combo box then show the new data in the datagrid.

In my command class i am doing 

MessagesModel.getInstance().messageList.removeAll();
and then adding the new records.

Sometime i am getting the error
RangeError: Index '-1' specified is out of bounds.

but if i do not do the sort everthing is fine.

Any pointers ...

Thanks
ilikeflex



RE: [flexcoders] ArrayCollection | DataGrid | SortonColumn

2009-04-08 Thread Alex Harui
A full stack trace with line numbers is like a fingerprint.  Very helpful when 
doing detective work.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of ilikeflex
Sent: Wednesday, April 08, 2009 12:06 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection | DataGrid | SortonColumn





Hi

I have datagrid with 150 records. I do sorting when someone clicks on datagrid. 
And i am using the ArrayCollection as dataprovider to the datagrid.When user 
changes the option in combo box then show the new data in the datagrid.

In my command class i am doing

MessagesModel.getInstance().messageList.removeAll();
and then adding the new records.

Sometime i am getting the error
RangeError: Index '-1' specified is out of bounds.

but if i do not do the sort everthing is fine.

Any pointers ...

Thanks
ilikeflex



[flexcoders] arraycollection vs listcollectionview

2009-03-27 Thread arieljake
I'm confused.

I have an ArrayCollection. And I listen for the COLLECTION_CHANGE.Remove event 
to know when to delete the item from the database.

For displaying the contents of my ArrayCollection, i am using a 
ListCollectionView with a filter function applied to it, so that the filter 
function does not affect all views using the same ArrayCollection.

But, when I change the value of a property on an item in the ArrayCollection 
that causes the filter to now filter OUT the item, the ListCollectionView 
dispatches a COLLECTION_CHANGE.Remove event.

This causes my code to remove the item from the db, undesirably.

Now I understand that the ListCollectionView must dispatch these events to 
update the ListBase, but why isn't the target different so that I can tell 
whether the Remove event came from the ArrayCollection itself or just a 
ListCollectionView of it? 



RE: [flexcoders] arraycollection vs listcollectionview

2009-03-27 Thread Scott
That's a nasty little bug.

 

I haven't encountered that myself yet but I can see where that would
happen.

 

You may want to change your remove function to fire only on a button
click and not a component update (component.remove).

 

 Scott

 



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of arieljake
Sent: Friday, March 27, 2009 1:33 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] arraycollection vs listcollectionview

 

I'm confused.

I have an ArrayCollection. And I listen for the COLLECTION_CHANGE.Remove
event to know when to delete the item from the database.

For displaying the contents of my ArrayCollection, i am using a
ListCollectionView with a filter function applied to it, so that the
filter function does not affect all views using the same
ArrayCollection.

But, when I change the value of a property on an item in the
ArrayCollection that causes the filter to now filter OUT the item, the
ListCollectionView dispatches a COLLECTION_CHANGE.Remove event.

This causes my code to remove the item from the db, undesirably.

Now I understand that the ListCollectionView must dispatch these events
to update the ListBase, but why isn't the target different so that I can
tell whether the Remove event came from the ArrayCollection itself or
just a ListCollectionView of it? 




-- 
This message has been scanned for viruses and 
dangerous content by MailScanner http://www.mailscanner.info/ , and is

believed to be clean. 


RE: [flexcoders] arraycollection vs listcollectionview

2009-03-27 Thread Alex Harui
You should be able to get what you want if you set it up correctly.  The AC and 
LCV should be separate instances sharing the same source or list property

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Scott
Sent: Friday, March 27, 2009 4:57 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] arraycollection vs listcollectionview

That's a nasty little bug.

I haven't encountered that myself yet but I can see where that would happen.

You may want to change your remove function to fire only on a button click and 
not a component update (component.remove).

 Scott


From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of arieljake
Sent: Friday, March 27, 2009 1:33 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] arraycollection vs listcollectionview


I'm confused.

I have an ArrayCollection. And I listen for the COLLECTION_CHANGE.Remove event 
to know when to delete the item from the database.

For displaying the contents of my ArrayCollection, i am using a 
ListCollectionView with a filter function applied to it, so that the filter 
function does not affect all views using the same ArrayCollection.

But, when I change the value of a property on an item in the ArrayCollection 
that causes the filter to now filter OUT the item, the ListCollectionView 
dispatches a COLLECTION_CHANGE.Remove event.

This causes my code to remove the item from the db, undesirably.

Now I understand that the ListCollectionView must dispatch these events to 
update the ListBase, but why isn't the target different so that I can tell 
whether the Remove event came from the ArrayCollection itself or just a 
ListCollectionView of it?

--
This message has been scanned for viruses and
dangerous content by MailScannerhttp://www.mailscanner.info/, and is
believed to be clean.



[flexcoders] Arraycollection to xml

2009-03-20 Thread venkat eswar
Hi all,



I am using advanceddatagrid with treestructure. I used Arraycollection
as Dataprovider for advanceddatagrid.Now i want to convert the
Arraycollection to xml for storing it to database with php as backend.
How is it possible. Please help me




  

[flexcoders] ArrayCollection or XML

2009-03-11 Thread tiend...@ezweb.ne.jp
Hi all guru,

[Database Table]
id
firstname
lastname

At Backend I use PHP and Mysql. PHP script can return Array or XML string.
At Flex app, I use Remote Object

1)PHP script return Array:
and in Flex code I get Array as :

dp = new ArrayCollection( ArrayUtil.toArray(event.result));

If I show dp in Datagrid or List, TileList - it OK . But I want to get value 
of firstname , lastname into textbox . I don't know , can flex do that ? And 
how to get value from ArrayCollection.

2)PHP script return XML string :

I don't know how to parse XML string and show result in textbox. And how to get 
value from XML string.

Please help me or any idea

Thanks






RE: [flexcoders] ArrayCollection or XML

2009-03-11 Thread Tracy Spratt
In all cases, use the appropriate API to navigate to the desired data
object, then access the data via the methods and properties provided by that
object.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of tiend...@ezweb.ne.jp
Sent: Wednesday, March 11, 2009 9:20 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection or XML

 

Hi all guru,

[Database Table]
id
firstname
lastname

At Backend I use PHP and Mysql. PHP script can return Array or XML string.
At Flex app, I use Remote Object

1)PHP script return Array:
and in Flex code I get Array as :

dp = new ArrayCollection( ArrayUtil.toArray(event.result));

If I show dp in Datagrid or List, TileList - it OK . But I want to get
value of firstname , lastname into textbox . I don't know , can flex do that
? And how to get value from ArrayCollection.

2)PHP script return XML string :

I don't know how to parse XML string and show result in textbox. And how to
get value from XML string.

Please help me or any idea

Thanks





[flexcoders] ArrayCollection vs XMLListCollection

2009-02-22 Thread brad.bueche
How come when I'm setting up a data grid using an ArrayCollection as 
the datasource I dont have to specify the contents of the data grid 
columns?  I can just do this:

mx:DataGrid id=dg1 x=42 y=0 width=950 height=100 
 dataProvider={bookData.lastResult.books.stock} /

But in order to get anything to appear on the data grid with either XML 
or XMLListCollection I have to do the column layout (like this)?

mx:DataGrid id=dg3 x=42 y=300 width=950 height=100
 dataProvider={bookStock2} 
 mx:columns
  mx:DataGridColumn dataField=name headerText=name/
  mx:DataGridColumn dataField=author headerText=author/
  mx:DataGridColumn dataField=categoryheaderText=category/
  mx:DataGridColumn dataField=description headerText=description/
 /mx:columns
/mx:DataGrid

Thanks in advance,
brad



Re: [flexcoders] ArrayCollection vs XMLListCollection

2009-02-22 Thread Jeffry Houser

 Some code magic in the background. 
 I bet if you drill down into the component code for DataGrid and/or 
DataGridColumn you'll find comments that explain this.

 If I had to guess, it is relatively [knock on wood] easy to parse an 
object and find the properties on it.  I think a for loop will do it.

 But, XML is much open in terms of where do I find data than an 
ArrayCollection of objects would be.


brad.bueche wrote:
 How come when I'm setting up a data grid using an ArrayCollection as 
 the datasource I dont have to specify the contents of the data grid 
 columns?  I can just do this:

 mx:DataGrid id=dg1 x=42 y=0 width=950 height=100 
dataProvider={bookData.lastResult.books.stock} /

 But in order to get anything to appear on the data grid with either XML 
 or XMLListCollection I have to do the column layout (like this)?

 mx:DataGrid id=dg3 x=42 y=300 width=950 height=100
dataProvider={bookStock2} 
  mx:columns
   mx:DataGridColumn dataField=name headerText=name/
   mx:DataGridColumn dataField=author headerText=author/
   mx:DataGridColumn dataField=categoryheaderText=category/
   mx:DataGridColumn dataField=description headerText=description/
  /mx:columns
 /mx:DataGrid

 Thanks in advance,
 brad



 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links




   

-- 
Jeffry Houser, Technical Entrepreneur
Adobe Community Expert: http://tinyurl.com/684b5h
http://www.twitter.com/reboog711  | Phone: 203-379-0773
--
Easy to use Interface Components for Flex Developers
http://www.flextras.com?c=104
--
http://www.theflexshow.com
http://www.jeffryhouser.com
--
Part of the DotComIt Brain Trust




RE: [flexcoders] ArrayCollection vs XMLListCollection

2009-02-22 Thread Alex Harui
If you don't specify columns, the DataGrid uses ObjectUtil.getClassInfo to get 
the list of properties.  For XML, getClassInfo returns the attributes and not 
the child nodes

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Jeffry Houser
Sent: Sunday, February 22, 2009 2:24 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection vs XMLListCollection


Some code magic in the background.
I bet if you drill down into the component code for DataGrid and/or
DataGridColumn you'll find comments that explain this.

If I had to guess, it is relatively [knock on wood] easy to parse an
object and find the properties on it. I think a for loop will do it.

But, XML is much open in terms of where do I find data than an
ArrayCollection of objects would be.

brad.bueche wrote:
 How come when I'm setting up a data grid using an ArrayCollection as
 the datasource I dont have to specify the contents of the data grid
 columns? I can just do this:

 mx:DataGrid id=dg1 x=42 y=0 width=950 height=100
 dataProvider={bookData.lastResult.books.stock} /

 But in order to get anything to appear on the data grid with either XML
 or XMLListCollection I have to do the column layout (like this)?

 mx:DataGrid id=dg3 x=42 y=300 width=950 height=100
 dataProvider={bookStock2} 
 mx:columns
 mx:DataGridColumn dataField=name headerText=name/
 mx:DataGridColumn dataField=author headerText=author/
 mx:DataGridColumn dataField=categoryheaderText=category/
 mx:DataGridColumn dataField=description headerText=description/
 /mx:columns
 /mx:DataGrid

 Thanks in advance,
 brad



 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links






--
Jeffry Houser, Technical Entrepreneur
Adobe Community Expert: http://tinyurl.com/684b5h
http://www.twitter.com/reboog711 | Phone: 203-379-0773
--
Easy to use Interface Components for Flex Developers
http://www.flextras.com?c=104
--
http://www.theflexshow.com
http://www.jeffryhouser.com
--
Part of the DotComIt Brain Trust



Re: [flexcoders] ArrayCollection DataProvider question.

2009-02-11 Thread - -
Hi Tracy, this is how I get the XML info into an ArrayCollection:

mx:HTTPServiceurl=days.php useProxy=false method=POST id=Days 
resultFormat=e4x result=get_days(event)

privatefunctionget_days(event:ResultEvent):void{
Arraydays.removeAll();
XMLdays = event.result asXML;foreach(varourxml:XML inXMLdays.elements()) 
Arraydays.addItem(ourxml);}

Is this ok?

Thanks

-David




From: Tracy Spratt tspr...@lariatinc.com
To: flexcoders@yahoogroups.com
Sent: Tuesday, February 10, 2009 4:19:53 PM
Subject: RE: [flexcoders] ArrayCollection DataProvider question.


I suggest using e4x expressions against the XML, and then putting the result in 
an XMLListCollection.
var xlResults:XMLList = xmlData.result. (attribute(“id”) == “1”);
trace(xlResults. toXMLString( ));  //to verify your data
xlcResults = new XMLListCollection( xlResults) ;
 
You did not say how you got your XML into an ArrayCollection, but I suspect it 
is not the good way.
Tracy Spratt
Lariat Services
Flex development bandwidth available



From:flexcod...@yahoogro ups.com [mailto:flexcoders@ yahoogroups. com] On 
Behalf Of Henrique
Sent: Tuesday, February 10, 2009 2:19 PM
To: flexcod...@yahoogro ups.com
Subject: Re: [flexcoders] ArrayCollection DataProvider question.
 
Humm, you have to make a filterFunction, like this:
 
private function filterFucntion( item:Object) :Boolean
{
   return item.id == 1;
}
 
Henrique F. Marino
blog.dclick. com.br
www.dclick.com. br
On Tue, Feb 10, 2009 at 3:35 PM, sailorsea21 sailorsea21@ yahoo.com wrote:
I loaded the following xml as an ArrayCollection. 

data
result id=1
datetoday/date
yes13154/yes
no654321/no 
/result
result id=1
dateyesterday/date
yes21354/yes
no5468432/no 
/result
result id=2
datetoday/date
yes2665/yes
no4256/no 
/result
result id=2
dateyesterday/date
yes7425/yes
no7542/no 
/result
/data

How can I use this as a dataprovider but only using the values in 
result id=1 and not result id=2?

My arraycollection var is Arraydays.
I tried {Arraydays.( @id=='2')} but it gave me an error: Error #1123: 
Filter operator...

Thanks.
 



  

RE: [flexcoders] ArrayCollection DataProvider question.

2009-02-11 Thread Tracy Spratt
That is not as bad as I thought it might be(I was expecting to see the
default resultFormat.  E4x is good!), but it is a bit odd.  You are
manually building an ArrayCollection of XML nodes.

 

I don't see any reason to do that.  Just use XMLListCollection, and
avoid the loop.

 

Now, best practice, or at least this list's apparent consensus of best
practice, is to do what you are doing, but instead of adding xml nodes,
you populate a strongly data typed Value Object and add tht to the
ArrayCollection.  This is probably the most efficient and performant
approach.

 

But I mostly use XML and XMLListCollection.

Tracy Spratt 
Lariat Services 

Flex development bandwidth available 



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of - -
Sent: Wednesday, February 11, 2009 9:37 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection DataProvider question.

 

Hi Tracy, this is how I get the XML info into an ArrayCollection:

 

mx:HTTPService url=days.php useProxy=false method=POST id=Days
resultFormat=e4x result=get_days(event)

 

private function get_days(event:ResultEvent):void

{

Arraydays.removeAll();

XMLdays = event.result as XML;

for each(var ourxml:XML in XMLdays.elements())
Arraydays.addItem(ourxml);

}

Is this ok?

 

Thanks

 

-David

 



From: Tracy Spratt tspr...@lariatinc.com
To: flexcoders@yahoogroups.com
Sent: Tuesday, February 10, 2009 4:19:53 PM
Subject: RE: [flexcoders] ArrayCollection DataProvider question.

I suggest using e4x expressions against the XML, and then putting the
result in an XMLListCollection.

var xlResults:XMLList = xmlData.result. (attribute(id) == 1);

trace(xlResults. toXMLString( ));  //to verify your data

xlcResults = new XMLListCollection( xlResults) ;

 

You did not say how you got your XML into an ArrayCollection, but I
suspect it is not the good way.

Tracy Spratt 
Lariat Services 

Flex development bandwidth available 



From: flexcod...@yahoogro ups.com http://ups.com/  [mailto:flexcoders@
yahoogroups. com] On Behalf Of Henrique
Sent: Tuesday, February 10, 2009 2:19 PM
To: flexcod...@yahoogro ups.com
Subject: Re: [flexcoders] ArrayCollection DataProvider question.

 

Humm, you have to make a filterFunction, like this:

 

private function filterFucntion( item:Object) :Boolean

{

   return item.id http://item.id/  == 1;

}

 

Henrique F. Marino

blog.dclick. com.br http://blog.dclick.com.br/ 

www.dclick.com. br http://www.dclick.com.br/ 

On Tue, Feb 10, 2009 at 3:35 PM, sailorsea21 sailorsea21@ yahoo.com
mailto:sailorse...@yahoo.com  wrote:

I loaded the following xml as an ArrayCollection. 

data
result id=1
datetoday/date
yes13154/yes
no654321/no 
/result
result id=1
dateyesterday/date
yes21354/yes
no5468432/no 
/result
result id=2
datetoday/date
yes2665/yes
no4256/no 
/result
result id=2
dateyesterday/date
yes7425/yes
no7542/no 
/result
/data

How can I use this as a dataprovider but only using the values in 
result id=1 and not result id=2?

My arraycollection var is Arraydays.
I tried {Arraydays.( @id=='2')} but it gave me an error: Error #1123: 
Filter operator...

Thanks.

 

 





[flexcoders] ArrayCollection DataProvider question.

2009-02-10 Thread sailorsea21
I loaded the following xml as an ArrayCollection.  

data
  result id=1
datetoday/date
yes13154/yes
no654321/no
  /result
  result id=1
dateyesterday/date
yes21354/yes
no5468432/no
  /result
  result id=2
datetoday/date
yes2665/yes
no4256/no
  /result
  result id=2
dateyesterday/date
yes7425/yes
no7542/no
  /result
/data

How can I use this as a dataprovider but only using the values in 
result id=1 and not result id=2?

My arraycollection var is Arraydays.
I tried {Arraydays.(@id=='2')} but it gave me an error: Error #1123: 
Filter operator...

Thanks.





Re: [flexcoders] ArrayCollection DataProvider question.

2009-02-10 Thread Henrique
Humm, you have to make a filterFunction, like this:
private function filterFucntion(item:Object):Boolean
{
   return item.id == 1;
}

Henrique F. Marino
blog.dclick.com.br
www.dclick.com.br

On Tue, Feb 10, 2009 at 3:35 PM, sailorsea21 sailorse...@yahoo.com wrote:

   I loaded the following xml as an ArrayCollection.

 data
 result id=1
 datetoday/date
 yes13154/yes
 no654321/no
 /result
 result id=1
 dateyesterday/date
 yes21354/yes
 no5468432/no
 /result
 result id=2
 datetoday/date
 yes2665/yes
 no4256/no
 /result
 result id=2
 dateyesterday/date
 yes7425/yes
 no7542/no
 /result
 /data

 How can I use this as a dataprovider but only using the values in
 result id=1 and not result id=2?

 My arraycollection var is Arraydays.
 I tried {Arraydays.(@id=='2')} but it gave me an error: Error #1123:
 Filter operator...

 Thanks.

  



RE: [flexcoders] ArrayCollection DataProvider question.

2009-02-10 Thread Tracy Spratt
I suggest using e4x expressions against the XML, and then putting the
result in an XMLListCollection.

var xlResults:XMLList = xmlData.result.(attribute(id) == 1);

trace(xlResults.toXMLString());  //to verify your data

xlcResults = new XMLListCollection(xlResults);

 

You did not say how you got your XML into an ArrayCollection, but I
suspect it is not the good way.

Tracy Spratt 
Lariat Services 

Flex development bandwidth available 



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Henrique
Sent: Tuesday, February 10, 2009 2:19 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection DataProvider question.

 

Humm, you have to make a filterFunction, like this:

 

private function filterFucntion(item:Object):Boolean

{

   return item.id == 1;

}

 

Henrique F. Marino

blog.dclick.com.br http://blog.dclick.com.br 

www.dclick.com.br http://www.dclick.com.br 

On Tue, Feb 10, 2009 at 3:35 PM, sailorsea21 sailorse...@yahoo.com
mailto:sailorse...@yahoo.com  wrote:

I loaded the following xml as an ArrayCollection. 

data
result id=1
datetoday/date
yes13154/yes
no654321/no 
/result
result id=1
dateyesterday/date
yes21354/yes
no5468432/no 
/result
result id=2
datetoday/date
yes2665/yes
no4256/no 
/result
result id=2
dateyesterday/date
yes7425/yes
no7542/no 
/result
/data

How can I use this as a dataprovider but only using the values in 
result id=1 and not result id=2?

My arraycollection var is Arraydays.
I tried {Arraydays.(@id=='2')} but it gave me an error: Error #1123: 
Filter operator...

Thanks.

 





[flexcoders] ArrayCollection COLLECTION_CHANGE event doesn't fire right away?

2009-01-23 Thread Keith Hughitt
Hi all,

I'm trying to detect changes in an ArrayCollection which is bound to a
DataGrid with some editable components. For some reason, however, the
event only seems to fire when the focus is change. For example, I
check a check-box, and nothing happens. When I then click somewhere
outside of the checkbox, the event is fired. Furthermore, If I check
the box twice before changing focus, nothing at all happens.

Is is possible that the event is only fired when the DataCollection is
refreshed, and that the refresh is not occurring until the focus changes?

Here is an example of what I'm doing (colors is the id for the
DataGrid associated with the colors ArrayC:

import mx.collections.ArrayCollection;
import mx.events.CollectionEvent;
import mx.controls.Alert;

[Bindable]
private var colors:ArrayCollection = new ArrayCollection([
{color:Red, display: true},
{color:Blue, display: true},
{color:Green, display: true}
]);

// Watch for changes to DataGrid CheckBox's
private function init():void {
colors.addEventListener(
CollectionEvent.COLLECTION_CHANGE, onChange
);
}

public function onChange(evt:Event):void {
Alert.show(Datagrid altered!);
}

Any ideas? Any advice would be greatly appreciated.


Thanks!
Keith






RE: [flexcoders] ArrayCollection COLLECTION_CHANGE event doesn't fire right away?

2009-01-23 Thread Alex Harui
DG editing is session and row-based by default.  Data isn't written back to the 
data object until you change cells, and notifications are blocked until you 
change rows.

For click-based cells like checkbox, I usually add a change handler that sets 
the field right away.

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Keith Hughitt
Sent: Friday, January 23, 2009 8:24 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection COLLECTION_CHANGE event doesn't fire 
right away?


Hi all,

I'm trying to detect changes in an ArrayCollection which is bound to a
DataGrid with some editable components. For some reason, however, the
event only seems to fire when the focus is change. For example, I
check a check-box, and nothing happens. When I then click somewhere
outside of the checkbox, the event is fired. Furthermore, If I check
the box twice before changing focus, nothing at all happens.

Is is possible that the event is only fired when the DataCollection is
refreshed, and that the refresh is not occurring until the focus changes?

Here is an example of what I'm doing (colors is the id for the
DataGrid associated with the colors ArrayC:

import mx.collections.ArrayCollection;
import mx.events.CollectionEvent;
import mx.controls.Alert;

[Bindable]
private var colors:ArrayCollection = new ArrayCollection([
{color:Red, display: true},
{color:Blue, display: true},
{color:Green, display: true}
]);

// Watch for changes to DataGrid CheckBox's
private function init():void {
colors.addEventListener(
CollectionEvent.COLLECTION_CHANGE, onChange
);
}

public function onChange(evt:Event):void {
Alert.show(Datagrid altered!);
}

Any ideas? Any advice would be greatly appreciated.

Thanks!
Keith





[flexcoders] arraycollection merge

2008-12-06 Thread hworke


Hi I have three different arraycollections and
I want to bind them all as dataprovider to a 
datagrid. How do I do that? Can a datagrid have
have 3 dataprovider and can it display all these
dataproviders' info at the same time? Or I do
need to merge my three arraycollections into one
and then bind them to the grid? If I do need to
merge the arraycollections together than what is
the easiest way to do so?

Regards



RE: [flexcoders] arraycollection merge

2008-12-06 Thread Alex Harui
This might help: 
http://blogs.adobe.com/aharui/2008/03/custom_ilists_checkboxdatagrid_1.html

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of hworke
Sent: Saturday, December 06, 2008 5:31 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] arraycollection merge



Hi I have three different arraycollections and
I want to bind them all as dataprovider to a
datagrid. How do I do that? Can a datagrid have
have 3 dataprovider and can it display all these
dataproviders' info at the same time? Or I do
need to merge my three arraycollections into one
and then bind them to the grid? If I do need to
merge the arraycollections together than what is
the easiest way to do so?

Regards



Re: [flexcoders] ArrayCollection

2008-11-14 Thread Mike Duncan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tracy Spratt wrote:
 
 
 The issue is that there is only one “lastResult” for the entire framework.
 
  
 
 “There is only one result” No, this is not correct. Because they are
 asynchronous, there can be multiple pending RPC data calls.  There is no
 assurance that the first RPC call is the first returned.

I guess I just have not developed large enough applications to see what
you are stating here. I normally create a HTTPService object then call
1-2 asynchronous calls depending on user interaction with the app.

 
  
 
 Between the time the result returns, lastResult is set, the result event
 is dispatched, calling your handler, and your handler gets to the line
 that uses lastResult, it is very possible that another result has
 returned, overwriting the value in lastResult.  Typically it is actually
 set to null by the framework, rather than sneaking in some other data,
 but that is just as dangerous.  This was a real issue in a thread six or
 eight months ago.

This all really depends on how you develop the application. I am not
saying you are wrong or stating something incorrectly, just that this
example is not relevant to most people creating small/medium apps. Most
people are doing good to even have a single HTTPService object within
their code.

 
  
 
 If you only call a single RPC at a time, there will be no problem, but
 complex apps often have many outstanding calls an a given moment.

Ah, I see. I appreciate the insight.

 
  
 
 Why take any risk?  Is there some reason you **like** lastResult over
 using the event.result object? 

I am not taking a side on anything really. I am just stating that in my
little experience, as well as documentation and other resources read,
that the lastResult-method is used by the vast majority. I personally
appreciate you explaining the lastResult vs. event.result methods.

 
  
 
 Tracy

Thanks Tracy.


Mike Duncan
ISSO, Application Security Specialist
Government Contractor with STG, Inc.
NOAA :: National Climatic Data Center
151 Patton Ave.
Asheville, NC 28801-5001
[EMAIL PROTECTED]
828.271.4289
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJHYjRnvIkv6fg9hYRAp70AJ9OmP12rFwDLt3kpaqnqQy5HUal4QCgh5M+
CQ/SARSS/VwHgD/bnClVvAQ=
=fwzL
-END PGP SIGNATURE-


[flexcoders] ArrayCollection

2008-11-13 Thread jch92592
All,

I am using an ArrayCollection that I populate with the results from a
ColdFusion RPC.

All works well when there is more than 1 record. When only 1 record is
returned, the data is not assigned to the ArrayCollection.

Any suggestions?

Thank you,
jh




RE: [flexcoders] ArrayCollection

2008-11-13 Thread Tracy Spratt
A well known issue.  The FP is unable to differentiate between an Object
and an Array with a single element.

 

I use XML until I have full control, so I don't see this issue.

 

You can examine the result object to see what it really contains and
respond conditionally, or you can use toArray(), which is in one of the
Utils packages.

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of jch92592
Sent: Thursday, November 13, 2008 2:18 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection

 

All,

I am using an ArrayCollection that I populate with the results from a
ColdFusion RPC.

All works well when there is more than 1 record. When only 1 record is
returned, the data is not assigned to the ArrayCollection.

Any suggestions?

Thank you,
jh

 



Re: [flexcoders] ArrayCollection

2008-11-13 Thread Mike Duncan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


This is how I got around this...

- -
import mx.uils.ObjectProxy;
import mx.collections.ArrayCollection;

[Bindable] private scans:ArrayCollection;

private function handleGetScansResults(event:ResultEvent):void  {
  //Note: getScan is a HTTPService object.
  if(getScan.lastResult.vector.scan is ObjectProxy)  {
scans = new ArrayCollection([getScan.lastResult.vector.scan]);
  }else{
scans = getScan.lastResult.vector.scan as ArrayCollection;
  }
}
- -
(sorry for any word wrapping)

Dunno if someone else already suggested this, but I hope this helps.

Mike Duncan
ISSO, Application Security Specialist
Government Contractor with STG, Inc.
NOAA :: National Climatic Data Center
151 Patton Ave.
Asheville, NC 28801-5001
[EMAIL PROTECTED]
828.271.4289


jch92592 wrote:
 
 
 All,
 
 I am using an ArrayCollection that I populate with the results from a
 ColdFusion RPC.
 
 All works well when there is more than 1 record. When only 1 record is
 returned, the data is not assigned to the ArrayCollection.
 
 Any suggestions?
 
 Thank you,
 jh
 
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJHIiSnvIkv6fg9hYRAlGzAKCIblu06TZ3RwHX0CJg8QqRZrRIXACffhUh
DnnU2NWQAOl6jhcSwp03gMk=
=G5aj
-END PGP SIGNATURE-


RE: [flexcoders] ArrayCollection

2008-11-13 Thread Tracy Spratt
Mike, 

It is dangerous to use lastResult in this manner:

scans = new ArrayCollection([getScan.lastResult.vector.scan]);

You are not garrunteed that it will have the value in the result you
expect.

In most cases it will work ok but the correct way is:

scans = new ArrayCollection([event.result.vector.scan]);

 

lastResult is intended only for use in binding expressions.

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mike Duncan
Sent: Thursday, November 13, 2008 3:06 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection

 

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

This is how I got around this...

- -
import mx.uils.ObjectProxy;
import mx.collections.ArrayCollection;

[Bindable] private scans:ArrayCollection;

private function handleGetScansResults(event:ResultEvent):void {
//Note: getScan is a HTTPService object.
if(getScan.lastResult.vector.scan is ObjectProxy) {
scans = new ArrayCollection([getScan.lastResult.vector.scan]);
}else{
scans = getScan.lastResult.vector.scan as ArrayCollection;
}
}
- -
(sorry for any word wrapping)

Dunno if someone else already suggested this, but I hope this helps.

Mike Duncan
ISSO, Application Security Specialist
Government Contractor with STG, Inc.
NOAA :: National Climatic Data Center
151 Patton Ave.
Asheville, NC 28801-5001
[EMAIL PROTECTED] mailto:mike.duncan%40noaa.gov 
828.271.4289

jch92592 wrote:
 
 
 All,
 
 I am using an ArrayCollection that I populate with the results from a
 ColdFusion RPC.
 
 All works well when there is more than 1 record. When only 1 record is
 returned, the data is not assigned to the ArrayCollection.
 
 Any suggestions?
 
 Thank you,
 jh
 
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
http://enigmail.mozdev.org 

iD8DBQFJHIiSnvIkv6fg9hYRAlGzAKCIblu06TZ3RwHX0CJg8QqRZrRIXACffhUh
DnnU2NWQAOl6jhcSwp03gMk=
=G5aj
-END PGP SIGNATURE-

 



Re: [flexcoders] ArrayCollection

2008-11-13 Thread Fotis Chatzinikos
Sorry is that a problem with Cold Fusion?

I get single element ArrayCollections from by java backend all the time (I
think? :-)

On Thu, Nov 13, 2008 at 11:32 PM, Tracy Spratt [EMAIL PROTECTED]wrote:

Mike,

 It is dangerous to use lastResult in this manner:

 scans = new ArrayCollection([getScan.lastResult.vector.scan]);

 You are not garrunteed that it will have the value in the result you
 expect.

 In most cases it will work ok but the correct way is:

 scans = new ArrayCollection([event.result.vector.scan]);



 lastResult is intended only for use in binding expressions.



 Tracy


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Mike Duncan
 *Sent:* Thursday, November 13, 2008 3:06 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] ArrayCollection



 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 This is how I got around this...

 - -
 import mx.uils.ObjectProxy;
 import mx.collections.ArrayCollection;

 [Bindable] private scans:ArrayCollection;

 private function handleGetScansResults(event:ResultEvent):void {
 //Note: getScan is a HTTPService object.
 if(getScan.lastResult.vector.scan is ObjectProxy) {
 scans = new ArrayCollection([getScan.lastResult.vector.scan]);
 }else{
 scans = getScan.lastResult.vector.scan as ArrayCollection;
 }
 }
 - -
 (sorry for any word wrapping)

 Dunno if someone else already suggested this, but I hope this helps.

 Mike Duncan
 ISSO, Application Security Specialist
 Government Contractor with STG, Inc.
 NOAA :: National Climatic Data Center
 151 Patton Ave.
 Asheville, NC 28801-5001
 [EMAIL PROTECTED] mike.duncan%40noaa.gov
 828.271.4289

 jch92592 wrote:
 
 
  All,
 
  I am using an ArrayCollection that I populate with the results from a
  ColdFusion RPC.
 
  All works well when there is more than 1 record. When only 1 record is
  returned, the data is not assigned to the ArrayCollection.
 
  Any suggestions?
 
  Thank you,
  jh
 
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.6 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD8DBQFJHIiSnvIkv6fg9hYRAlGzAKCIblu06TZ3RwHX0CJg8QqRZrRIXACffhUh
 DnnU2NWQAOl6jhcSwp03gMk=
 =G5aj
 -END PGP SIGNATURE-

  




-- 
Fotis Chatzinikos, Ph.D.
Founder,
Phinnovation
[EMAIL PROTECTED],


RE: [flexcoders] ArrayCollection

2008-11-13 Thread Tracy Spratt
The issue is typically with resultFormat=object, which is the default.
The source of the data is irrelevant.

 

It is a well known issue, search on it for lots of discussion.

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Fotis Chatzinikos
Sent: Thursday, November 13, 2008 4:21 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection

 

Sorry is that a problem with Cold Fusion?

I get single element ArrayCollections from by java backend all the time
(I think? :-)

On Thu, Nov 13, 2008 at 11:32 PM, Tracy Spratt [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  wrote:

Mike, 

It is dangerous to use lastResult in this manner:

scans = new ArrayCollection([getScan.lastResult.vector.scan]);

You are not garrunteed that it will have the value in the result you
expect.

In most cases it will work ok but the correct way is:

scans = new ArrayCollection([event.result.vector.scan]);

 

lastResult is intended only for use in binding expressions.

 

Tracy

 



From: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ]
On Behalf Of Mike Duncan
Sent: Thursday, November 13, 2008 3:06 PM
To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com 
Subject: Re: [flexcoders] ArrayCollection

 

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

This is how I got around this...

- -
import mx.uils.ObjectProxy;
import mx.collections.ArrayCollection;

[Bindable] private scans:ArrayCollection;

private function handleGetScansResults(event:ResultEvent):void {
//Note: getScan is a HTTPService object.
if(getScan.lastResult.vector.scan is ObjectProxy) {
scans = new ArrayCollection([getScan.lastResult.vector.scan]);
}else{
scans = getScan.lastResult.vector.scan as ArrayCollection;
}
}
- -
(sorry for any word wrapping)

Dunno if someone else already suggested this, but I hope this helps.

Mike Duncan
ISSO, Application Security Specialist
Government Contractor with STG, Inc.
NOAA :: National Climatic Data Center
151 Patton Ave.
Asheville, NC 28801-5001
[EMAIL PROTECTED] mailto:mike.duncan%40noaa.gov 
828.271.4289

jch92592 wrote:
 
 
 All,
 
 I am using an ArrayCollection that I populate with the results from a
 ColdFusion RPC.
 
 All works well when there is more than 1 record. When only 1 record is
 returned, the data is not assigned to the ArrayCollection.
 
 Any suggestions?
 
 Thank you,
 jh
 
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
http://enigmail.mozdev.org 

iD8DBQFJHIiSnvIkv6fg9hYRAlGzAKCIblu06TZ3RwHX0CJg8QqRZrRIXACffhUh
DnnU2NWQAOl6jhcSwp03gMk=
=G5aj
-END PGP SIGNATURE-




-- 
Fotis Chatzinikos, Ph.D.
Founder,
Phinnovation
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] , 

 



Re: [flexcoders] ArrayCollection

2008-11-13 Thread Mike Duncan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


I am not quite sure by what you mean ...are not garrunteed that it will
have the value in the result you expect. There is only one result. And,
by dangerous, are you talking about a memory leak or something?

If there is a case when I get no results, then I can understand this
logic, but in my case, there is always at least one result. A single
child within the root element of the returned XML that is.

I appreciate the heads up though.

Mike Duncan
ISSO, Application Security Specialist
Government Contractor with STG, Inc.
NOAA :: National Climatic Data Center
151 Patton Ave.
Asheville, NC 28801-5001
[EMAIL PROTECTED]
828.271.4289


Tracy Spratt wrote:
 
 
 Mike,
 
 It is dangerous to use lastResult in this manner:
 
 scans = new ArrayCollection([getScan.lastResult.vector.scan]);
 
 You are not garrunteed that it will have the value in the result you expect.
 
 In most cases it will work ok but the correct way is:
 
 scans = new ArrayCollection([event.result.vector.scan]);
 
  
 
 lastResult is intended only for use in binding expressions.
 
  
 
 Tracy
 
  
 
 
 
 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
 *On Behalf Of *Mike Duncan
 *Sent:* Thursday, November 13, 2008 3:06 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] ArrayCollection
 
  
 
 This is how I got around this...
 
 -
 import mx.uils.ObjectProxy;
 import mx.collections.ArrayCollection;
 
 [Bindable] private scans:ArrayCollection;
 
 private function handleGetScansResults(event:ResultEvent):void {
 //Note: getScan is a HTTPService object.
 if(getScan.lastResult.vector.scan is ObjectProxy) {
 scans = new ArrayCollection([getScan.lastResult.vector.scan]);
 }else{
 scans = getScan.lastResult.vector.scan as ArrayCollection;
 }
 }
 -
 (sorry for any word wrapping)
 
 Dunno if someone else already suggested this, but I hope this helps.
 
 Mike Duncan
 ISSO, Application Security Specialist
 Government Contractor with STG, Inc.
 NOAA :: National Climatic Data Center
 151 Patton Ave.
 Asheville, NC 28801-5001
 [EMAIL PROTECTED] mailto:mike.duncan%40noaa.gov
 828.271.4289
 
 jch92592 wrote:
 
 
 All,
 
 I am using an ArrayCollection that I populate with the results from a
 ColdFusion RPC.
 
 All works well when there is more than 1 record. When only 1 record is
 returned, the data is not assigned to the ArrayCollection.
 
 Any suggestions?
 
 Thank you,
 jh
 
 


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFJHJsonvIkv6fg9hYRAi3+AJd4NApCYammCT/86WCi5lPQvChcAJ47p7Zr
YEc4klxZno0I7Je3Se73gw==
=MSe4
-END PGP SIGNATURE-


Re: [flexcoders] ArrayCollection

2008-11-13 Thread Fotis Chatzinikos
Mike is that a CF limitation?

On Thu, Nov 13, 2008 at 11:24 PM, Mike Duncan [EMAIL PROTECTED] wrote:

   -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 I am not quite sure by what you mean ...are not garrunteed that it will
 have the value in the result you expect. There is only one result. And,
 by dangerous, are you talking about a memory leak or something?

 If there is a case when I get no results, then I can understand this
 logic, but in my case, there is always at least one result. A single
 child within the root element of the returned XML that is.

 I appreciate the heads up though.

 Mike Duncan
 ISSO, Application Security Specialist
 Government Contractor with STG, Inc.
 NOAA :: National Climatic Data Center
 151 Patton Ave.
 Asheville, NC 28801-5001
 [EMAIL PROTECTED] mike.duncan%40noaa.gov
 828.271.4289

 Tracy Spratt wrote:
 
 
  Mike,
 
  It is dangerous to use lastResult in this manner:
 
  scans = new ArrayCollection([getScan.lastResult.vector.scan]);
 
  You are not garrunteed that it will have the value in the result you
 expect.
 
  In most cases it will work ok but the correct way is:
 
  scans = new ArrayCollection([event.result.vector.scan]);
 
 
 
  lastResult is intended only for use in binding expressions.
 
 
 
  Tracy
 
 
 
  --
 
  *From:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com[mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com]
  *On Behalf Of *Mike Duncan
  *Sent:* Thursday, November 13, 2008 3:06 PM
  *To:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
  *Subject:* Re: [flexcoders] ArrayCollection
 
 
 
  This is how I got around this...
 
  -
  import mx.uils.ObjectProxy;
  import mx.collections.ArrayCollection;
 
  [Bindable] private scans:ArrayCollection;
 
  private function handleGetScansResults(event:ResultEvent):void {
  //Note: getScan is a HTTPService object.
  if(getScan.lastResult.vector.scan is ObjectProxy) {
  scans = new ArrayCollection([getScan.lastResult.vector.scan]);
  }else{
  scans = getScan.lastResult.vector.scan as ArrayCollection;
  }
  }
  -
  (sorry for any word wrapping)
 
  Dunno if someone else already suggested this, but I hope this helps.
 
  Mike Duncan
  ISSO, Application Security Specialist
  Government Contractor with STG, Inc.
  NOAA :: National Climatic Data Center
  151 Patton Ave.
  Asheville, NC 28801-5001
  [EMAIL PROTECTED] mike.duncan%40noaa.gov mailto:
 mike.duncan%40noaa.gov mike.duncan%2540noaa.gov
  828.271.4289
 
  jch92592 wrote:
 
 
  All,
 
  I am using an ArrayCollection that I populate with the results from a
  ColdFusion RPC.
 
  All works well when there is more than 1 record. When only 1 record is
  returned, the data is not assigned to the ArrayCollection.
 
  Any suggestions?
 
  Thank you,
  jh
 
 

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.6 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD4DBQFJHJsonvIkv6fg9hYRAi3+AJd4NApCYammCT/86WCi5lPQvChcAJ47p7Zr
 YEc4klxZno0I7Je3Se73gw==
 =MSe4
 -END PGP SIGNATURE-
  




-- 
Fotis Chatzinikos, Ph.D.
Founder,
Phinnovation
[EMAIL PROTECTED],


RE: [flexcoders] ArrayCollection

2008-11-13 Thread Tracy Spratt
The issue is that there is only one lastResult for the entire
framework.

 

There is only one result No, this is not correct. Because they are
asynchronous, there can be multiple pending RPC data calls.  There is no
assurance that the first RPC call is the first returned.

 

Between the time the result returns, lastResult is set, the result event
is dispatched, calling your handler, and your handler gets to the line
that uses lastResult, it is very possible that another result has
returned, overwriting the value in lastResult.  Typically it is actually
set to null by the framework, rather than sneaking in some other data,
but that is just as dangerous.  This was a real issue in a thread six or
eight months ago.

 

If you only call a single RPC at a time, there will be no problem, but
complex apps often have many outstanding calls an a given moment.

 

Why take any risk?  Is there some reason you *like* lastResult over
using the event.result object?  

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mike Duncan
Sent: Thursday, November 13, 2008 4:25 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection

 

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I am not quite sure by what you mean ...are not garrunteed that it will
have the value in the result you expect. There is only one result. And,
by dangerous, are you talking about a memory leak or something?

If there is a case when I get no results, then I can understand this
logic, but in my case, there is always at least one result. A single
child within the root element of the returned XML that is.

I appreciate the heads up though.

Mike Duncan
ISSO, Application Security Specialist
Government Contractor with STG, Inc.
NOAA :: National Climatic Data Center
151 Patton Ave.
Asheville, NC 28801-5001
[EMAIL PROTECTED] mailto:mike.duncan%40noaa.gov 
828.271.4289

Tracy Spratt wrote:
 
 
 Mike,
 
 It is dangerous to use lastResult in this manner:
 
 scans = new ArrayCollection([getScan.lastResult.vector.scan]);
 
 You are not garrunteed that it will have the value in the result you
expect.
 
 In most cases it will work ok but the correct way is:
 
 scans = new ArrayCollection([event.result.vector.scan]);
 
 
 
 lastResult is intended only for use in binding expressions.
 
 
 
 Tracy
 
 
 
 --
 
 *From:* flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
]
 *On Behalf Of *Mike Duncan
 *Sent:* Thursday, November 13, 2008 3:06 PM
 *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com

 *Subject:* Re: [flexcoders] ArrayCollection
 
 
 
 This is how I got around this...
 
 -
 import mx.uils.ObjectProxy;
 import mx.collections.ArrayCollection;
 
 [Bindable] private scans:ArrayCollection;
 
 private function handleGetScansResults(event:ResultEvent):void {
 //Note: getScan is a HTTPService object.
 if(getScan.lastResult.vector.scan is ObjectProxy) {
 scans = new ArrayCollection([getScan.lastResult.vector.scan]);
 }else{
 scans = getScan.lastResult.vector.scan as ArrayCollection;
 }
 }
 -
 (sorry for any word wrapping)
 
 Dunno if someone else already suggested this, but I hope this helps.
 
 Mike Duncan
 ISSO, Application Security Specialist
 Government Contractor with STG, Inc.
 NOAA :: National Climatic Data Center
 151 Patton Ave.
 Asheville, NC 28801-5001
 [EMAIL PROTECTED] mailto:mike.duncan%40noaa.gov
mailto:mike.duncan%40noaa.gov
 828.271.4289
 
 jch92592 wrote:
 
 
 All,
 
 I am using an ArrayCollection that I populate with the results from a
 ColdFusion RPC.
 
 All works well when there is more than 1 record. When only 1 record
is
 returned, the data is not assigned to the ArrayCollection.
 
 Any suggestions?
 
 Thank you,
 jh
 
 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
http://enigmail.mozdev.org 

iD4DBQFJHJsonvIkv6fg9hYRAi3+AJd4NApCYammCT/86WCi5lPQvChcAJ47p7Zr
YEc4klxZno0I7Je3Se73gw==
=MSe4
-END PGP SIGNATURE-

 



RE: [flexcoders] ArrayCollection

2008-11-13 Thread Tracy Spratt
Correction:
The issue is that there is only one lastResult for a given RPC Object
instance.
I typically use a single instance for all calls, but not everyone does.
Tracu

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Thursday, November 13, 2008 6:21 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] ArrayCollection

The issue is that there is only one lastResult for the entire
framework.
 
There is only one result No, this is not correct. Because they are
asynchronous, there can be multiple pending RPC data calls.  There is no
assurance that the first RPC call is the first returned.
 
Between the time the result returns, lastResult is set, the result event
is dispatched, calling your handler, and your handler gets to the line
that uses lastResult, it is very possible that another result has
returned, overwriting the value in lastResult.  Typically it is actually
set to null by the framework, rather than sneaking in some other data,
but that is just as dangerous.  This was a real issue in a thread six or
eight months ago.
 
If you only call a single RPC at a time, there will be no problem, but
complex apps often have many outstanding calls an a given moment.
 
Why take any risk?  Is there some reason you *like* lastResult over
using the event.result object?  
 
Tracy
 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mike Duncan
Sent: Thursday, November 13, 2008 4:25 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection
 
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I am not quite sure by what you mean ...are not garrunteed that it will
have the value in the result you expect. There is only one result. And,
by dangerous, are you talking about a memory leak or something?

If there is a case when I get no results, then I can understand this
logic, but in my case, there is always at least one result. A single
child within the root element of the returned XML that is.

I appreciate the heads up though.

Mike Duncan
ISSO, Application Security Specialist
Government Contractor with STG, Inc.
NOAA :: National Climatic Data Center
151 Patton Ave.
Asheville, NC 28801-5001
[EMAIL PROTECTED] mailto:mike.duncan%40noaa.gov 
828.271.4289

Tracy Spratt wrote:
 
 
 Mike,
 
 It is dangerous to use lastResult in this manner:
 
 scans = new ArrayCollection([getScan.lastResult.vector.scan]);
 
 You are not garrunteed that it will have the value in the result you
expect.
 
 In most cases it will work ok but the correct way is:
 
 scans = new ArrayCollection([event.result.vector.scan]);
 
 
 
 lastResult is intended only for use in binding expressions.
 
 
 
 Tracy
 
 
 
 --
 
 *From:* flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
]
 *On Behalf Of *Mike Duncan
 *Sent:* Thursday, November 13, 2008 3:06 PM
 *To:* flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com

 *Subject:* Re: [flexcoders] ArrayCollection
 
 
 
 This is how I got around this...
 
 -
 import mx.uils.ObjectProxy;
 import mx.collections.ArrayCollection;
 
 [Bindable] private scans:ArrayCollection;
 
 private function handleGetScansResults(event:ResultEvent):void {
 //Note: getScan is a HTTPService object.
 if(getScan.lastResult.vector.scan is ObjectProxy) {
 scans = new ArrayCollection([getScan.lastResult.vector.scan]);
 }else{
 scans = getScan.lastResult.vector.scan as ArrayCollection;
 }
 }
 -
 (sorry for any word wrapping)
 
 Dunno if someone else already suggested this, but I hope this helps.
 
 Mike Duncan
 ISSO, Application Security Specialist
 Government Contractor with STG, Inc.
 NOAA :: National Climatic Data Center
 151 Patton Ave.
 Asheville, NC 28801-5001
 [EMAIL PROTECTED] mailto:mike.duncan%40noaa.gov
mailto:mike.duncan%40noaa.gov
 828.271.4289
 
 jch92592 wrote:
 
 
 All,
 
 I am using an ArrayCollection that I populate with the results from a
 ColdFusion RPC.
 
 All works well when there is more than 1 record. When only 1 record
is
 returned, the data is not assigned to the ArrayCollection.
 
 Any suggestions?
 
 Thank you,
 jh
 
 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFJHJsonvIkv6fg9hYRAi3+AJd4NApCYammCT/86WCi5lPQvChcAJ47p7Zr
YEc4klxZno0I7Je3Se73gw==
=MSe4
-END PGP SIGNATURE-
 


Re: [flexcoders] ArrayCollection

2008-11-13 Thread Fotis Chatzinikos
Ok, had not noticed the http bit, as the initial post mentioned RPC and in
my mind/head RPC == RemoteObject..

and i do not have any similar problems with remote object calls :-)

On Thu, Nov 13, 2008 at 11:42 PM, Tracy Spratt [EMAIL PROTECTED]wrote:

The issue is typically with resultFormat=object, which is the
 default.  The source of the data is irrelevant.



 It is a well known issue, search on it for lots of discussion.



 Tracy


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Fotis Chatzinikos
 *Sent:* Thursday, November 13, 2008 4:21 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] ArrayCollection



 Sorry is that a problem with Cold Fusion?

 I get single element ArrayCollections from by java backend all the time (I
 think? :-)

 On Thu, Nov 13, 2008 at 11:32 PM, Tracy Spratt [EMAIL PROTECTED]
 wrote:

 Mike,

 It is dangerous to use lastResult in this manner:

 scans = new ArrayCollection([getScan.lastResult.vector.scan]);

 You are not garrunteed that it will have the value in the result you
 expect.

 In most cases it will work ok but the correct way is:

 scans = new ArrayCollection([event.result.vector.scan]);



 lastResult is intended only for use in binding expressions.



 Tracy


  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Mike Duncan
 *Sent:* Thursday, November 13, 2008 3:06 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] ArrayCollection



 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 This is how I got around this...

 - -
 import mx.uils.ObjectProxy;
 import mx.collections.ArrayCollection;

 [Bindable] private scans:ArrayCollection;

 private function handleGetScansResults(event:ResultEvent):void {
 //Note: getScan is a HTTPService object.
 if(getScan.lastResult.vector.scan is ObjectProxy) {
 scans = new ArrayCollection([getScan.lastResult.vector.scan]);
 }else{
 scans = getScan.lastResult.vector.scan as ArrayCollection;
 }
 }
 - -
 (sorry for any word wrapping)

 Dunno if someone else already suggested this, but I hope this helps.

 Mike Duncan
 ISSO, Application Security Specialist
 Government Contractor with STG, Inc.
 NOAA :: National Climatic Data Center
 151 Patton Ave.
 Asheville, NC 28801-5001
 [EMAIL PROTECTED] mike.duncan%40noaa.gov
 828.271.4289

 jch92592 wrote:
 
 
  All,
 
  I am using an ArrayCollection that I populate with the results from a
  ColdFusion RPC.
 
  All works well when there is more than 1 record. When only 1 record is
  returned, the data is not assigned to the ArrayCollection.
 
  Any suggestions?
 
  Thank you,
  jh
 
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.6 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD8DBQFJHIiSnvIkv6fg9hYRAlGzAKCIblu06TZ3RwHX0CJg8QqRZrRIXACffhUh
 DnnU2NWQAOl6jhcSwp03gMk=
 =G5aj
 -END PGP SIGNATURE-




 --
 Fotis Chatzinikos, Ph.D.
 Founder,
 Phinnovation
 [EMAIL PROTECTED],

  




-- 
Fotis Chatzinikos, Ph.D.
Founder,
Phinnovation
[EMAIL PROTECTED],


[flexcoders] ArrayCollection bound to an Array.

2008-08-26 Thread flexaustin
Is it possible to bind an ArrayCOllection to an array, like so

public var summDataForControllers:Array = new Array;

public var _summDataForContrAC:ArrayCollection = new
ArrayCollection({summDataForControllers});

I have a modelLocator that contains these to items (above) and I want
a component to bind to the arrayCollection.  I am storing the
information in the array first because when I try to update the
arraycollection from my component and then access a certain item in
the arraycollection I get Index 0 out of bounds. So in other words I
iterate and say arrayCollection.addItemAt(i) then try
arrayCOllection.getItemAt(i) I get the out of bounds issue.

But if I iterate and store the information in an array everything is
fine, but now my component can't listen for updates, which is the
reason I am trying to bind my arraycollection to the array.

Thanks in advance for any help.





RE: [flexcoders] ArrayCollection bound to an Array.

2008-08-26 Thread Battershall, Jeff
Your approach to the problem doesn't appear to be correct. Some
additional code would be helpful.

Jeff

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of flexaustin
Sent: Tuesday, August 26, 2008 11:17 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection bound to an Array.


Is it possible to bind an ArrayCOllection to an array, like so

public var summDataForControllers:Array = new Array;

public var _summDataForContrAC:ArrayCollection = new
ArrayCollection({summDataForControllers});

I have a modelLocator that contains these to items (above) and I want a
component to bind to the arrayCollection.  I am storing the information
in the array first because when I try to update the arraycollection from
my component and then access a certain item in the arraycollection I get
Index 0 out of bounds. So in other words I iterate and say
arrayCollection.addItemAt(i) then try
arrayCOllection.getItemAt(i) I get the out of bounds issue.

But if I iterate and store the information in an array everything is
fine, but now my component can't listen for updates, which is the reason
I am trying to bind my arraycollection to the array.

Thanks in advance for any help.






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





Re: [flexcoders] ArrayCollection bound to an Array.

2008-08-26 Thread Sefi Ninio
You could bind a setter, something like this (written in gmail, this was not
compiled):

private var array:Array;
private var arrayCollection:ArrayCollection;

public function ClassName(..args) { //Constructor
   array = new Array();
   BindingUtils.bindSetter(setArrayCollection, this, array);
}

private function setArrayCollection(array:Array):void {
   arrayCollection = new ArrayCollection(array);
}

This will cause the setter function to run everytime array changes. But do
some reading on when Array does and does not dispatch a change event...

HTH
Sefi


On Tue, Aug 26, 2008 at 7:58 PM, Battershall, Jeff 
[EMAIL PROTECTED] wrote:

   Your approach to the problem doesn't appear to be correct. Some
 additional code would be helpful.

 Jeff


 -Original Message-
 From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto:
 flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On
 Behalf Of flexaustin
 Sent: Tuesday, August 26, 2008 11:17 AM
 To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 Subject: [flexcoders] ArrayCollection bound to an Array.

 Is it possible to bind an ArrayCOllection to an array, like so

 public var summDataForControllers:Array = new Array;

 public var _summDataForContrAC:ArrayCollection = new
 ArrayCollection({summDataForControllers});

 I have a modelLocator that contains these to items (above) and I want a
 component to bind to the arrayCollection. I am storing the information
 in the array first because when I try to update the arraycollection from
 my component and then access a certain item in the arraycollection I get
 Index 0 out of bounds. So in other words I iterate and say
 arrayCollection.addItemAt(i) then try
 arrayCOllection.getItemAt(i) I get the out of bounds issue.

 But if I iterate and store the information in an array everything is
 fine, but now my component can't listen for updates, which is the reason
 I am trying to bind my arraycollection to the array.

 Thanks in advance for any help.

 

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

  



[flexcoders] ArrayCollection ChangeEvent does noget get dispatched when filterFunction is set

2008-07-26 Thread dopenhagen
It appears that an arraycollection's changeEvent
(CollectionEvent.COLLECTION_CHANGE) does not get called correctly when
FilterFunction is set.
Is anyone else experiencing this behavior, and if yes: is it a feature
or a bug ?



RE: [flexcoders] ArrayCollection ChangeEvent does noget get dispatched when filterFunction is set

2008-07-26 Thread Alex Harui
AC is a view of the data so if an item changes that is not in the
current view (filtered out) I don't think it should send an event

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of dopenhagen
Sent: Saturday, July 26, 2008 4:09 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection ChangeEvent does noget get
dispatched when filterFunction is set

 

It appears that an arraycollection's changeEvent
(CollectionEvent.COLLECTION_CHANGE) does not get called correctly when
FilterFunction is set.
Is anyone else experiencing this behavior, and if yes: is it a feature
or a bug ?

 



Re: [flexcoders] ArrayCollection filterFunction only gets called on root item

2008-07-22 Thread Scott Bachman
The filterFunction only applies to the ArrayCollection. By hierarchy, I
assume you mean you have an ArrayCollection that contains ArrayCollections.
In other words, objects in your original ArrayCollection have, say, a
children ArrayCollection. In order to do what you're describing, you would
have to set the filterFunction on each of these child's filterFunction and
each of there's, etc.

In the past, I have done something like this to achieve what you're talking
about:

public function filterMenuItems(filter:IMenuFilter):void {
if (children) {
// need to clear all filters first, otherwise hidden higher
levels won't come back
children.filterFunction = null;
children.refresh();
for (var i:int=0; i  children.length; i++) {
if (children.getItemAt(i) is Menu) {
Menu(children.getItemAt(i)).filterMenuItems(filter);
}
}
children.filterFunction = filter.menuItemFilter;
children.refresh();
}
}

Here, a Menu is filtered by calling it's filterMenuItems method with a
filter object, traversing down through other Menu's children (via the
recursive call) setting the filterFunction.

Scott

On Mon, Jul 21, 2008 at 5:55 PM, Greg Hess [EMAIL PROTECTED] wrote:

   Hi All,

 I have a tree control who's data provider is an ArrayCollection
 holding a single File object I defined. The File object represents the
 root of a remote file system hierarchy that has children getter that
 supports the tree control and each child is rendered in the tree with
 an ItemRenderer.

 The tree control displays the File hierarchy well and it traverses the
 data providers children as expected. However, filter does not. I
 wanted to apply a filter to the data provider so only directory items
 are displayed. I specified the filterFunction and refresh the
 dataProvider but it only gets called on the first root node and not
 the data model hierarchy and each item that gets rendered in the tree.

 Should I have implemented a special interface so the tree or data
 provider can properly filter the object hierarchy?

 What am I doing wrong?

 Any help much appreciated.

 -Greg
  



[flexcoders] ArrayCollection filterFunction only gets called on root item

2008-07-21 Thread Greg Hess
Hi All,

I have a tree control who's data provider is an ArrayCollection
holding a single File object I defined. The File object represents the
root of a remote file system hierarchy that has children getter that
supports the tree control and each child is rendered in the tree with
an ItemRenderer.

The tree control displays the File hierarchy well and it traverses the
data providers children as expected. However, filter does not. I
wanted to apply a filter to the data provider so only directory items
are displayed. I specified the filterFunction and refresh the
dataProvider but it only gets called on the first root node and not
the data model hierarchy and each item that gets rendered in the tree.

Should I have implemented a special interface so the tree or data
provider can properly filter the object hierarchy?

What am I doing wrong?

Any help much appreciated.

-Greg


[flexcoders] arrayCollection event COLLECTION_CHANGE issues?

2008-07-17 Thread Scott
First thanks for all your help guys.  I'm making nice strides learning
this language quickly.

 

I'm working with events now.  I created an arrayCollection to capture a
query from coldfusion.  I have the data being dumped into this variable
just fine (I can do a combobox on it and see all of it).  Now what I
want to do is set some variables based on these items.  I created an
event to watch the arrayCollection which would run a function to reset
the variables automatically.  Here's what I did:

 

 

This is all within a singleton class...

 

Created the [Bindable]acUser array collection

[Bindable] public var acUser:ArrayCollection = new ArrayCollection();

 

Created an init() function to set up the event handler:

  private function init():void

  { 

  acUser.addEventListener(CollectionEvent.COLLECTION_CHANGE,
acUser_collectionChange);

  }

 

Created a function to set the variables if the event hit:

  private function
acUser_collectionChange(event:CollectionEvent):void

  { 

strEMail =
ObjectUtil.toString(acUser.getItemAt(0).strEMail);   (not sure if this
call is correct -yet-)

trace(strEMail);

  }

 

Modified the header for the page to run the init() function

mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;

  creationComplete=init()

  xmlns=*

  xmlns:controllers=com.cfgenerated.controllers.*

xmlns:login=com.cfgenerated.views.login.*

  layout=absolute

  currentState=NotLoggedIn

 

 

This should be all I need to do, right?

 

When I push the data into the singleton:

 

GlobalVars.instance.acUser = event.result as ArrayCollection;

 

The event does not fire.  Any ideas?

 

 

TIA!



Re: [flexcoders] arrayCollection event COLLECTION_CHANGE issues?

2008-07-17 Thread Daniel Gold
You're initializing the acUser collection when the singleton is created and
adding a listener, which is fine. However, when you're getting the results
back, you're changing the acUser collection reference to a different
ArrayCollection

GlobalVars.instance.acUser = event.result as ArrayCollection;

So your singleton still has a listener registered on the original
ArrayCollection, but your singleton model now contains a reference to the
new ArrayCollection returned from the service. To keep your references
pointing to the same ArrayCollection and still get the COLLECTION_CHANGE,
you could play games like this:

GlobalVars.instance.acUser.source = ArrayCollection(event.result).source;
GlobalVars.instance.acUser.refresh();

In that you're swapping out the underlying Array the collection is wrapped
around, and then calling refresh will dispatch teh COLLECTION_CHANGE, firing
any bindings and calling your listener code.

On Thu, Jul 17, 2008 at 8:43 AM, Scott [EMAIL PROTECTED] wrote:

First thanks for all your help guys.  I'm making nice strides learning
 this language quickly.



 I'm working with events now.  I created an arrayCollection to capture a
 query from coldfusion.  I have the data being dumped into this variable just
 fine (I can do a combobox on it and see all of it).  Now what I want to do
 is set some variables based on these items.  I created an event to watch the
 arrayCollection which would run a function to reset the variables
 automatically.  Here's what I did:





 This is all within a singleton class…



 Created the [Bindable]acUser array collection

 [Bindable] public var acUser:ArrayCollection = new ArrayCollection();



 Created an init() function to set up the event handler:

   *private* *function* init():*void*

   {

   acUser.addEventListener(CollectionEvent.COLLECTION_CHANGE,
 acUser_collectionChange);

   }



 Created a function to set the variables if the event hit:

   *private* *function* acUser_collectionChange(event:CollectionEvent):
 *void*

   {

 strEMail = ObjectUtil.toString(acUser.getItemAt(0).strEMail);
 (not sure if this call is correct –yet-)

 *trace*(strEMail);

   }



 Modified the header for the page to run the init() function

 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;

   creationComplete=init()

   xmlns=*

   xmlns:controllers=com.cfgenerated.controllers.*

 xmlns:login=com.cfgenerated.views.login.*

   layout=absolute

   currentState=NotLoggedIn





 This should be all I need to do, right?



 When I push the data into the singleton:



 GlobalVars.instance.acUser = event.result as ArrayCollection;



 The event does not fire.  Any ideas?





 TIA!
  



Re: [flexcoders] arrayCollection event COLLECTION_CHANGE issues?

2008-07-17 Thread Scott
When I do that I get an error that the property is not defined.  I can
do the control space and see that FB is seeing all of the items along
the path of GlobalVars.instance.acUser.source but the instant I save it
the error access of possibly undefined property accuser through a
reference with static type com.cfgenerated.models.GlobalVars.

 

This is my .as singleton class:

  public class GlobalVars

  {

private static var classInstance:GlobalVars = null;

private static var constructorLocked:Boolean = true;



public var objUser:Object = new Object();



public function GlobalVars()

{

  if( constructorLocked )

  {

throw new Error( Cannot open another instance
of GVs );

  }

}

public static function get instance():GlobalVars

{

  if( classInstance == null )

  {

constructorLocked = false;

classInstance = new GlobalVars();

constructorLocked = true;

  }

  return classInstance;

}

}

 

And this is my call to create the singleton instance:

[Bindable] public var acUser:ArrayCollection = new ArrayCollection();

 

Any ideas?

 

 Thanks

  sj

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Daniel Gold
Sent: Thursday, July 17, 2008 8:45 AM
To: flexcoders@yahoogroups.com
Subject: {Disarmed} Re: [flexcoders] arrayCollection event
COLLECTION_CHANGE issues?

 

You're initializing the acUser collection when the singleton is created
and adding a listener, which is fine. However, when you're getting the
results back, you're changing the acUser collection reference to a
different ArrayCollection

GlobalVars.instance.acUser = event.result as ArrayCollection;

So your singleton still has a listener registered on the original
ArrayCollection, but your singleton model now contains a reference to
the new ArrayCollection returned from the service. To keep your
references pointing to the same ArrayCollection and still get the
COLLECTION_CHANGE, you could play games like this:

GlobalVars.instance.acUser.source =
ArrayCollection(event.result).source;
GlobalVars.instance.acUser.refresh();

In that you're swapping out the underlying Array the collection is
wrapped around, and then calling refresh will dispatch teh
COLLECTION_CHANGE, firing any bindings and calling your listener code.

On Thu, Jul 17, 2008 at 8:43 AM, Scott [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  wrote:

First thanks for all your help guys.  I'm making nice strides learning
this language quickly.

 

I'm working with events now.  I created an arrayCollection to capture a
query from coldfusion.  I have the data being dumped into this variable
just fine (I can do a combobox on it and see all of it).  Now what I
want to do is set some variables based on these items.  I created an
event to watch the arrayCollection which would run a function to reset
the variables automatically.  Here's what I did:

 

 

This is all within a singleton class...

 

Created the [Bindable]acUser array collection

[Bindable] public var acUser:ArrayCollection = new ArrayCollection();

 

Created an init() function to set up the event handler:

  private function init():void

  { 

  acUser.addEventListener(CollectionEvent.COLLECTION_CHANGE,
acUser_collectionChange);

  }

 

Created a function to set the variables if the event hit:

  private function
acUser_collectionChange(event:CollectionEvent):void

  { 

strEMail =
ObjectUtil.toString(acUser.getItemAt(0).strEMail);   (not sure if this
call is correct -yet-)

trace(strEMail);

  }

 

Modified the header for the page to run the init() function

mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml 

  creationComplete=init()

  xmlns=*

  xmlns:controllers=com.cfgenerated.controllers.*

xmlns:login=com.cfgenerated.views.login.*

  layout=absolute

  currentState=NotLoggedIn

 

 

This should be all I need to do, right?

 

When I push the data into the singleton:

 

GlobalVars.instance.acUser = event.result as ArrayCollection;

 

The event does not fire.  Any ideas?

 

 

TIA!

 

 


-- 
This message has been scanned for viruses and 
dangerous content by MailScanner http://www.mailscanner.info/ , and is

believed to be clean. 


Re: [flexcoders] arrayCollection event COLLECTION_CHANGE issues?

2008-07-17 Thread Scott
Let me correct that last statement...

 

I do -not- see the acUser in the control-space selection items.  I see
the original named variable and other functions but I also see some
functions that no longer exist.  Why isn't Flex updating that list?

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Scott
Sent: Thursday, July 17, 2008 5:24 PM
To: flexcoders@yahoogroups.com
Subject: {Disarmed} Re: [flexcoders] arrayCollection event
COLLECTION_CHANGE issues?

 

When I do that I get an error that the property is not defined.  I can
do the control space and see that FB is seeing all of the items along
the path of GlobalVars.instance.acUser.source but the instant I save it
the error access of possibly undefined property accuser through a
reference with static type com.cfgenerated.models.GlobalVars.

 

This is my .as singleton class:

  public class GlobalVars

  {

private static var classInstance:GlobalVars = null;

private static var constructorLocked:Boolean = true;



public var objUser:Object = new Object();



public function GlobalVars()

{

  if( constructorLocked )

  {

throw new Error( Cannot open another instance
of GVs );

  }

}

public static function get instance():GlobalVars

{

  if( classInstance == null )

  {

constructorLocked = false;

classInstance = new GlobalVars();

constructorLocked = true;

  }

  return classInstance;

}

}

 

And this is my call to create the singleton instance:

[Bindable] public var acUser:ArrayCollection = new ArrayCollection();

 

Any ideas?

 

 Thanks

  sj

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Daniel Gold
Sent: Thursday, July 17, 2008 8:45 AM
To: flexcoders@yahoogroups.com
Subject: {Disarmed} Re: [flexcoders] arrayCollection event
COLLECTION_CHANGE issues?

 

You're initializing the acUser collection when the singleton is created
and adding a listener, which is fine. However, when you're getting the
results back, you're changing the acUser collection reference to a
different ArrayCollection

GlobalVars.instance.acUser = event.result as ArrayCollection;

So your singleton still has a listener registered on the original
ArrayCollection, but your singleton model now contains a reference to
the new ArrayCollection returned from the service. To keep your
references pointing to the same ArrayCollection and still get the
COLLECTION_CHANGE, you could play games like this:

GlobalVars.instance.acUser.source =
ArrayCollection(event.result).source;
GlobalVars.instance.acUser.refresh();

In that you're swapping out the underlying Array the collection is
wrapped around, and then calling refresh will dispatch teh
COLLECTION_CHANGE, firing any bindings and calling your listener code.

On Thu, Jul 17, 2008 at 8:43 AM, Scott [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  wrote:

First thanks for all your help guys.  I'm making nice strides learning
this language quickly.

 

I'm working with events now.  I created an arrayCollection to capture a
query from coldfusion.  I have the data being dumped into this variable
just fine (I can do a combobox on it and see all of it).  Now what I
want to do is set some variables based on these items.  I created an
event to watch the arrayCollection which would run a function to reset
the variables automatically.  Here's what I did:

 

 

This is all within a singleton class...

 

Created the [Bindable]acUser array collection

[Bindable] public var acUser:ArrayCollection = new ArrayCollection();

 

Created an init() function to set up the event handler:

  private function init():void

  { 

  acUser.addEventListener(CollectionEvent.COLLECTION_CHANGE,
acUser_collectionChange);

  }

 

Created a function to set the variables if the event hit:

  private function
acUser_collectionChange(event:CollectionEvent):void

  { 

strEMail =
ObjectUtil.toString(acUser.getItemAt(0).strEMail);   (not sure if this
call is correct -yet-)

trace(strEMail);

  }

 

Modified the header for the page to run the init() function

mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml 

  creationComplete=init()

  xmlns=*

  xmlns:controllers=com.cfgenerated.controllers.*

xmlns:login=com.cfgenerated.views.login.*

  layout=absolute

  currentState=NotLoggedIn

 

 

This should be all I need to do, right?

 

When I push the data into the singleton:

 

GlobalVars.instance.acUser = event.result as ArrayCollection;

 

The event does not fire.  Any ideas?

 

 

TIA

[flexcoders] ArrayCollection (AS) and ArrayList (java) not in sync)

2008-04-23 Thread Luke Vanderfluit
Hi.

Im having a problem retrieving a list of objects from the server.
Im using blazeds and have successfully retrieved lists of objects using the 
following construct:

Im dealing with a list that has Site Objects

mx:RemoteObject id=srv destination=theService/
mx:DataGrid id=sites dataProvider={srv.getSites.lastResult}/

On the server the ArrayList is being generated correctly with 2 different Site 
objects. On the client side Im getting the last of the 2 sites twice.
So I iterate through the ArrayCollection and there are 2 same Objects in there.

Odd...

Any suggestions would be welcome.

Kind regards.
Luke.

-- 
Luke Vanderfluit
Analyst / Web Programmer
e3Learning.com.au
08 8221 6422


Re: [flexcoders] ArrayCollection (AS) and ArrayList (java) not in sync)

2008-04-23 Thread Luke Vanderfluit
Hi.

As always. On further inspection the array on the server isnt getting it right.
Sorry for the noise )-:

Kr.
L.

Luke Vanderfluit wrote:
 Hi.
 
 Im having a problem retrieving a list of objects from the server.
 Im using blazeds and have successfully retrieved lists of objects using the 
 following construct:
 
 Im dealing with a list that has Site Objects
 
 mx:RemoteObject id=srv destination=theService/
 mx:DataGrid id=sites dataProvider={srv.getSites.lastResult}/
 
 On the server the ArrayList is being generated correctly with 2 different 
 Site 
 objects. On the client side Im getting the last of the 2 sites twice.
 So I iterate through the ArrayCollection and there are 2 same Objects in 
 there.
 
 Odd...
 
 Any suggestions would be welcome.
 
 Kind regards.
 Luke.
 


-- 
Luke Vanderfluit
Analyst / Web Programmer
e3Learning.com.au
08 8221 6422


Re: [flexcoders] arraycollection and tree

2008-03-25 Thread Nayan Savla

Hi Luke,

Just create a List in Java and return it. alternatively you can add it  
to a Value Object and then return it. below is example of my function,  
CategoriesVo is simple java class with three public variables.


public List getCategoriesAll(){
List list = new ArrayList();

		String query = SELECT main.id, main.name, sub.name FROM  
maincategories AS main, subcategories AS sub WHERE main.id =  
sub.maincategoryId;

//String query = SELECT * FROM maincategories;

try {
ResultSet results = 
connManager.stmt.executeQuery(query);
//results.first();

String secondKey = ;
String firstKey = ;

Integer categoryId;
while (results.next()){
CategoriesVo categories = new CategoriesVo();
firstKey = results.getString(2);
categoryId = results.getInt(1);
secondKey = results.getString(3);

categories.mainCategory = secondKey;
categories.subCategories = firstKey;

categories.categoryId = prevCategory;

list.add(categories);
// hashMap.put(secondKey, list);
// System.out.println(adding to the hashmap 
 + secondKey);

}
} catch (SQLException e){   
}   

return list;
}


this can be cast to arraycollection in Flex or you can loop through  
the result and add it to a collection.


hope this helps.

Nayan


On Mar 24, 2008, at 10:57 PM, Luke Vanderfluit wrote:


Hi.

I am using remoteobject to get stuff from a database (java/mysql). I
want to represent the List, generated on the server side and sent to  
the

client as an arraycollection, as a tree.

Does anyone have examples of how to do this.
I have been reading the online docs but Im making very slow progress.

Thanks.
Kind regards.
Luke.






[flexcoders] arraycollection and tree

2008-03-24 Thread Luke Vanderfluit
Hi.

I am using remoteobject to get stuff from a database (java/mysql). I 
want to represent the List, generated on the server side and sent to the 
client as an arraycollection, as a tree.

Does anyone have examples of how to do this.
I have been reading the online docs but Im making very slow progress.

Thanks.
Kind regards.
Luke.


[flexcoders] ArrayCollection of String as single-column DataGrid provider

2008-03-21 Thread mario.blataric
Hi!

I have ArrayCollection filled with String:
mx:ArrayCollection id=dp
   mx:StringString 1/mx:String
   mx:StringString 2/mx:String
   
/mx:ArrayCollection

DataGrid's dataProvider is array collection above and DataGrid has
only one column.

What I want is to have ComboBox as inplace ItemRenderer/Editor, but I
don't know what to set in DataGridColumn's dataField property since
ArrayCollection contains String and not Object. 

Something like this:

mx:DataGrid dataProvider={dp} editable=true
   mx:columns
  mx:DataGridColumn headerText=My Strings dataField=??  
 
  editorDataField=labelText rendererIsEditor=true 
 mx:itemRenderer
mx:Component  
mx:ComboBox 
   dataProvider={outerDocument.comboProvider}
   labelField=name / 
/mx:Component
 /mx:itemRenderer
  /mx:DataGridColumn
   /mx:columns
/mx:LgnDataGrid

Any ideas how to do this?

Thanks,

Mario B. 



[flexcoders] ArrayCollection refresh event listener

2008-03-21 Thread loc_tran106
I wanted to do some custom calculations on the filtered data of an
arraycollection.

I set the filterfunction for the ac, and then called ac.refresh(). 
What is the proper event to listen for so I can handle my calculations
when the refresh on is complete?

Thanks,

-Loc



RE: [flexcoders] ArrayCollection refresh event listener

2008-03-21 Thread Alex Harui
CollectionEvent.CHANGE with CollectionEventKind.REFRESH

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of loc_tran106
Sent: Friday, March 21, 2008 10:13 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection refresh event listener

 

I wanted to do some custom calculations on the filtered data of an
arraycollection.

I set the filterfunction for the ac, and then called ac.refresh(). 
What is the proper event to listen for so I can handle my calculations
when the refresh on is complete?

Thanks,

-Loc

 



RE: [flexcoders] ArrayCollection of String as single-column DataGrid provider

2008-03-21 Thread Alex Harui
You cannot use simple types (String, Number) in a DG.  You have to use
objects like:

 

mx:Object label=String1 /

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of mario.blataric
Sent: Friday, March 21, 2008 4:00 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection of String as single-column
DataGrid provider

 

Hi!

I have ArrayCollection filled with String:
mx:ArrayCollection id=dp
mx:StringString 1/mx:String
mx:StringString 2/mx:String

/mx:ArrayCollection

DataGrid's dataProvider is array collection above and DataGrid has
only one column.

What I want is to have ComboBox as inplace ItemRenderer/Editor, but I
don't know what to set in DataGridColumn's dataField property since
ArrayCollection contains String and not Object. 

Something like this:

mx:DataGrid dataProvider={dp} editable=true
mx:columns
mx:DataGridColumn headerText=My Strings dataField=?? 

editorDataField=labelText rendererIsEditor=true 
mx:itemRenderer
mx:Component mx:ComboBox 
dataProvider={outerDocument.comboProvider}
labelField=name / /mx:Component
/mx:itemRenderer
/mx:DataGridColumn
/mx:columns
/mx:LgnDataGrid

Any ideas how to do this?

Thanks,

Mario B. 

 



[flexcoders] ArrayCollection question in Cairngorm?

2007-12-17 Thread markflex2007
Hi,

I have a simple cfc, the function is like this,it get a department 
list

cffunction name=getDept displayname=getDept access=remote 
output=false returntype=query

cfquery name=getDepartment datasource=bursary
 SELECT Id, Dept 
 FROM tlkpDept
 /cfquery
 
 cfreturn getDepartment /

/cffunction   

2.This is the modellocator .I want to save department list to the 
acDept (ArrayCollection)



public class  BursaryModel implements IModelLocator {

 
private static var instance:CESFBursaryModel;
   
...
public var acDept : ArrayCollection;

...
}


3.This is the Delegate function. this  builds a flex function getDept
()


 public function getDept():void {
 
var call:Object = this.service.getDept();
call.addResponder(responder);
 
}


4.This is part of the command class 

public function result( event:Object ):void {
 
...
 modelLocator.acDept = event.result;
  ...
 
 
}

5 the view page, bind the 

...
private var modelLocator:BursaryModel = 
CESFBursaryModel.getInstance();
...

mx:ComboBox x=440 y=268 width=142  
dataProvider={modelLocator.acDept} / 


my error is I get a list and it looks like.

[object Object]
[object Object]
[object Object]
[object Object]

 
 
 but I want to show the dapartment list,Please help me and give me a 
hit how to fix this.
 
 I do not know what the event.result is command class and how to 
convert is to a real department list.
 
 
 Thanks for your help
 
 
 Mark




Re: [flexcoders] ArrayCollection question in Cairngorm?

2007-12-17 Thread Sanjay Varma
None

- Original Message 
From: markflex2007 [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Monday, December 17, 2007 12:22:59 PM
Subject: [flexcoders] ArrayCollection question   in Cairngorm?










  



Hi,



I have a simple cfc, the function is like this,it get a department 

list



cffunction name=getDept displayname= getDept access=remote 

output=false returntype= query



cfquery name=getDepartment  datasource= bursary

 SELECT Id, Dept 

 FROM tlkpDept

 /cfquery

 

 cfreturn getDepartment /



/cffunction   



2.This is the modellocator .I want to save department list to the 

acDept (ArrayCollection)



public class  BursaryModel implements IModelLocator {



 

private static var instance:CESFBursar yModel;

   

...

public var acDept : ArrayCollection;



...

}





3.This is the Delegate function. this  builds a flex function getDept

()



public function getDept():void {

 

var call:Object = this.service. getDept() ;

call.addResponder( responder) ;

 

}





4.This is part of the command class 



public function result( event:Object ):void {

 

...

 modelLocator. acDept = event.result;

  ...

 

 

}



5 the view page, bind the 



...

private var modelLocator: BursaryModel = 

CESFBursaryModel. getInstance( );

...



mx:ComboBox x=440 y=268 width=142  

dataProvider= {modelLocator. acDept} / 





my error is I get a list and it looks like.



[object Object]

[object Object]

[object Object]

[object Object]



but I want to show the dapartment list,Please help me and give me a 

hit how to fix this.

 

 I do not know what the event.result is command class and how to 

convert is to a real department list.

 

 

 Thanks for your help

 

 

 Mark






  







!--

#ygrp-mkp{
border:1px solid #d8d8d8;font-family:Arial;margin:14px 0px;padding:0px 14px;}
#ygrp-mkp hr{
border:1px solid #d8d8d8;}
#ygrp-mkp #hd{
color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px 0px;}
#ygrp-mkp #ads{
margin-bottom:10px;}
#ygrp-mkp .ad{
padding:0 0;}
#ygrp-mkp .ad a{
color:#ff;text-decoration:none;}
--



!--

#ygrp-sponsor #ygrp-lc{
font-family:Arial;}
#ygrp-sponsor #ygrp-lc #hd{
margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
#ygrp-sponsor #ygrp-lc .ad{
margin-bottom:10px;padding:0 0;}
--



!--

#ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, 
sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text{
font-family:Georgia;
}
#ygrp-text p{
margin:0 0 1em 0;}
#ygrp-tpmsgs{
font-family:Arial;
clear:both;}
#ygrp-vitnav{
padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
#ygrp-vitnav a{
padding:0 1px;}
#ygrp-actbar{
clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
#ygrp-actbar .left{
float:left;white-space:nowrap;}
.bld{font-weight:bold;}
#ygrp-grft{
font-family:Verdana;font-size:77%;padding:15px 0;}
#ygrp-ft{
font-family:verdana;font-size:77%;border-top:1px solid #666;
padding:5px 0;
}
#ygrp-mlmsg #logo{
padding-bottom:10px;}

#ygrp-vital{
background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
#ygrp-vital #vithd{
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
#ygrp-vital ul{
padding:0;margin:2px 0;}
#ygrp-vital ul li{
list-style-type:none;clear:both;border:1px solid #e0ecee;
}
#ygrp-vital ul li .ct{
font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;}
#ygrp-vital ul li .cat{
font-weight:bold;}
#ygrp-vital a{
text-decoration:none;}

#ygrp-vital a:hover{
text-decoration:underline;}

#ygrp-sponsor #hd{
color:#999;font-size:77%;}
#ygrp-sponsor #ov{
padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
#ygrp-sponsor #ov ul{
padding:0 0 0 8px;margin:0;}
#ygrp-sponsor #ov li{
list-style-type:square;padding:6px 0;font-size:77%;}
#ygrp-sponsor #ov li a{
text-decoration:none;font-size:130%;}
#ygrp-sponsor #nc{
background-color:#eee;margin-bottom:20px;padding:0 8px;}
#ygrp-sponsor .ad{
padding:8px 0;}
#ygrp-sponsor .ad #hd1{
font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
#ygrp-sponsor .ad a{
text-decoration:none;}
#ygrp

Re: [flexcoders] ArrayCollection question in Cairngorm?

2007-12-17 Thread João Fernandes
Mark, your result is just fine, just define a labelField or a 
labelFunction in your combobox.
something like this

mx:ComboBox labelField=DepartmentName 
dataProvider={modelLocator.acDept}/

-- 

João Fernandes

http://www.onflexwithcf.org
http://www.riapt.org



Re: [flexcoders] ArrayCollection question in Cairngorm?

2007-12-17 Thread Mark Shen
Thanks João Fernandes .

Mark


- Original Message 
From: João Fernandes [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Monday, December 17, 2007 1:28:20 PM
Subject: Re: [flexcoders] ArrayCollection question in Cairngorm?

Mark, your result is just fine, just define a labelField or a 
labelFunction in your combobox.
something like this

mx:ComboBox labelField= DepartmentName 
dataProvider= {modelLocator. acDept}/ 

-- 

João Fernandes

http://www.onflexwi thcf.org
http://www.riapt. org





  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

[flexcoders] ArrayCollection Question

2007-10-27 Thread Mark Forsberg
I am dragging/dropping rows from one grid to another. At the drop I 
will be calling a .cfc to get more information for the second 
datagrid.
I have several questions about the data that I'm adding.

1. To add the data manually after I've captured my drop event do I 
need to use the Icollection? class to put the data into the datagrid?

2. If in-fact I'm using the Icollection class, when I add the data is 
that change being made in the arrayCollection? The reason that I ask 
is that once changes are made to the data, either by the automatic 
insert, or if a user edits a cell, can I then loop over the 
arrayCollection to insert the changes back into the database?

If anyone has any links about doing this I'd be grateful.

 Also, my second datagrid is both drop and drag enabled. I want 
users to be able to re-order the items in the datagrid as well as 
add/edit items. This is a scheduling application. I'll then save 
those changes to the db.
 I noticed that when I went to re-order items in the second 
datagrid I actually made a copy in the new location. The old row 
remained. Is there a special way to make sure that once I've made the 
move the old row is removed?

I really appreciate the pointing in the right direction. Flex 2 is 
really slick. I'm just running into some newb wall.

Again, thanks.

Mark F.
 



RE: [flexcoders] ArrayCollection Question

2007-10-27 Thread Alex Harui
You can use ICollectionView, but you'll probably find the IList methods
easier (addItem).

 

Those methods will change the array that is the source of the AC.

 

Re-ordering should require that dragMoveEnabled=true.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mark Forsberg
Sent: Friday, October 26, 2007 6:30 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection Question

 

I am dragging/dropping rows from one grid to another. At the drop I 
will be calling a .cfc to get more information for the second 
datagrid.
I have several questions about the data that I'm adding.

1. To add the data manually after I've captured my drop event do I 
need to use the Icollection? class to put the data into the datagrid?

2. If in-fact I'm using the Icollection class, when I add the data is 
that change being made in the arrayCollection? The reason that I ask 
is that once changes are made to the data, either by the automatic 
insert, or if a user edits a cell, can I then loop over the 
arrayCollection to insert the changes back into the database?

If anyone has any links about doing this I'd be grateful.

Also, my second datagrid is both drop and drag enabled. I want 
users to be able to re-order the items in the datagrid as well as 
add/edit items. This is a scheduling application. I'll then save 
those changes to the db.
I noticed that when I went to re-order items in the second 
datagrid I actually made a copy in the new location. The old row 
remained. Is there a special way to make sure that once I've made the 
move the old row is removed?

I really appreciate the pointing in the right direction. Flex 2 is 
really slick. I'm just running into some newb wall.

Again, thanks.

Mark F.



 



[flexcoders] ArrayCollection XMLList?

2007-10-05 Thread candysmate
I have an ArrayCollection in Flex which contains the delivery
information for a given stock item:

boxes quantity

10   20
15   20
17   20

etc 


how can I convert this into an XMLList so that it can be a
dataProvider for a tree control where each line is a branch of the
tree please?




Re: [flexcoders] ArrayCollection XMLList?

2007-10-05 Thread Scott - FastLane
Assuming your ArrayCollection contains strongly typed objects, I think 
you can make the ArrayCollection itself be the dataprovider for your 
tree.  Your class (the data stored in the ArrayCollection) just needs to 
implement the get children():Array and get label():String method iirc.


hth
Scott

candysmate wrote:


I have an ArrayCollection in Flex which contains the delivery
information for a given stock item:

boxes quantity

10 20
15 20
17 20

etc 

how can I convert this into an XMLList so that it can be a
dataProvider for a tree control where each line is a branch of the
tree please?

 




RE: [flexcoders] ArrayCollection XMLList?

2007-10-05 Thread Alex Harui
Whether the objects are strongly-typed or not, you can stick the AC in
as the Tree's DP, but you'll need a custom ITreeDataDescriptor to tell
the tree what is a branch and what the children are.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Scott - FastLane
Sent: Friday, October 05, 2007 12:01 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection XMLList?

 

Assuming your ArrayCollection contains strongly typed objects, I think
you can make the ArrayCollection itself be the dataprovider for your
tree.  Your class (the data stored in the ArrayCollection) just needs to
implement the get children():Array and get label():String method iirc.

hth
Scott

candysmate wrote: 

I have an ArrayCollection in Flex which contains the delivery
information for a given stock item:

boxes quantity

10 20
15 20
17 20

etc 

how can I convert this into an XMLList so that it can be a
dataProvider for a tree control where each line is a branch of
the
tree please?

 

 



RE: [flexcoders] ArrayCollection XMLList?

2007-10-05 Thread Tracy Spratt
Maybe someone will point to a simple custom ItreeDataDescriptor example.


 

It might be easier to convert the AC to xml.

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: Friday, October 05, 2007 3:29 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] ArrayCollection XMLList?

 

Whether the objects are strongly-typed or not, you can stick the AC in
as the Tree's DP, but you'll need a custom ITreeDataDescriptor to tell
the tree what is a branch and what the children are.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Scott - FastLane
Sent: Friday, October 05, 2007 12:01 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection XMLList?

 

Assuming your ArrayCollection contains strongly typed objects, I think
you can make the ArrayCollection itself be the dataprovider for your
tree.  Your class (the data stored in the ArrayCollection) just needs to
implement the get children():Array and get label():String method iirc.

hth
Scott

candysmate wrote: 

I have an ArrayCollection in Flex which contains the delivery
information for a given stock item:

boxes quantity

10 20
15 20
17 20

etc 

how can I convert this into an XMLList so that it can be a
dataProvider for a tree control where each line is a branch of
the
tree please?

 

 



[flexcoders] arraycollection contains() method

2007-10-02 Thread freska
Hi there,
I want to compare two arraycollection and take the different items
out. I tried using contains() method to check if the first item of
arraycollection arrayControl is in arraycollection arrayColPref, but
it just doesn't work. I mean, it is supposed to say True instead of
False. So, here's my code. Please show me where I did it wrong.


[Bindable]
public var arrayControl:ArrayCollection = new
ArrayCollection([{name:Message, data:colMessage}, {name:Assigned
to, data:colAssignedto}, {name:Start date, data:colStartdate},
{name:Due date, data:colDuedate}, {name:Status,
data:colStatus}, {name:Priority, data:colPriority},
{name:Posted by, data:colPostedby}]);

[Bindable]
public var arrayColPref:ArrayCollection = new
ArrayCollection([{name:Message, data:colMessage},
{name:Priority, data:colPriority}, {name:Assigned to,
data:colAssignedto}, {name:Status, data:colStatus}]);

public function isDuplicate():void {
var bool:Boolean = arrayColPref.contains(arrayControl.getItemAt(0));
Alert.show(String(bool));
}



RE: [flexcoders] arraycollection contains() method

2007-10-02 Thread Alex Harui
Each time you use {} you create a different object, so the two
collections have different objects with the same data.  Contains just
sees if the reference to an object is in the collection and doesn't
investigate internal properties.



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of freska
Sent: Monday, October 01, 2007 11:29 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] arraycollection contains() method



Hi there,
I want to compare two arraycollection and take the different items
out. I tried using contains() method to check if the first item of
arraycollection arrayControl is in arraycollection arrayColPref, but
it just doesn't work. I mean, it is supposed to say True instead of
False. So, here's my code. Please show me where I did it wrong.

[Bindable]
public var arrayControl:ArrayCollection = new
ArrayCollection([{name:Message, data:colMessage}, {name:Assigned
to, data:colAssignedto}, {name:Start date, data:colStartdate},
{name:Due date, data:colDuedate}, {name:Status,
data:colStatus}, {name:Priority, data:colPriority},
{name:Posted by, data:colPostedby}]);

[Bindable]
public var arrayColPref:ArrayCollection = new
ArrayCollection([{name:Message, data:colMessage},
{name:Priority, data:colPriority}, {name:Assigned to,
data:colAssignedto}, {name:Status, data:colStatus}]);

public function isDuplicate():void {
var bool:Boolean = arrayColPref.contains(arrayControl.getItemAt(0));
Alert.show(String(bool));
}



 


[flexcoders] ArrayCollection not working? Pulling out my HAIR!!!

2007-06-06 Thread Jason Ervin
Hey everyone I am having issues with using an arraycollection as a
dataprovider. I start with an xml variable (see below) then I convert
it to an ArrayCollection using ArrayUtil.toArray and I use the result
as a dataprovider. If I trace the dataprovider it prints out the xml
data, but my chart is empty. Can you use ArrayUtil on xml data with
this many nodes? I have spent way to much time on this. 

Here is what I have starting with my XML file.

XML CODE START

public var billData:XML = 
data
bill account=100-1234567
monthMay-05/month
activetrue/active
electricitybillamount60.00/electricitybillamount
gasbillamount45.00/gasbillamount
waterbillamount15.00/waterbillamount
totalbill120.00/totalbill
electricityusage500/electricityusage
gasusage71.4/gasusage
waterusage200/waterusage
electricityservicecharge18.00/electricityservicecharge
gasservicecharge9.00/gasservicecharge
waterservicecharge2.00/waterservicecharge
totalserviccharge29.00/totalserviccharge
electricitytax4.00/electricitytax
gastax2.00/gastax 
watertax1.00/watertax
totaltax7.00/totaltax
elecperdaycost2.00/elecperdaycost
gasperdaycost1.00/gasperdaycost
waterperdaycost.50/waterperdaycost  
totalperdaycost3.50/totalperdaycost 
pastdueamount0.00/pastdueamount
billingdays33/billingdays
billdate5/01/2007/billdate
budgetbillamount155.00/budgetbillamount
readtypemanual/readtype
elecmeterreadend152868/elecmeterreadend
/bill
bill account=123-2345678
monthApr-05/month
activetrue/active
electricitybillamount88.88/electricitybillamount
gasbillamount50.00/gasbillamount
waterbillamount15.00/waterbillamount
totalbill115.00/totalbill
electricityusage300/electricityusage
gasusage62.9/gasusage
waterusage189/waterusage
electricityservicecharge15.00/electricityservicecharge
gasservicecharge6.00/gasservicecharge
waterservicecharge3.00/waterservicecharge
totalserviccharge24.00/totalserviccharge
electricitytax4.50/electricitytax
gastax2.50/gastax 
watertax1.25/watertax
totaltax8.25/totaltax
elecperdaycost2.10/elecperdaycost
gasperdaycost1.90/gasperdaycost
waterperdaycost.50/waterperdaycost  
totalperdaycost4.50/totalperdaycost 
pastdueamount0.00/pastdueamount
billingdays28/billingdays
billdate3/29/2007/billdate
budgetbillamount155.00/budgetbillamount
readtypeamr/readtype
elecmeterreadend150008/elecmeterreadend
/bill
bill account=145-3456789
monthMar-05/month
activetrue/active
electricitybillamount62.00/electricitybillamount
gasbillamount45.10/gasbillamount
waterbillamount10.00/waterbillamount
totalbill118.10/totalbill
electricityusage300/electricityusage
gasusage50.4/gasusage
waterusage210/waterusage
electricityservicecharge13.00/electricityservicecharge
gasservicecharge7.00/gasservicecharge
waterservicecharge1.00/waterservicecharge
totalserviccharge21.00/totalserviccharge
electricitytax5.00/electricitytax
gastax2.20/gastax 
watertax1.10/watertax
totaltax8.30/totaltax
elecperdaycost2.20/elecperdaycost
gasperdaycost1.70/gasperdaycost
waterperdaycost.50/waterperdaycost  
totalperdaycost4.40/totalperdaycost 
email[EMAIL PROTECTED]/email
pastdueamount0.00/pastdueamount
billingdays30/billingdays
billdate3/01/2007/billdate
budgetbillamount155.00/budgetbillamount
readtypemanual/readtype
elecmeterreadend146968/elecmeterreadend
/bill
 

Re: [flexcoders] ArrayCollection not working? Pulling out my HAIR!!!

2007-06-06 Thread Brendan Meutzner

Any reason you're going through the trouble of converting to an
ArrayCollection?  The following will work with your XML data just fine...

mx:ColumnChart id=mybarchart dataProvider={billData.bill}
showDataTips=true paddingLeft=5 paddingRight=5 width=100%
height=100%
   mx:horizontalAxis
   mx:CategoryAxis categoryField=@account/
   /mx:horizontalAxis
   mx:series
   mx:ColumnSeries displayName=Electric Bill xField=@account
yField=electricitybillamount /
   mx:ColumnSeries displayName=Gas Bill xField=@account
yField=gasbillamount /
   mx:ColumnSeries displayName=Water Bill xField=@account
yField=waterbillamount /
   /mx:series
   /mx:ColumnChart


Brendan



On 6/6/07, Jason Ervin [EMAIL PROTECTED] wrote:


  Hey everyone I am having issues with using an arraycollection as a
dataprovider. I start with an xml variable (see below) then I convert
it to an ArrayCollection using ArrayUtil.toArray and I use the result
as a dataprovider. If I trace the dataprovider it prints out the xml
data, but my chart is empty. Can you use ArrayUtil on xml data with
this many nodes? I have spent way to much time on this.

Here is what I have starting with my XML file.

XML CODE START

public var billData:XML =
data
bill account=100-1234567
monthMay-05/month
activetrue/active
electricitybillamount60.00/electricitybillamount
gasbillamount45.00/gasbillamount
waterbillamount15.00/waterbillamount
totalbill120.00/totalbill
electricityusage500/electricityusage
gasusage71.4/gasusage
waterusage200/waterusage
electricityservicecharge18.00/electricityservicecharge
gasservicecharge9.00/gasservicecharge
waterservicecharge2.00/waterservicecharge
totalserviccharge29.00/totalserviccharge
electricitytax4.00/electricitytax
gastax2.00/gastax
watertax1.00/watertax
totaltax7.00/totaltax
elecperdaycost2.00/elecperdaycost
gasperdaycost1.00/gasperdaycost
waterperdaycost.50/waterperdaycost
totalperdaycost3.50/totalperdaycost
pastdueamount0.00/pastdueamount
billingdays33/billingdays
billdate5/01/2007/billdate
budgetbillamount155.00/budgetbillamount
readtypemanual/readtype
elecmeterreadend152868/elecmeterreadend
/bill
bill account=123-2345678
monthApr-05/month
activetrue/active
electricitybillamount88.88/electricitybillamount
gasbillamount50.00/gasbillamount
waterbillamount15.00/waterbillamount
totalbill115.00/totalbill
electricityusage300/electricityusage
gasusage62.9/gasusage
waterusage189/waterusage
electricityservicecharge15.00/electricityservicecharge
gasservicecharge6.00/gasservicecharge
waterservicecharge3.00/waterservicecharge
totalserviccharge24.00/totalserviccharge
electricitytax4.50/electricitytax
gastax2.50/gastax
watertax1.25/watertax
totaltax8.25/totaltax
elecperdaycost2.10/elecperdaycost
gasperdaycost1.90/gasperdaycost
waterperdaycost.50/waterperdaycost
totalperdaycost4.50/totalperdaycost
pastdueamount0.00/pastdueamount
billingdays28/billingdays
billdate3/29/2007/billdate
budgetbillamount155.00/budgetbillamount
readtypeamr/readtype
elecmeterreadend150008/elecmeterreadend
/bill
bill account=145-3456789
monthMar-05/month
activetrue/active
electricitybillamount62.00/electricitybillamount
gasbillamount45.10/gasbillamount
waterbillamount10.00/waterbillamount
totalbill118.10/totalbill
electricityusage300/electricityusage
gasusage50.4/gasusage
waterusage210/waterusage
electricityservicecharge13.00/electricityservicecharge
gasservicecharge7.00/gasservicecharge
waterservicecharge1.00/waterservicecharge
totalserviccharge21.00/totalserviccharge
electricitytax5.00/electricitytax
gastax2.20/gastax
watertax1.10/watertax
totaltax8.30/totaltax
elecperdaycost2.20/elecperdaycost
gasperdaycost1.70/gasperdaycost
waterperdaycost.50/waterperdaycost
totalperdaycost4.40/totalperdaycost
email[EMAIL PROTECTED] ccoenraets%40fictitious.com/email
pastdueamount0.00/pastdueamount
billingdays30/billingdays
billdate3/01/2007/billdate
budgetbillamount155.00/budgetbillamount
readtypemanual/readtype
elecmeterreadend146968/elecmeterreadend
/bill
/data
/* starting another xml document */

/* public var billData2:XML =
root
account id=1234567
month date=May-05
activetrue/active
electricitybillamount60.00/electricitybillamount
gasbillamount45.00/gasbillamount
waterbillamount15.00/waterbillamount
totalbill120.00/totalbill
electricityusage500/electricityusage
gasusage71.4/gasusage
waterusage200/waterusage
electricityservicecharge18.00/electricityservicecharge
gasservicecharge9.00/gasservicecharge
waterservicecharge2.00/waterservicecharge
totalserviccharge29.00/totalserviccharge
electricitytax4.00/electricitytax
gastax2.00/gastax
watertax1.00/watertax
totaltax7.00/totaltax
elecperdaycost2.00/elecperdaycost
gasperdaycost1.00/gasperdaycost
waterperdaycost.50/waterperdaycost
totalperdaycost3.50/totalperdaycost
pastdueamount0.00/pastdueamount
billingdays33/billingdays
billdate5/01/2007/billdate
budgetbillamount155.00/budgetbillamount
readtypemanual/readtype
elecmeterreadend152868/elecmeterreadend
/month
month date=Apr-05

[flexcoders] ArrayCollection to xml file function

2007-03-30 Thread Impudent1
I am trying to get some things working with my app and apollo preview.

I can get it to save a file locally when it goes offline fine. But I would like 
to start extending it so that I can give it an arrayCollection(s) and it will 
write out an xml structured file.

This is what I am using to save a basic string.


 private function saveFile():void{
 var file:File = 
File.appStorageDirectory.resolve(Files/userinfo.txt);
 var stream:FileStream = new FileStream()
 stream.open(file, FileMode.WRITE);
 var str:String = loggedinuser.toString() + \r  + other data;
 str = str.replace(/\r/g, File.lineEnding);
 stream.writeUTFBytes(str);
 stream.close();
 str = ;
 }


any snippets or links to show me how to export arrays/arrayCollections would be 
appreciated :)

Impudent1
LeapFrog Productions


Re: [flexcoders] ArrayCollection problem (binding to a Datagrid)

2007-03-25 Thread leds usop
this has been addressed in a previous post.
do a type check for objectproxy before assigning here:

grilleTerrainsACDP = event.result.terrains.terrain;

to have this:

if(event.result.terrains.terrain is ObjectProxy){
var t:Array=
ArrayUtil.toArray(event.result.terrains.terrain);
grilleTerrainsACDP= new ArrayCollection(t);
}else{
grilleTerrainsACDP = event.result.terrains.terrain;
}




--- Nicolas Boulet-Lavoie
[EMAIL PROTECTED] wrote:

 Hi,
 
 When I try to bind an empty ArrayCollection or with
 only 1 item to a
 Datagrid, I'm getting a runtime error (sorry it's in
 french but the
 error number means something in this case):
 
 TypeError: Error #1034: Echec de la contrainte de
 type : conversion de
 mx.utils::[EMAIL PROTECTED] en
 mx.collections.ArrayCollection
 impossible.
 
 Here's the code I use :
 
 private function handler(event:ResultEvent):void {
grilleTerrainsACDP =
 event.result.terrains.terrain;
 }
 
 And the grilleTerrainsACDP variable who's binded
 to my datagrid, as
 the data provider, is declared this way:
 
 [Bindable] public var
 grilleTerrainsACDP:ArrayCollection;
 
 Any idea?
 
 I use a ArrayCollection for ICursorView...
 
 Thanks
 Nicolas
 
 



 

Looking for earth-friendly autos? 
Browse Top Cars by Green Rating at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/


[flexcoders] ArrayCollection problem (binding to a Datagrid)

2007-03-23 Thread Nicolas Boulet-Lavoie
Hi,

When I try to bind an empty ArrayCollection or with only 1 item to a
Datagrid, I'm getting a runtime error (sorry it's in french but the
error number means something in this case):

TypeError: Error #1034: Echec de la contrainte de type : conversion de
mx.utils::[EMAIL PROTECTED] en mx.collections.ArrayCollection
impossible.

Here's the code I use :

private function handler(event:ResultEvent):void {
   grilleTerrainsACDP = event.result.terrains.terrain;
}

And the grilleTerrainsACDP variable who's binded to my datagrid, as
the data provider, is declared this way:

[Bindable] public var grilleTerrainsACDP:ArrayCollection;

Any idea?

I use a ArrayCollection for ICursorView...

Thanks
Nicolas



RE: [flexcoders] ArrayCollection problem (binding to a Datagrid)

2007-03-23 Thread Alex Harui
When data is sent over the wire from a server, we have to guess whether
it is a single data object or an array of objects.  If we see an xml tag
twice we know it has to be an array, but if there is only one tag, we
assume it is an object.

 

You can simply test to see if the result is an ObjectProxy or an
Array/ArrayCollection and convert it to an array if needed.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Nicolas Boulet-Lavoie
Sent: Friday, March 23, 2007 11:04 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ArrayCollection problem (binding to a Datagrid)

 

Hi,

When I try to bind an empty ArrayCollection or with only 1 item to a
Datagrid, I'm getting a runtime error (sorry it's in french but the
error number means something in this case):

TypeError: Error #1034: Echec de la contrainte de type : conversion de
mx.utils::[EMAIL PROTECTED] en mx.collections.ArrayCollection
impossible.

Here's the code I use :

private function handler(event:ResultEvent):void {
grilleTerrainsACDP = event.result.terrains.terrain;
}

And the grilleTerrainsACDP variable who's binded to my datagrid, as
the data provider, is declared this way:

[Bindable] public var grilleTerrainsACDP:ArrayCollection;

Any idea?

I use a ArrayCollection for ICursorView...

Thanks
Nicolas

 



Re: [flexcoders] ArrayCollection length

2007-02-28 Thread feiy

u can use the 
mx.collectionsfile:///home/feiy/Programs/Flex2/flex201_documentation/langref/mx/collections/package-detail.html.ArrayCollection
's 
filterFunctionfile:///home/feiy/Programs/Flex2/flex201_documentation/langref/mx/collections/ListCollectionView.html#filterFunction:
Functionfile:///home/feiy/Programs/Flex2/flex201_documentation/langref/Function.htmlproperty

2007/2/28, Mehul Doshi [EMAIL PROTECTED]:



If I have my dataprovider in the following manner:

var dataProvider = [{Date: 02-12-2007, Company1: 20, Company2: 30},
{Date: 02-09-2007, Company1: 20, Company2: 30},
{Date: 02-08-2007, Company1: 20, Company2: 30}]

How can I determine programatically:

1. The number of companies.
I dont't seem to be able to figure out how to find the number of
items in a particular element of the ArrayCollection.

2. Is there a way to structure the dataProvider so that I can also
include the company names. Thus, I can use those names for my legend.

Thanks.



 





--
闲云孤鹤 - 清冷香中抱膝吟


[flexcoders] ArrayCollection length

2007-02-27 Thread Mehul Doshi

If I have my dataprovider in the following manner:

var dataProvider = [{Date: 02-12-2007, Company1: 20, Company2: 30},
{Date: 02-09-2007, Company1: 20, Company2: 30},
{Date: 02-08-2007, Company1: 20, Company2: 30}]

How can I determine programatically:

1. The number of companies.
   I dont't seem to be able to figure out how to find the number of 
items in a particular element of the ArrayCollection.

2. Is there a way to structure the dataProvider so that I can also 
include the company names. Thus, I can use those names for my legend.

Thanks.
 




[flexcoders] ArrayCollection to comma-delimited list?

2007-02-26 Thread qnotemedia
Couldn't quite figure this one out.  I have a multi-level 
arraycollection and I need to write it out in flex as two separated 
lists - i.e.

itemA[0]: 1, 2, 3, 4
itemB[1]: 5, 6
itemC[2]: 7, 8

I'm currently using two repeaters with mx:Text to properly view the 
data, but of course, that just ends up as a bunch of separate text 
boxes vertically.  Since mx:Text doesn't have an itemRenderer, I'm not 
quite sure how to do this.



[flexcoders] ArrayCollection contains not working

2007-02-17 Thread Carlos Rovira

Hi,

I've been trying to filter an ArrayCollection with the objects that not
exist in another ArrayCollection. I use the contains method, but it seems
that does not work.
In the following thread seems that others are having the same problem with
XMLListCollectionView:

http://www.mail-archive.com/flexcoders@yahoogroups.com/msg55025.html

Someone knows if contains method really works? maybe we are using in a wrong
way?

Here is my filter:

private function myFilter(item:Object):Boolean {
   if(model.myac.contains(item))
   return false;
   else
   return true;
   }

And I use the following implementation of ICollectionView

mx:ListCollectionView
   id=mylcv
   list={model.myac2}
   filterFunction=myFilter/

Something wrong here?

Thanks.




--
::| Carlos Rovira
::| http://www.carlosrovira.com
::| http://www.madeinflex.com


[flexcoders] ArrayCollection Splice?

2007-02-14 Thread napearson99
I'm porting over one of Ely's component's data provider from accepting
an Array to accept an ArrayCollection.  He uses item.splice a lot
where item is typed as an array.  

I want the same functionality in an array collection.  Item[0].splice
works, but im not sure this is the right way to do it.  Should i use
item.list.addItemAt?

Thanks!

-Nate







  1   2   >