ActionScript 3.0 :: How To Return An XMLList
May 19, 2009[Code]...
xmlList is alive and well in the xmlLoaded function. I need to access it in the loadMusic.fla.
[Code]...
xmlList is alive and well in the xmlLoaded function. I need to access it in the loadMusic.fla.
When querying/filtering my XML var I want it to return XML not an XMLList...I can't work out the best way to do it!
dataXML.rooms.room.(@id == _targetID)
//returns XMLList
dataXML.rooms.room[0]
[code]....
I have an XMLList 'Keywords', which consists of about 30 elements. I want to count the number of unique keywords in the List, and how often they occur. Then display the top 3 most occuring keywords.
View 1 RepliesTrying to get XML into an XMLList, having seemingly nonsensical problems.
Code:
package
{
import flash.display.*;
import flash.net.*;
[Code].....
I'm having some troubles with the use of interface and inheritance in AS3. I've done lots of OOP in the past and what I'm trying to do seems obvious to me, but doesn't work in AS3. The question is : Is it possible to override a function that return an Object of class A, and make it return an Object of Class B which extends A ? It seems not to be possible, since I'm getting a signature error in Flash, when compiling. For example, the following set of class do not compile (the code in function definition doesn't matter):
[Code].....
difference between XML and XMLList in my example code? I am passing a node to the function and extracting the url of the file:
private function getFile(node:XMLList):String {
var file:String;
for(var i:uint=0; i<node.children().length(); i++) {
trace("Test 1: "+node.children()[i].@id);
[Code]....
Why do I have to have 'current' as XML and not as XMLList? I thought XMLList's with length == 1 are handled as XML's anyway, aren't they?
I am trying to parse some XML i have retrieved via e4x in an HTTPService. The loop works and for each episode in the list it goes through the loop. However i get the following error when it is trying to append to an XMLList.TypeError: Error #1009: Cannot access a property or method of a null object reference.I am trying to query the local SQLite database and see if the episode exists (working) and if it does append to one xmllist and if not then append to the other xmllist.
public static function seasonFavHandler(evt:ResultEvent):void {
Application.application.ManagePage.selectedShow =
Application.application.ManagePage.gridFavourites.selectedItem as XML;
[code]......
How can you tell if an XMLlist object in AS3 contains a specific node?
View 2 RepliesMy Flash designer is reading an XML stream I'm sending back to the browser (I'm a C# dev). We have this working fine.
He is then selecting into an XMLList where a element has its id a certain value i.e. . This is also working just fine.
In this XmlList, are Events, that look a little something like this:
event
startdate
enddate
end event
I don't know how to use the formatting here - but each of those items is an element. startdate would have a value such as 04/02/2010 and enddate 6/30/2010.
Now, from this XmlList I do have of Events, I need to select all Events where a new variable myDate, falls in between the startdate and enddate.
I am working with an XML list at the moment, which looks like this:
<feature type="startLocation" value="1" x="15" y="3"/>
<feature type="startLocation" value="1" x="15" y="4"/>
<feature type="startLocation" value="1" x="15" y="5"/>
[code].....
I have the following XMLList and am trying to return the XMLList with the node having the label Mail Box or Outbox, depending on string variable called folder. folder can either be equal to "Mail Box" or "Outbox".
`<fx:XMLList id="treeData">
<node label="Mail Box">
<node label="Inbox">
[code].....
I'm trying to loop through an XMLList and rather than giving me each item in the list as XML, it's just coming back with the positions as strings e.g.
[Code]...
It just alerts "0" or "1". If I inspect the 'item' variable, I see the same thing. But if I inspect 'myList' it looks like the XML. I've also tried myList.children() and strongly typing 'items' to 'XML' but nothing I do has worked.
What I want to do is loop through an xml file, and assign the contents of each node to a static variable with the same name. [code]...
View 1 RepliesI have this xml file.[code]But I want these node names, example: element,attribute,element in arrayList.[code]
View 1 RepliesThe aim is to get the flat xmllist out of a xml: each item of the xmllist would be a descendant (not just child) of the xml. This way I have all the nodes of an xml inside the xmllist.
For example:
XML=
<a >
<b >
<b1/>
[code]....
I am trying to get my loop to look through the XMLList and print out each entry before moving on the next but it prints out all three then loops through the whole things three times??
[Code].....
I am trying to make a simple news feed. Same code as the Basic AS3 XML sample by Lee. Can't get the XMLList to return anything.If I trace the var "xml" I get my xmlfile. But as soon as I try to trace the newsBoxContent XMLList object, I get "undefined" in the output window. Here's the AS3 code:[code]
View 5 RepliesI'm pulling some events out of a MySQL db, parsing to an XML file, and having flash pull that in. All works fine, but I'm encountering an XML tag, and I'm not 100% sure why. I searched but the keywords are so vague I didn't find anything of value.
[Code]....
So with one event, it works fine. With more than one, I get in the info.eventNameTxt textfield something like <name>Christmas Afterbash</name>. how to circumvent this? I haven't quite been able to wrap my head 100% around the E4X stuff.
I have a problem with XML filtering. [code]If there is only one result, trace is empty. If there are 2 results or more, they will be traced fine. Is it because one result is not an XML 'list'? If so, how do I get the results if there is only one match?
View 2 RepliesI have this XMLList:
<content> <TextFlow color="#000000" columnCount="2"> <p>One</p></TextFlow> </content>
I need to get <textFlow> as an XMLList and as String.
If I have an XMLList object in Flex, what is the proper way to check to see if the list is empty? Should I just compare the result of myList.length() > 0, myList.toString() != "" or try another method altogether?
View 1 Replies<a>
<b>
<c/>
<c/>
[Code].....
I want a | b/c nodes returning i.e. I want an XMLList containing a's and c's but without the b's...
I am doing databinding on the xml so don't want to create a new root and add the children in two steps.
I've a XMLList like:
<parent>
<one>
<child id="1" />
<child id="2" />
[Code]....
Where the _loc_1 would be "one" or "two". Is this possible with the getDefinitionByName() to do this?
Is there an XMLList equivalent to Array.indexOf?
For example -
var array:Array = ['one','two'];
trace(array.indexOf('two')); // returns 1, since it's at the second position
trace(array.indexOf('three')); // returns -1, since it isn't found
[Code]...
there's got to be an easier way to check to see if one of the nodes in the XMLList has a particular value than looping through all of them, right? something akin to -
xmlList.indexOfChildByNodeValue('two'); // returns 1, because it's the second child
xmlList.indexOfChildByNodeValue('three'); // returns -1, because it doesn't match any children
How would I get a range of items from my xmllist similar to the slice method for an array?
slice(startIndex,endIndex);
I am trying something like this:
var tempXMLList:XMLList = new XMLList();
[code].....
I am trying to create a xmllist variable in action script like this:
var _menuData:XMLList;
<menuitem label="File">
<menuitem label="Backup Schedule"/>
[Code]....
How do I assign this xml to _menuDAta in actionScript? I dont want to create a string first and then do it all by fixing line break errors.
In Actionscript 3, is there a way to sort the nodes (instances of type XML) in an XMLList in document order (as defined in the XDM spec; "Informally, document order is the order in which nodes appear in the XML serialization of a document")? Alternately, is there a way to compare the document position of two nodes?
Here's a little example of what I mean. In the real case, the list is constructed by a much more complicated process and might have hundreds of nodes.
[Code]...
I use httpservice with e4x format. I put the result on XMLList (dpListePatient) like that
[code]...
I 'd like to binding thsi result with some label on my form. I try a lot of solution but any was good. For exemple, I' d to access on id property, to do that, I try dpListePatient[0].id but when I test value is blank. So can you explain to me how to access node value. Indeed on forum, I found a lot of message about attribute but not about node.
how do i convert XML or an XMLList to an arraycollection?
View 3 RepliesI'm trying to figure out how to reference a child of an xmlList object using it's attribute value. I've successfully created an xmlList (galleries) of all the 'gallery' nodes in the loaded xml file. What I can't figure out is how to properly reference it's children when creating a new xmlList (currentGallery). What is the correct way to reference a child of the galleries xmlList by it's 'name' attribute?
ActionScript Code:
var xml:XML = new XML(loader.data);
xml.ignoreWhite = true;
var galleries:XMLList = xml.gallery;
//how could I choose to target the gallery node with the name attribute of LANDSCAPES?
var currentGallery:XMLList = galleries.gallery name=="LANDSCAPES".image;
[Code]...