ActionScript 3.0 :: XML - Access The Attribute Src From Img
May 14, 2011
I'm using to gather information from a RSS feed (I'm interested in the src content to display an image)
[Code]...
So far so good now the tricky part is that I want to access the attribute src from img. If i trace(p[0] is XML); i get true, but if I try to trace trace(p.img.@src); or for that matter trace(p[0].img.@src); I get nothing back what am I doing wrong?
View 5 Replies
Similar Posts:
Aug 2, 2010
Suppose I have an xml looking like this?
Code:
var emp:XML =
<employees>
<employee id="6401" code="231">
<lastName>Wu</lastName>
<firstName>Erin</firstName>
</employee>
<employee id="6402" code="232">
<lastName>Wu</lastName>
<firstName>Erin</firstName>
</employee>
<employee id="6403" code="233">
<lastName>Wu</lastName>
<firstName>Erin</firstName>
</employee>; </employees>
How would I access the specific attribute "6403"? I tried sth like this but did not work :
"emp.employee[2].@id"
View 0 Replies
Aug 1, 2011
Using e4x in flex:
var attr : String = "foo";
var xml : XML =
<resultSet>
<node foo="1"/>
</resultSet>;
How can I use the variable "attr" to access
xml.node.@foo
I thought I could do it with
xml.node.@[attr]
But this doesn't seem to work. How can I access this attribute by a dynamic value like this?
Both
xml.node.@[attr];
and
xml.node.attribute(attr);
work, as Constantiner suggested.
Updates:
Say I have an XMLList in this form:
var bar:XML =
<resultSet>
<node>value</node>
</resultSet>;
I want to filter the original xml above by matching "foo" attributes with the "value" from node in bar.
Essentially I want a sublist of the original xml such that
xml.node.@foo == bar.value
for each xml row in the original value
As Constantiner mentioned, I can filter the original list by the value in foo, but what if I want to filter on multiple values?
Can I do something like:
xml.node.(bar.node.contains(attribute(foo)) ? attribute(foo) : null);
Or perhaps a cleaner method instead of the null?
View 1 Replies
Oct 14, 2009
Is there a way to access the d:userLabel attribute in Flash Builder? I want to use a number of different files created from Illustrator -> Catalyst -> Flash Builder
Looks like this:
<fx:DesignLayer d:id="2" d:userLabel="A1">
<s:Rect d:userLabel="R_1" x="150" y="200" width="500" height="300" ai:knockout="0">
<s:fill><s:SolidColor color="0xffffff"/></s:fill></s:Rect>
<s:Rect d:userLabel="R_2" x="150" y="200" width="80" height="60" ai:knockout="0" >
</s:Rect>... </fx:DesignLayer>
Now the question:
Can I access the "userLabel" with a scriptfunction? Something similar to getElementByID? I want to change for example the fillcolor of a rect or path with that function. Because I have no id here I can't do something like:
R_1.fill = blue
And I don't want to manually change the files from Illustrator.
View 1 Replies
Feb 2, 2009
I have a flex app where I need to be able to access and modify component attributes using variable names.
eg, say I want to edit the text attributes of text label.
I am not sure what object or attribute will need to be updated until runtime.
Say I get passed the following variables:
var objId:String = "label1";
var objAtt:String = "text";
var objVal:String = "Hello World";
I need to take these and update the "text" property of label that has the ID "label1" to "Hello World".
I have tried different variations to accomplish this but am stuck One example is
this[objId][objAtt] = objVal;
View 2 Replies
Apr 4, 2012
I have a flex 3 project with a root mx:Application. The width and the height are set to pct values, because the application has several sizes that can be chosen by the user, so the correct size is set on the embed's width attribute.
how to access the value in that attribute. I read in several places that this.root.loaderInfo.width should give me that value, but it always returns 500, which I am guessing comes from the default application container width [URL].
I realize I could pass it as a flashvar, but that is not a good solution in this case due to the nature of the project. I've also tried pplication.application.width, stage.width, and stage.stageWidth, to name a few. I can't depend on any of those values, since they change based on the browser zoom level.
View 2 Replies
May 13, 2009
I am having trouble parsing some xml that has a few attribute names with : characters in them. The compiler is not throwing any errors and when I trace my complete xml object out it is all there, however when I try to trace out any element or node it keeps comming up undefined. I removed the attribute names with : characters in them and everything works fine. I cant seem to target the attributes either to delete them.
View 3 Replies
Dec 15, 2006
I have been trying to figure out how you could add in custom attribute tags that flash can recover.
EX:
<param name = "movie" value = "somefile.swf">
<embed src = "somefile.swf" width = "550" height = "400">
Except, that I would like to add a Custom tag, like "randNum" so that the tag user could input some number, or rather, a flash movie could generate a tag with a number already put in...Basically, heres a really basic version of the idea.There is a Flash Movie.In the movie, you can input text into a textfield.Upon finishing your message, you click a button "save".
The flash movie then:
1. Comes up with a random number unique to the message.
2. Assigns that number to a variable... "randNum".
3. Saves message as a xml file to the server as "filename" + randNum.
4. Outputs into a textfield a generated HTML tag that a user can post on myspace and such so that it will load in the flash movie.
Except... in the tag, there will be a custom attribute. If the random number variable "randNum" was 00112233, the custom attribute will be 00112233.
EX:
<embed src = "somefile.swf" width = "550" height = "400" randNum = "00112233">
So when the movie opens, it retrieves that randNum from the tag and can use it inside flash. How can this be done? Sorry this post was so long, but I wanted everyone to understand the concept.
View 8 Replies
May 11, 2009
I am on AS2.0, CS4:i am trying to extract the following data from the XML attribute:[code]i tried to load the xml attributes into the two separate dinamic text fields:[code]
View 8 Replies
Jan 21, 2012
I am trying to get the value of an attribute full where another attribute name is equal to something e.target.name.
So in this case I am trying to get the value of "full"
var full_url = myXML.item.@full.(@name=="e.target.name");
This is my XML:
<item name="Toy Box" thumb="resize/thumb_image2.png" full="full_images/image2.png" />
<item name="Toy Train" thumb="resize/thumb_image3.png" full="full_images/image3.png" / >
<item name="Toy Truck" thumb="resize/thumb_image4.png" full="full_images/image4.png" />
So my as above should return one of the But when I trace full_url I get nothing and no errors.
View 1 Replies
Mar 2, 2012
I have this XML
<language lang = "ru">
<ru>language/ru.xml</ru>
<ua>language/uk.xml</ua>
[code]......
View 2 Replies
Jun 19, 2009
I have some xml that is full of attributes. Without much detail, i would like to translate the xml into objects. However , i need a method that can get the attribute values AND names. Getting the value is a no brainer, but the names are not coming so easy. For example, the following will translate and xml node into an object with a prop and value of the same[code]...
View 1 Replies
Apr 10, 2008
I need to be able to dynamically get the name of an attribute in AS3. So for example:
Code: Select all<setup<animation speed=".5" />
<animation transition="saturation" />
<animation easetype="linear" />
<animation clickthrough="true" />
[Code]...
View 4 Replies
Jun 18, 2007
I'm updating an old AS2 project and have a question about XML. This thing I'm working on uses two xml files, pics.xml and lang.xml. The last one of the two contains translations for the flash file and looks like this:
PHP Code:
<lang> <trans lang="sv"> <nextPic>N�sta bild</nextPic> <prevPic>F�reg�ende bild</prevPic> <showMap>Visa karta</showMap> </trans> <trans lang="en"> <nextPic>Next picture</nextPic> <prevPic>Previous picture</prevPic> <showMap>Show Map</showMap> </trans></lang>
and in the pics.xml you choose what language to display by setting an xml attribute to either "sv" or "en".My question is, how do I tell the function that parses lang.xml to only parse the node with the right language. If "sv" is set in pics.xml I only want to parse the first bit om lang.xml there, you se what I mean? I don't what to use something like: this.firstChild.childNodes[0].blahblah cos most likely the users of this will ad more languages...
View 4 Replies
Feb 20, 2009
I wanted to ask that what is the method to trace the attribute in the xml file. I am trying a code but its saying undifined. The xml file looks like
[Code]...
View 2 Replies
Jun 19, 2009
i have some xml that is full of attributes. Without much detail, i would like to translate the xml into objects. However , i need a method that can get the attribute values AND names. Getting the value is a no brainer, but the names are not coming so easy. For example, the following will translate and xml node into an object with a prop and value of the same:[code]in trying this with attributes, i need to first find a way to get the attribute name.
View 6 Replies
Jul 25, 2011
The following doesn't work: But if you change setAttribute to ("width", "800"), it works with no problem! What am I missing? Is there an alternative to setAttribute method?
View 4 Replies
Oct 19, 2011
How to add Custom attribute recusrivly. With sequence order.[code]
View 2 Replies
Jan 28, 2010
How do you set a variable attribute of a xml element?This is what I expected to work:xmlElement.attribute(variableAttr) = "the variable attribute is set to this string";
However, I'm getting some error that this value can only be retrieved as a reference and not set.Ofcourse, the following does not work either as it will look for the attribute named "variableAttr" and not for the attribute named after the value of the variable variableAttr:
xmlElement.@variableAttr = "example";
View 2 Replies
Feb 19, 2010
Here is the xml file
<glossary>
<alphabet id="A">
<term heading= "Anchor" definition="A mechanical device that prevents a vessel from
[code]......
View 1 Replies
Jul 9, 2010
i have XMl like
<record id="1" name="CustomerInfo">
<field name="id" index="1" type="String"/>
</record>
[code].....
View 2 Replies
Sep 14, 2010
I have this variable in Model class:[code]I've used BindingUtils to get notified when the XML changes:[code]Function onChange gets triggered when I assign an XML to the variable, but not when I change some attribute of the XML: Model.getInstance().someXml.@attr = "newValue";
View 1 Replies
Feb 14, 2011
very simple question, i have this: (only a part of the complete rss file)
[Code]...
View 2 Replies
May 20, 2011
Not sure how I would check to see if the value of a nodes attribute "action" is equal to "left". My XML looks like the following:
<track timestamp="18/05/2011 13:21:49-0400" id="3" action="track">
<coordinates> test 1</coordinates>
</track>
[code]......
View 1 Replies
Jul 22, 2011
The following doesn't work:
<!DOCTYPE HTML>
<title>Test</title>
<embed id="foo" src="http://www.w3schools.com/media/bookmark.swf" width="400" height="40" type="application/x-shockwave-flash" />
[Code]....
But if you change setAttribute to ("width", "800"), it works with no problem! What am I missing?
View 3 Replies
Oct 21, 2011
I wish to extract an attribute from an XMLList and assign it to a string. Here is the snippet of the XML
<node>
<sport GAME="Squash" TIME1="2" TIME2="3" TIME3="8"/>
<sport GAME="Table Tennis" TIME1="4" TIME2="6" TIME3="7"/>
</node>
I have two variables. One variable will contain the game type, either Squash or Table Tennis. The other will contain one of the following strings "TIME1", "TIME2" or "TIME3". The variables are called game and time. I have tried many variations on the code below to get the needed attribute but with no joy.
var result:String = node.sport.(@GAME == game).(attribute(time));
View 2 Replies
Apr 2, 2007
I'm having trouble getting a specific attribute my xml. Is there an easy way to say if the attribute value = 1234 then return its nodevalue
myXML = new XML();
myXML.load("sample.xml");
myXML.ignoreWhite = true;
myXML.onLoad=feeds;
[code]....
View 4 Replies
Oct 15, 2009
Anyone know if its possible ?
so I want the equivalent of
<a href='large_map.php' rel='ibox&fullscreen=true' >
Id rather not use a js call if I dont have to.
View 4 Replies
Jul 22, 2010
I have spent multiple hours on it to find no result. Here is the situation. MY xml structure looks like this:
<root>
<RES>
<R N="1">
[Code]....
But I am not able to refer to the corresponding parent <R> so that I can traverse it to retrieve corresponding <SEZ N="name" V="dummy name"/>
View 6 Replies
Mar 7, 2011
I have a few different XML documents that get loaded into my app. What I would like to know how to do is search the incoming XML string for a certain attribute (apple or peach) then route its use to the correct location.example:
<boringExample1 apple ="somevalue" ... />
<boringExample2 peach="somevalue" ... />
I am not trying to read the value of the attribute but the name of attribute itself. if my XML string has apple attribute go here else if my XML string has peach attribute go there. I hope that makes sense
View 1 Replies