ActionScript 2.0 :: Access Nested Nodes In XML?
Dec 27, 2007I am trying to access embedded info (i.e. "html", "width", etc.) from this xml code sample.[code]...
View 5 RepliesI am trying to access embedded info (i.e. "html", "width", etc.) from this xml code sample.[code]...
View 5 RepliesI am trying to format some XML and am having trouble inserting child nodes into a certain node. I am trying to create a loop that inserts the following child (<file href="slide_5.swf" />) into the manifestXML.resources.resource node. I have been working on this for hours and it's killing me.
ActionScript Code:
function formatXML():void{
var manifestXML:XML =
[code].....
I received word that my code was such a mess that it was confusing people. So I'll try to simply post my xml and then explain what I've been tasked with doing. [code]...
View 0 RepliesBasically, this is what I'm trying to do:
1: add a textbox, insert the title node,
2: then another box to display the activity under the title (which will add the description to a display textbox on click)
3. loop through the activity nodes until they are all listed under the appropriate title
4. add another text box and repeat with the next itinerary
how to build all of this right.
Code: Select all<?xml version="1.0" encoding="UTF-8"?>
<xmlLists>
<itinerary>
<title>MONDAY - FEBRUARY 22</title>
[Code].....
I'm trying to access some information in XML. I got the first few nodes working, but for the life of me, I can't figure out how to get to the nested nodes. I've tried everything i can think of. I thought it would have to do with nested for loops, but i couldn't get it to work. What am I missing? I've been pretty successful with simple XML, and this is relatively simple too, but more than I'm used to at this point... If there is a better way to do any of this, I'm all ears (or all eyes in this case )
[Code]...
I am trying to format some XML and am having trouble inserting child nodes into a certain node. I am trying to create a loop that inserts the following child (<file href="slide_5.swf" />) into the manifestXML.resources.resource node.[code]
View 1 RepliesA web service return to my flex3 client this custom exception:
<SOAP-ENV:Fault xmlns:ro="urn:Gov2gLibrary" xmlns:SOAP-ENV="[URL]" xmlns:xsd="[URL]" xmlns:xsi="[URL]" xmlns:HNS="[URL]" xmlns:SOAP-ENC="[URL]" xmlns:v1="[URL]">
<faultcode>E2gError</faultcode>
<faultstring>abc</faultstring>
<detail><HNS:ROException>
[Code] .....
This is obviously a part of the FaultEvent object I get when the remote call fail, so I'm trying to access "T2gMsg" subnode values like this:
protected function onFaultEvent(e:FaultEvent):void {
var obj:Object = e.fault;
var err:XMLList = obj.element.detail.children()[0].children();
// now I have in err the "Messages" list, subnode of ROException,
// so I should cycle to read one message at time:
for each (var x:XML in err.children()) {
//?
}
How to read ID, Severity etc values. I think something like "x.ID" should work but it's not, while x.child("ID") or x.elements("ID") return null. What can I do?
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 seem to have an array scope issue. I have a global variable; var itemConnect:Array = new Array(); Which is initialized at the start. I then have a function to populate it as a 2-d array:
[code]...
It seems to have scope access to just one of each of the [i] nodes, so [1][2], [1][3], [1][4] are missing - only the last [j] element appears. What is the correct way of doing this? I also don't know the exact size of the array at the start which may be an issue.
I need to loop through every item within my XML. It's pretty big and subdivided and I can't re-do the system.Is there a way to access items without using the names of the tagsSomething like:_myXML[i][j][k][l][m].name ?instead of:_dockXML["tag1"][i]["tag2"][j]["tag3"][k ]["tag4"][l]["tag5"][m].namei, j, j, l and m all being nested loops to access all the items? :/The problem is that if use the name I have to use more conditionals and the like because of the way it's structured.
View 9 Repliesok, im about to pull ALL my hair out trying figure the tree model for accessing xml nodes in flash. just when i think i have it figured out...i don't.my XML file...
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<mag>
[code]......
My class ends in 4 hours and I'm stuck with final project!My final project need to look like this: Budapest72FFairWind: 14mph
My ActionScript for Dynamic Text (called "dtf") and a scrollbar (called "sbar") is:
import flash.net.URLRequest;
import flash.net.URLLoader;
[code].....
I am trying to create an image gallery :
<card>
<product catalog="Thread Works">
<name>AK E001</name>
[Code]....
I can access the attribute, but if i am selecting "Thread Works" i want only access <product catalog="Thread Works"> with children node , for additem to array collection
Access parent child nodes and attributes in XML?[code]...
View 1 RepliesI develop a piece of code that brings me to an xml, all Nodes i use this code:
for(var i=0; i< menu_xml.childNodes.length; i++){
corrent_node = menu_xml.childNodes[i].length;corrent_item.action = corrent_node.attributes.action;corrent_item.variables = corrent_node.attributes.variables;corrent_item.name.text = corrent_node.attributes.name;
[code]....
What I need is for each of the nodes highlighted in green to return the child Nodes. Example: when I move the mouse over the menu Indoor lighting, the results should be: Indoorlighting | LED 10W> 3W LED> LED 6W
For those unfamiliar with tree structures, tree structures are usually dynamic lists where every node has a pointer to two other nodes. They are arranged so it makes for faster searching and stuff and are very useful in programming languages that offer direct access to heap memory. Although I don't know if there would be benefits of making tree structures in AS would be of any help but I decided to have a go at it anyway. Since there are no pointers in flash I tried to just replace pointers to nodes with nodes themselves. Such things usually work in java I think because the language just automatically makes pointers for variables.
[Code]...
i have a textbox (totaltxt) within a movieclip (link_mc) which is on frame1, and i am trying to access the contents of totaltxt and put it in another textbox called totalround1 in frame2...e.g. if totaltxt = 100 then totalround1 should equal 100 aswellthis is my failed attempt:PHP Code:totalround1.text = Number(link_mc.totaltxt.text);
View 1 RepliesI am having problem with 2d nested arrays, I want to create one which is coming from XML. My XML ('test.xml') looks like this:
<content>
<item image="Mike.jpg" name="Mike" state = "New York">
<complex fid = "0"> ju675</complex>
<complex fid = "1"> kyu49</complex>
</item>
[Code] .....
There is a way to access a main SWF var from a nested SW?I have wasted a lot of time already and did get nothing. I am with a project stucked and a blowed timeframe, about to give up the job just because this tiny problem.[code]...
View 11 RepliesHow do you access a nested movieclip? how do you access stuff in mc2_mc or mc2_mc itself from within mc1_mc or maintimeline?
View 2 RepliesI was wondering if it was possible to access nested labels or labels in nested movieclips?
View 0 Replieswhat im trying to do here is to make subcategories to show images like this:
villas ---> villa1--->loadmovie: photo1
villa2--->loadmovie: photo2
interior--->interior1
[code]......
Let's say I have Class Holder linked to a MovieClip holder_mc. holder_mc has a child held_mc that has a Graphic Symbol pic_gr. pic_gr has multiple frames.
From the Class file of Holder, how would I change the frame of pic_gr? I also didn't see a way to name the instance of pic_gr, is that right?
I am quite new to flash, basically i have a slide show running automatically which displays pictures on a timeline and also have buttons associated with each photo to display that picure when it is clicked I have added so text to show which each slide bit i want the text to become a hyper link to a website but for some reason it does not work
I have attached the *.swf unfortunately the forum wont let me attache the *.fla file
1) i tried using static text and the in the property inspector in the url section inserted the url it should target, then
2) i tried setting it to a dynamic text so that i can make use of the instance name within actionscript by doing this
say instance name of the dynamic text is called "myText" i used this code which i know it works[code]...
I've got a nested array containing a series of 2 element arrays containing an object name, and text related to that object.I've set it up like this:public var names:Array = [["instance name 1", "text for first object"],["instance name 2", "text for second object"], ...]];What I'm trying to do is to have the text related to the object appear in a text box when the object is moved.This is all set up within a class containing code for the drag and drop functions.If I set the text box to show a specific element, such as:MovieClip(parent).text_box.text= names[2][1];it works fine. But I can't get it to create the value for the first bracket from the this.name attribute.I had it working for 2 arrays - one with the name and another with the text where the code was;MovieClip(parent).text_box.text= texts[names.indexOf(this.name)]; (arrays named 'names' and 'texts', text box named 'text_box')I'm hoping there's something similar that I can do for the nested array, but everything I try gives me the #1010 error - term undefined.Is there an easy way to sort this out - or am I better sticking with the 2 array version?
View 6 RepliesI'm trying to access a nested json array
var jsonResponse:Object = JSON.decode(response);
var foo:Object = JSON.decode(jsonResponse.nested);
var bar:Array = foo as Array;
When i inspect foo - its an object with about 50 children objects.I can read the properties of the children objects. However, when i cast foo as an Array it comes back null.I'd prefer to not iterate over each object and push it into an array.
Im fairly new in Actionscript. That being said, I'm trying to access a nested Movieclip in a MovieClip. My code looks like this
[Code]....
This is just a snippet of the hitTest. the "charBox" is the Movieclip I'm trying to access in the char Movieclip. So where did I go wrong?
I'm trying to access a text field lying on the movie clip filmBar. I tried all kinds of things but nothing really happens, apart form the cursor turning into a text marker.This is how it looks at the moment:
ActionScript Code:
for (var j:int = 0; j<4; j++)
{
var film_btn:FilmButton = new FilmButton;
[code]....
Ok im rather new to flash so ill do best i can to describe this. I have a HealthBar movie clip with 3 layers, bottom layer is just a red rectangle, middle layer is a green rectangle that is a movie clip, and the top layer is just a border. the green rectangle movie clip has an instance name of bar. i put my HealthBar on my stage with an instance name of healthBar and i change it when the players health goes down by calling _root.healthBar.bar._xscale = health where health is 0-100.
this works all fine and dandy. now i have a movie clip of MiniBoss with an instance name of miniBoss# where # is a number of the layer depth when it is created. in the MiniBoss movie clip i have an instance of the HealthBar with an instance name of bossHealthBar. i tried to call from within the MiniBoss class bossHealthBar.bar._xscale = health but i get an error that there is no property of bossHealthBar.bar._xscale. how do i access the bar in the HealthBar in the MiniBoss clip from the MiniBoss class in its onEnterFrame() method?
Im trying to simply access a movieclip (movieclipB) which is nested inside another movieclip (moveclipHome). This parent movieclip (movieclipHome) has two key frames inside, one that contains movieclipA on the first frame and movieclipB on the second frame. I can easily access movieclipA on the first frame of the movieclipHome by using the following syntax[code]...
View 2 Replies