ActionScript3 :: Filtering Xml-attributes That Contain Dashes?
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
Similar Posts:
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
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
Sep 14, 2008
Does any one know how (by using AS3), I can choose to embed certain glyphs? When I use the embedFonts = true, it doesn't seem to be including en dashes (-) or em dashes (-), only hyphens!
View 1 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
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
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 28, 2010
I am trying to create a SWC library for use in my Flash AIR project. I have created a seperate FLA called SceneLibrary and followed the steps defined here:[URL]..to create a new SWC component. I saved the created SWC into a lib folder within my Flash Dev project, I then right click on the SWC item in my project window and choose "Add to Library" This all seems to go fine.
In my code i then go import FirstScene (this is auto completed by Flash Dev) It seems a bit weird to me that the path to this class would simply be
[Code]...
View 1 Replies
Nov 27, 2010
So I tried
var url:String = String(this.loaderInfo.url);
var request:URLRequest = new URLRequest(url);
try {
[Code]....
but thay bouth return me to [URL] while I had url [URL] I use flash builder. So what shall I do to recive real full link - not swf link?
View 1 Replies
Jun 28, 2011
I am trying to implement sorting function in c# (I wan to sort the array)
card_codes.sort(function() { return 2 * Math.floor(Math.random()) ? -1 : 1 } );
This is how ActionScript sorts array of integers in script and every time after first sort it starts with 301 but When I try to sort same array in c# it always starts with 101. here is how I sort it in c#
Array.Sort(PlayngCardCodes, (f1, f2) => 0.CompareTo(2 * (int)Math.Floor(rng.NextDouble()) == 0 ? -1 : 1));
how to exactly rewrite actionscript sort to get the same result?
View 2 Replies
Jan 23, 2012
I made a simple project which you paste XML into a TextField and and uses this. It works great however it doesn't keep the original structure which wasn't much of a problem until i recently noticed if i load or copy and paste XML which contain comments like:
<min>0.0</min>
<max>255.0</max>
In the TextField it turns to this:
<min>0.0</min>
//
<max>255.0</max>
Which creates problems as from what i can tell it would then run lines of code it should not. I would prefer if it kept the same text structure as the loading/copy and paste method seems to adjust it for some reason.can you keep the exact same XML text structure with working comments? when the XML is in the TextField it removes this part:
<?xml version="1.0" encoding="UTF-8"?>
why does it remove that rather than keeping the text exactly the same? and can i make it keep that or would i have to manually append that text again?
View 1 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
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
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
Dec 28, 2010
<note>
<to>ahmad</to>
<from>jhon
[code]....
View 2 Replies
Mar 11, 2010
I have written a Flex Library project - a .swc file - which is supposed to read default configuration from a XML file inside .swc. This .swc file would be used by other modules to perform some operation. I am unable to make the URLLoader to load the XML inside the .swc file.When i run this as a normal Flex project, things work fine without any issue. With swc, it looks bin-debug folder for the XML and not inside .swc. I want the URLLoader to look inside .swc for the config file. How do i achieve this?
myLoader.load(new URLRequest("config.xml"));
For the above code i get the following error:
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL:
[code].....
View 1 Replies
Aug 23, 2010
I have a situation where I use loadvars to load an xml file, which has the address of 2 swf's on the server. I can trace the xml items so know they are loading. So I'm trying to load the swf's but am running into problems. First problem, the swf always gives an error when I publish from flash, "TypeError: Error #2007: Parameter url must be non-null." as it can't find the mention of the xml file, as it's just being published. I'm not sure this affects the next issue which is the swf not loading when I try to load it like this:
var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest(loadswf1); // where I know loadswf1 = "myswf.swf"
loader.load(defaultSWF);
[code]......
View 1 Replies
Sep 4, 2010
what's the difference between MXML and Actionscript3 when we need to use MXML ??
View 2 Replies
Dec 16, 2010
Having some problems adding the default spark.components.VScrollBar scrollbar. All I'm doing is creating a new VScrollBar, setting it's coordinates, a width and height and doing an addChild but it's not showing up. I'm adding other components too that do show up in the same code so that shouldn't not be the problem.What might I be missing?
var a:VScrollBar = new VScrollBar();
a.x = 100;
a.y = 100;[code].....
View 1 Replies
Feb 25, 2011
I m developing an app that pulls android device IMEI and matches it against the database Is there a way to retrieve android device IMEI using actions script?
View 1 Replies
May 24, 2011
i want to have the music always playing and the ability to mute different parts. It is for a project where you click on different people and they come to life to play music. a stop and play would not have them in snyc. I have not been using action script long
var my_sound:Sound = new Sound();
my_sound.load(new URLRequest("triumphant.mp3" ) );
function setMute(vol){
var sTransform:SoundTransform = new SoundTransform(0);
[code]....
View 1 Replies