Flex :: HTTPService Result - Checking Number Of Items With A Specified Name
Nov 12, 2009I have a question about HTTPService and the data it returns.
Well lets consider this XML:
<PhotoGalleryData>
<Photo>
<id>1</id>
[Code]....
I have a question about HTTPService and the data it returns.
Well lets consider this XML:
<PhotoGalleryData>
<Photo>
<id>1</id>
[Code]....
XML is cool in flex, but I have an annoying problem to solve, caused by what I can imagine is a feature. You see, when you have just one tag of something, it creates an object which is not an array. But when finds more than one, it puts it on an array structure.[code]I could check the format of resObj.specifictag (to check if it is has an array) and then duplicate the code (for each case). But -even if it's calling a function- I don't think it is an elegant solution.Well, I hope someone has a good idea on this matter. (I know from experience that SO has much more C++ experts than flex, but well...)The perfect thing would be that HTTPrequest handled every tag in a consistent way (using always arrays... though I'm guessing that that would also have its drawbacks).
View 3 RepliesI have a global settings class, and i want to switch a var (to 1) in this class, when i call the send function and switch this var (to 0), when the result event dispatched.
I created a class, extends HTTPService..i can override the send function (override public function send(parameters:Object=null):AsyncToken), but how can i override the function, which call when the result arrived?
I feel like this should be simple, however everywhere I look online someone does something different. I am doing a small charting application to track download statistics, and want to put the data into a pie chart.
<s:HTTPService id="service"
url="admin/stats/totalstats.php"
fault="service_faultHandler(event)"
result="service_resultHandler(event)" />
[Code].....
how I am transferring the data to the chart to make sure I am not doing something wrong there either.
<mx:PieChart id="pieChart">
<mx:PieSeries nameField="year"
field="count"
[Code]......
I have an HTTPService that executes the dataLoaded(e:ResultEvent):void function whenever it gets a result from a send() call. OK so If I call HTTPService.send() and then call HTTPService.send() again before the previous one receives a result, I end up repeatedly running dataLoaded() which is undesirable What I want is if HTTPService.send() gets called before a previous call to it returns a result. I want to cancel the first call, and only process the result from the last call to HTTPService.send()
View 4 RepliesI have 5 Cairngorm Events that I am dispatching at the same time(one right after the other) - all of which call a separate HTTP Service. This works fine when I run the application locally however when I deploy my project to a Glassfish server, it only works intermittently, with the app hanging when it doesn't work.
My temporary work around to this is to chain some of the events together so less call are going out at once, but I don't really like this as a viable solution because it slows down performance.
Is there a maximum number of HTTPService requests that Flex can make at once before it hangs?
My xml data [URL]. I need to load this xml data through httpservice and in the handle result function I need to access the individual data like complaints.complaint.title using for loop function. I had tried this I couldn't get the result as I need
<s:HTTPService id="Complaints" url="[URL]" result="Complaints_resultHandler(event)" fault="Complaints_faultHandler(event)" >
</s:HTTPService> <fx:Script> <![CDATA[
protected function Complaints_resultHandler(event:ResultEvent):void {
[Code] .....
I need to get the data like title, complainturl, latitude, longtitude etc.
How do i retreive the total number of items (count) of a combo box in Flex?
View 4 RepliesI am using Datagrid control in flex.I need to get the count of number of items in that Datagrid. What is the method to get that?
View 1 RepliesIndeed the best for fast building of Web based Apps...
I'm trying to do something with eventListeners, but i still do a lot of messy code, so wanted help of those who already know flex.
I'm have a DataGrid, and its itens are added by another component, no problems with that.
I have buttons to Add, Remove and Edit the items inside the DataGrid. No problem with that too.
But i want those button to be enabled when the DataGrid as at least one item, and when it doesn't as any, all three buttons should be disabled.
EDIT: Forgot to say: I think eventListeners are the best way.
I'm using a Repeater object in Flex. Would be possible to stop the repeater after 50 iterations.. even if my dataProvider is bigger ?
I want to display only the first 50 items. I'm using MXML to implement the repeater.
I have my ADG displaying data like this:
[Code]...
In my AIR application, I try to dispatch a custom event from a class to main window.This class is use to call httpservice. My goal is to send a custom window when the httpservice result is send.[code]...
View 1 RepliesI have a random number and a textfield.how to put the result of the random number operation in the textfield ?
function fl_GenerateRandomNumber(limit:Number):Number{ var randomNumber:Number = Math.floor(Math.random()*(limit+1)); return randomNumber;}trace(fl_GenerateRandomNumber(100));[code]....
I am working on a project where I need a lot of calculations.I found a really strange and very annoying problem in Flash: If you try to multiply 17.4*32.8 the result is 570.7199999999999 !!! This is just a single example.In this way my application looks buggy sometimes. What's the reason for this wrong result?In my application I don't want to round the numbers .
View 5 Repliesbasically I have an array that stores some var(int/numbers). And when I loop through the array changing the numbers of the var, at the end the number seems still unchanged. You would have a better idea of what I'm talking about base on the below code.
private var _numArray:Array = new Array()
private var _no1:int
private var _no2:int
[Code]....
well here is my code that I have
shuffle=Math.ceil(Math.random()*2)
shuffle2=Math.ceil(Math.random()*4)
if(shuffle==1){[code].....
that works all fine and dandy except that i have these pictures and there are 4 hawaii pictures and only 2 ua pictures. and it loads everything correectly but whenever shuffle = something more than 2 and shuffle = 2 (like if shuffle =2 and shuffle2 = 4, it owuld load ua4.jpg, which doesnt exist) so how can I check to see if it is there and if its not, redo shuffle2?
well here is my code that I have
shuffle=Math.ceil(Math.random()*2)
shuffle2=Math.ceil(Math.random()*4)
if(shuffle==1){
[code].....
I have this Array
Code:
var shoprubriken:Array = new Array();
shoprubriken[0] = "43";
shoprubriken[1] = "44";
[Code]....
Now I wanted to check on which Index Position maybe the 47 is
How can I archive this on a Button or Function?
I would like to use the selectionMode=multiple described in the Flex docs, but with a few modifications:
1) I would like the box that the user drags over the graph to remain there until the user drags a new one.
2) In the top right corner of the box I want to display the sum of the items selected by that box.
How to make list items as tool tips for combo box items?
View 2 RepliesI'm creating a facebook application in flex. I'm actually working on the friends component that shows your friends who are using the application. now, each friend has a profile image.
I created the component using a s:List element.
In the Skin Class of the element i configured the requestedColumnCount to 3, which means it shows 3 friends. i added buttons to scroll left and right in the list.
Whenever I scroll to see a different friend, for a half of a second i see no image because the List component is loading the image in order to view it.
is there a way to make the list preload all the elements so i won't have this kind of problem ?
I have an Array where in position 0, there are two items "name1" and "name2", then in position 1, there is only 1 item "name3", and position 2 there is only 1 item "name4".
Now when I trace like this:
trace(exampleArray[0].length)
The result is 2;
But when I trace like this:
trace(exampleArray[1].length)
The result is 5;
I understand that on the second trace its counting the length of the item so its the number of letters that its returning. I'm just wondering how can I get it to return 1, which is the number of items in that position which is what I'm interested in.
I'm trying to get the number of items with a certain attribute in a xml file....for example, i want to find out how many "thumbs" there are with an attribute of "websites"
var items = web_xml.firstChild.firstChild.childNodes;
var numOfItems = items.length;
The above gets me the TOTAL number of items in the WHOLE list (numOfItems) so i'm guessing i need something like:
var webItems = items.attributes.type == "websites";
var numOfWebItems = webItems.length;
but that doesn't work...
Here's the xml file:
<menu>
<thumbnails>
<thumb type="websites">
[code]...
I have an Array where in position 0, there are two items "name1" and "name2", then in position 1, there is only 1 item "name3", and position 2 there is only 1 item "name4".now when I trace like this:trace(exampleArray[0].length) the result is 2;but when I trace like this:trace(exampleArray[1].length) the result is 5;I understand that on the second trace its counting the length of the item so its the number of letters that its returning. I'm just wondering how can I get it to return 1, which is the number of items in that position which is what I'm interested in.
View 5 Repliesanyway to do a Math.random on selecting a certain number of XML items?
View 8 RepliesIs there a limit to number of items that can be added to Flash ContextMenu, I am trying to add 16 items but only 15 are displayed.
View 2 RepliesI have a Flex client making RESTful calls to a webservice using HTTPService. The server is returning JSON responses, which we would like to compress. Can Flex using HTTPService handle gzip-encoded responses? If so, what steps are required to make it work (e.g., which headers to set, how to decompress, etc.)? If not, can you suggest a simple alternative?
View 1 RepliesHow can i call a CGI script in flex 3? Also how can i retrieve the result of exection of that cgi script?
For example, lets say my CGI script(hello.cgi) just display "hello world". How can i call this script from flex 3 and then retrieve the result, i.e. hello world , so that it can be displayed on my flex application.
I have a small question. I am probably misunderstanding something, but when I do :
[Code]....