ActionScript 3.0 :: Flash XML Filtering Descendant Attributes
Oct 22, 2010
This is my first post on this forum, so sorry If Im posting in the wrong spot or asking stupid questions. I've been programing for several years, but I'm kinda new to using XML in flash. I'm making an xml menu system and I would like to know if it is possible to filter without a defining the parent node. For example I would like to do this... var whatIwantToFind = myXML..(@name == 'munkinugget'); Unfortunately this throws a syntax error. It tells me that its expecting a double colon before the semicolon.
[Code]....
View 4 Replies
Similar Posts:
Mar 8, 2010
I'm having hard time reaching the right nodes here. The XML structure is like this:
HTML Code:
<map>
<y>
<rs>
[Code]....
I'm trying to return a list of names for countries that contain company nodes with t value of f, so here are some of my attempts. None of them work.
Code:
_xml.y.rs.r.cs.c.(child("is").i.@t == "f").@n
_xml.y.rs.r.cs.c.(child("is").(i.@t == "f")).@n
_xml.y.rs.r.cs.c.(child("is").i.(@t == "f")).@n
The problem is that the selector either returns too many or too few nodes.
View 9 Replies
Dec 22, 2009
There are dashes in attributes of an xml, and I don't know how to filter them: Here you can see a simple example of the xml:
<posts>
<post>
<photo-url max-width="1280">http://blabla.tumblr.com/photo/98</photo-url>
</post>
</posts>
Because also the photo-url-tag has a dash, I needed to parse it with ...child("photo-url"). This worked fine, but if I want to filter these tags(photo-url), in order to receive all photo-url's with the same attribute: "max-widht='1280'", I couldn't manage to do so. I tried this approach:
var photoUrl:XMLList = xml.posts.post.child("photo-url").(@max-width==1280);
I get this error:
ReferenceError: Error #1065: Variable @max is not defined.
View 2 Replies
Aug 24, 2010
I have some xml and I am trying to filter it using e4x. My e4x statement looks like this:
model.config.source.fees..fee.(@min<amount).@amount
My xml looks liks this:
<flex><fees>
<fee type="credit" min="0.00" max="200.00" amount="6.00"/>
<fee type="credit" min="200.01" max="370.00" amount="10.00"/>
</fees></flex>
When the e4x statement is run, I get an error message:
Error #1065: Variable @min is not defined.
But if I change my statement to model.config.source.fees..fee.@min it will return an xmllist of all the min attribute values, so min is defined, at least in that statement. Why doesnt the original statement work?
View 1 Replies
Dec 10, 2010
ok so in actionscript using xml I can find all the nodes of the same name using
xmlList.descendants("nodename");
and that returns me a XMLlist of those nodes that exist within the xmlList I provided all well and good but now I want to only get the one node of the returned value that has the largest value.
Do I have to loop through the resulting nodes or can I get that node without a loop maybe some other xmllist function I'm not aware of ?
View 2 Replies
Oct 26, 2010
I would like to be able to quickly check if a given DisplayObject is a descendant (not in the inheritance sense - ie. child, grandchild, great-grandchild, great-great-grandchild, etc.) of another DisplayObject. There doesn't seem to be a native way to do this and I can only think of two ways to achieve it: Create the mother of all nested loops. Seems a bit, I dunno, wrong? Dispatch a bubbling event at the 'child' and check if the potential 'parent' receives it.
[Code]...
View 2 Replies
Nov 19, 2010
I have a custom component with a couple of text input fields (among other things) that is used as the row components in a tree. I have had to write my own drag and drop handling, and have almost finished the start handler (which I did last), using mouseDown as the event to kick if off.It basically works, but when the tree is expanded enough so that a scroll bar shows, using the scroll bar drags a row of the tree at the same time ! Not the desired behaviour.Looking in the debugger, I can see that when a row of the tree is dragged the currentTarget is the tree itself, and the target is the textInput component. Looking at the parents of that component I can see my custom component (that contains the textInput) a couple of levels up.My question is, is there an easy way to determine if this target is descended from my component, so that I can initiate a drag only if that is the case ? event.target is doesn't work by the way.
View 2 Replies
Jun 29, 2009
I am dynamically creating a number of objects (movieclips) which all have a number of attributes.[code]and so on. i.e sub attributes. I don't think this is possible? Only sprite and movieclips can have dynamic attributes so unless atrbY is a movieclip (which it isn't, it's a string) it isn't allowed?Each object can have suboptions with further attributes associated with the chosen suboption.Later in the program I will manipulate, read and interact with the objects and they have text display behaviours dependent on the suboption chosen. That part (should) be straightforward! heh. One the object has the attributes attached in a usable format, accessing them should be simple.This will be for a store. i.e t-shirt1 has size small, price 10, size medium, price 12, size large, price 14. t-shirt2 has size medium, price 35, size large, price 40 and so on.[code]
This format of the XML can be adjusted if it would make the parsing easier.I am currently reading the XML in, stepping through, grabbing the individual parameter such as category and then adding it as an attribute of the object and it works fine. i.e. I end up with obj.category = 'catname'. However, on suboptions I am having a problem.Should I put all the suboptions in a multidimensional array and use nested loops to apply them to the object?I would still have the problem of objX.suboptionarray[Y].suboptionprice which isn't allowed? In the above XML case Y would be 0,1 and 2 giving 3 suboptions to objX and each suboptions would hold attributes such as pvid associated with that suboption.I could go down the horrible route, obj1.suboption1subptionprice ; obj1.suboption1suboptionpname; obj1.suboption1suboptionvalue; obj1.suboption2suboptionprice; obj1.suboption2suboptionpname and so on and so on for each suboption which could be five options (small,medium,large,x-large, xx-large) and which would "work" but would be bad programming and involve splicing names to get say, the "third" suboptions' price and pvid e.t.c
Going down the route of mutidimensional arrays sounds good except that on say 50 objects I would have stacks of arrays which I'm guessing isn't great in terms of resources?.Just to add, the number of suboptions varies between object, every object has a minimum of one suboption (default option) but can have as many as needed (unlikely to be more than 5 but should be scalable). i.e some t-shirts only come in medium whereas some have many sizes.I have a fair amount of leeway on the format of the XML which I generate from the database so the formatting of that could change to make the parsing easier.
View 0 Replies
Dec 3, 2006
I think using sliders is an interesting way to give the user a better way of filtering the data like the ones used atUsing check boxes and drop downs also seem to work as it can improve the users search/filter experience.What is the best approach/methodology to use to build this sort of Flash solution? I want to build simple interfaces that can be used anytime with pre-defined data that the user can organize or filter by various different categories. Examples I can think of are product, house or holiday searches using categories such as price, quanity etc.
View 10 Replies
Jul 22, 2010
I am new here at Kirupa. I have read the xml tutorial by kirupa but I have problem with filtering my xml. Following is the situation. I have an XMLList : list =
[Code]...
So If there is more than one result no problem! Problem comes only when I have only one result.
View 1 Replies
Jul 7, 2010
I am trying to filter xml data based on a varying amount of factors, both category and range (code below). Is it even possible to put more than one conditional statement in an XML filter?
Code:
var l_results:XMLList = xml.products.product;
// testing
currentRanges = ["floss", "envy", "cool", "moon"];//
[Code]....
View 1 Replies
Jan 29, 2010
I am trying to build an image gallery that will be dynamic, for example if a person will choose show me image gallery of products of price over 200 $ , he will see those products only, if he will choose back he will see all products images again... for better understanding what i need to do is something similar to this : [URL]
View 3 Replies
Jan 11, 2010
I've tried many different ways of accessing the name of an attribute, but just can't get it working.The current Function:
protected function applyProperties(_axml:XML):void
{
var list:XMLList = _axml.properties;[code]...........
I have tried the name, I've tried searching it as an Object, I looked for solutions on stackoverflow.. nothing has worked for me so far. Originally I had the properties node as such: fearing that Flash was interpretting incorrectly.
edit: It seems like the XML was interpretted rather than printed out..
View 2 Replies
Jun 4, 2011
i'll put a "#" sign on the part where i ask for clarity!this is the code from this link[URL]i know this link explains it by detail but i still don't some parts of the code
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.utils.Timer;
[code]...
View 1 Replies
Jun 30, 2011
Is it possible to display multiple attributes in a mx:Tree component? The XML looks like this:
<item comment="blabla" author="user1" date="21.05.2011">
<item comment="blabla" author="user2" date="21.05.2011"/>
<item comment="blabla" author="user3" date="21.05.2011"/>
</item>
I want each node to display the comment, author and date, on separate lines.
I am planning to use this to display something like the facebook wall: someone writes a message and the other users can comment.
View 2 Replies
Nov 15, 2005
i want to load all the attributes by the name "pagename" within this xml file into an array : my_array
xml file:
Code:
<?xml version="1.0" encoding="UTF-8" ?>
- <earnvaluemanagement>
- <module id="01" title="Overview" foldername="content/module_01">
[Code].....
View 2 Replies
Feb 12, 2007
Have flash loop inside my xml file to find a attributes that will till flash to do THIS or DO THAT.
[Code]...
View 3 Replies
Jun 8, 2006
i was mugging on this tutorial :
[Code]...
The return a.attributes.first > b.attributes.first will return what value?
View 1 Replies
Mar 14, 2012
I have been given the SQL file which i have exported as XML, i understand this is the easiest format for flash to read. I am sure this is a really simple thing to do as it is basically filtering the sql/xml.
View 1 Replies
Jul 16, 2009
how to filter the below XML (loaded into a var called "projectsXML") by the contents of the "tag" nodes, but can't quite get it working. So for instance, how would I use an E4X expression to return an XMLList that contained only those projects which have a tag of "Website"?
[Code]...
View 4 Replies
Sep 21, 2011
Recently struggling with weird IE9 + Flash problem I came over multiple advices to use classid and codebase attributes specifically for IE. But couldn't find any explanation of why they might be required or what they simply do. Any good writeup on this topic anywhere? Side-question: Can I just make classid value up out of my head or it should be generated according to some rules?
View 1 Replies
Dec 23, 2011
I'm trying to create some sort of rangking. For this, I'm using a multilevel xml which I create with a php file.
[Code]...
View 2 Replies
Oct 19, 2006
My brain has melted at this point, so I'll ask you all - how do I filter for the following attribute:
story.attributes.year == "2005"
in the code below, so that only the nodes marked "2005" are displayed? Files are attached.
Code:
//Create textfield
this.createTextField("content_txt", 10, 0, 0, 390, 0);
//Create and load styles
[Code]....
View 3 Replies
Aug 19, 2008
Making a XML Filtering - Sorting funcion.
View 2 Replies
Apr 22, 2010
I have an array that has 30 date objects. The date objects are indexed in the array from the minimum date value to the maximum date value. What I would like to do is retrieve only 7 dates from the array. Out of the 7, the first one should be the minDate and the last should be the maxDate, with 5 dates in the middle. The 7 numbers should increment evenly from the minDate to the maxDate.
View 1 Replies
Jun 17, 2011
I have an array that contains movieclips. All of the movieclips have te type and they are all positioned on the stage next to eachother.
Above the displayed movieclips i have 3 buttons, each simbolizing a type, what i want to do is: i click on one of the buttons and all of the movieclips that dont match the right type should be removed from the stage, the remaining movieclips should then tween so that they are next to eachother again. If i click the button again then the movieclips should be displayed again to where they were and should all be positioned again next to eachother.
View 2 Replies
Oct 5, 2009
can I somehow word something like this:
ActionScript Code:
var i:uint = 2;
myLoader.load(new URLRequest(myXML.category[0].project[/* ...node which attribute named
[code]....
View 2 Replies
Dec 10, 2010
is it possible if we want to filter or search node in XML just like SQL did. For Example
Code:
package{
import flash.display.Sprite;
public class Main extends Sprite{
[code]....
Then in Fruit.FLA i have an input text with button, searching is focused on Color Attributes of fruit if I want to write "re" on input text -> click button and then shows Fruit Color contain "re" --> red, green and it shows Watermelon, Pear dan Orange as result.
View 2 Replies
Jan 5, 2011
I've made a file that reads my URL string and posts it on a text box named queryString and my URL parameter is posted on that text box.
Waht I need to do now is filter that information into 3 diferent boxes, ex:
// this is OK
URLparameter = ?var1=val1&var2=val2&var3=val3
[code]....
View 4 Replies
Jun 16, 2011
I have learned all I needed to know about flash and XML so far from this outstandingly clear and well-written article here on kirupa:m. Seriously, this is the best tutorial on the topic I have ever come across.There is, however, one case that occurred to me recently, which isn't covered. Maybe it's too specific, or maybe there is no solution to it....I want to do the following: I have written a base-class for preloading XML and images. I want to make it useable for many future-projects. However, the XML-Structure of my projects vary a lot. hat I need is a way to retrieve all tags of a given type, wherever they are. For example, I want to get all images tagged with <picture></picture>-tags from the xml, independently of the structure:
PHP Code:
<gallery><picture>image1.jpg</picture><picture>image2.jpg</picture></gallery>
PHP Code:
[code].....
View 2 Replies