ActionScript 3.0 :: XML And Arrays - Extracting The Data From An XML
Jun 2, 2009
I'm having trouble extracting the data from an XML file that I've loaded into arrays in flash. Ultimately the XML file will sit on a server and will be updated separately from the flash file. What I am trying to do is get text boxes to pull in the data from an array when a button is rolled over.
View 1 Replies
Similar Posts:
Aug 1, 2004
I have a variable which takes a particular form of array (used with the component DataSet). It looks like this:
Code:
var recData = [{svenska:"Hej", spanska:"Hola"}, {svenska:"nej", spanska:"no"}, {svenska:"ocks�", spanska:"tambi�n"}];
I want to extract this variable from a textfile instead of writing it directly into the code-area of the flash-file, so I used the following code:
Code:
// 1) Loads the textfile, recieves the array, and puts it into a variable called txt_Data
var txt_DataSet = new LoadVars();
[Code]....
Unfortunately it seems the array gets converted to an ordinary string in the process, so I cant use it properly. Is there a way I could extract the array from this string again, and if so, how?
View 4 Replies
Dec 25, 2008
The XML file format is:
<xml>
<condesa>
<lote>
<loteid>H50601</loteid>[code]....
I have an xml file that I am reading from. I am them taking the data and putting it into an XML object named condechiXML.
var condechiXML:XML = new XML();
var XML_URL:String = "condechi.xml";
var condechiXMLURL:URLRequest = new URLRequest(XML_URL);[code]...
What I want to do is run a for loop for every branch in my xml tree where I access a property in each branch. I have the for loop working using the length attribute for xml but when i want to use:
for (var i:uint=1; i<=condechiTotal; i++) {
trace(condechiXML.condesa["lote["+i+"]"].loteid);
}
my trace returns blank lines.
View 6 Replies
Jul 11, 2010
I am using the loadVars class (Flash 8) to load key/value pairs from a mySQL database through php (example &pic1=pic1.jpg&pic2=pic2.jpg&...).
The ultimate goal is to create a dynamic slideshow with a variable length, depending on how many pics were submitted by the user. Since the associative array object returned by loadVars does not share the "length" property of indexed arrays, my guess is that the values need to be converted into a new indexed array before being able to use them in the slideshow.
View 2 Replies
Jun 2, 2009
I'm having trouble extracting the data from an XML file that I've loaded into arrays in flash.
Ultimately the XML file will sit on a server and will be updated separately from the flash file.
What I am trying to do is get text boxes to pull in the data from an array when a button is rolled over.
View 3 Replies
Aug 1, 2009
Is there any way that I could take a sting from a text file when it meets sertain charector in it?
i want to have a text file that contains a title and details, and the title will be in brackets. then i will take the amount of characters in brackets and subtract it from the whole text file to display the details. is this possibe?
View 9 Replies
Feb 16, 2009
I have created a list of Classes in a school in Excel and saved it as an XML file. In each row it contains the name of the class followed by a list of class members. In col 1 is the word "Class", in the next col is "7C1" ( or equivalent) then each cell after that contains the names of the class members. I can load the XML file no problem, and display the full contents using 'trace', but I don't seem to be able to extract just the class names and student names to use in a Flash application. The code I'm using so far is attached.
View 3 Replies
Mar 31, 2011
Im currently trying to make an abstract method for reading xml data as parsing different formats is a pain in the butt. Especially with components I want to be reusable.
currently I'm having an issue with dynamically grabbing data from the xml and just don't know if this is possible.
[Code].....
View 3 Replies
Aug 26, 2009
I've got a bit that loads a big chunk of xml data about products.I push product info into an array(e.g. productArray), then add that array to another array (e.g. allProductsArray)How do I sort those arrays? For instance, if I want to sort the allProductsArray based on the info in productArray[0]?Alternatively, would something other tha an array of arrays be a better route?This loader loads the same sort of info for many different clients, so the bit to sort on will change.
View 5 Replies
Feb 4, 2012
I have been trying to extract information from this file on YouTube using AS3. I have managed to access ytID (YouTube video ID) along with the ytName (YouTube video name) from a specific channel (called through the loader). I am stumped on how to get the thumbnail URL. I have managed to find out that through YouTube, its tag is media:thumbnail, however, Flash gives me an error for trying to use a semicolon.
ActionScript Code:
View 3 Replies
Dec 12, 2006
I have the following XML structure:
[Code]...
This will parse child elements of the <text-block> but will not work with <ul> as it has its own child elements <li>. I guess this could be accomplished with yet another loop but I wanted to check to see if there was another simpler way.
View 2 Replies
Oct 24, 2006
Flash 8, I have some XML creating a few simple arrays. These pull some movie clips onto the stage with incremented names: product1, product2 and so on. Inside these clips I have some code that is supposed to pull data from the arrays and put that data into text fields.
[Code]...
Shouldn't this last output be the number 1? I want to use this number to call the correct node for each clip,
View 2 Replies
Nov 25, 2009
So how do i go about using something like indexOf() on a multilevel array? for example, lets say i have the following array:[code]how do i find the index of lets say "tree 1 data 2"?
View 4 Replies
Jan 20, 2010
I need to get a grip on arrays and XML data but I'm having trouble understanding how to turn xml data into useful data. I was hoping these forums might provide some insight.
I load my XML with this code:
Code:
//set values for XML data file
private var XML_URL:String = "http://www.mysite.com/media/locXML.xml";
private var locXML:XML = new XML();
private function getXMLdata():void
[Code].....
how can I do that without taking up 2000 lines of code? I was hard coding a number in each one of those '[]' brackets, but that is becoming very painstaking...?
View 1 Replies
Oct 21, 2011
After reading data from XML source I like to be able to show one random item from data whenever, say, clicked a button. I think I can accomplish this by storing the data into an array and use it from the array. I would like to learn if possible to do it directly from xml without storing it into another array.
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("XML_NOTES.xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
[Code].....
View 2 Replies
Nov 21, 2006
I keep getting 'undefined' if I ask for the value of a variable from an array into which XML data has been loaded.[code]...
View 1 Replies
Jan 6, 2007
I'm working with a gallery grabbing images from data extracted from an external XML file, and I'm trying to make it work in a hierarchical or folder like structure in Flash 8.For instance, thumbnails are displayed on load, and when a thumbnail is clicked, more thumbnails specific to the image clicked are displayed.As sort of a beginner to Flash and ActionScript, I've been working with this project for a couple months.There is one obstacle I'm facing within the 'for' loops I'm using.First, an example of my XML file is like this:[code]This way displays the catalog look just as I'd like, but it is only good for the first piece of art since this 'for' loop only loops through the <products> node within the first <art> node. Now, if I change 'this.childNodes[0]'to 'this.childNodes[1]',I can display the <products> for the next <art> node.The part that I have not been able to figure out is how to increment that 'this.childNodes[x]' so that I can use it in an onRelease function.
View 4 Replies
Jan 1, 2012
I loop through two arrays and im checking their data, i have collison working for them but I want to add more A.I. by making them stop when they are a certain distance from each other. so i need a way to pull EACH object that is in the arrays x,y, pos and use that data. my distance var keep bouncing all over the place...
THIS is my code:
//check events between 2 objects
function CheckEventsEnemyFighterFighter():void
{
[Code]....
P.S. i need some tips for my coding... like should have i used a break in these for loops?
View 2 Replies
Apr 7, 2012
I'm making a turn based RPG in Flash, with AS 3 as the language,Basically, my idea was to put all of my weapon data on a single multi-dimensional array. Now if I want to add a weapon into my inventory, easy, i just use inventoryArray.push(weaponArray[1]) Easy, I just added the weapon into my inventory.I've been looking into Design patterns, and it seems that most OOP designs are using classes and inheriting from a superclass. Component-->Weapon-->Sword-->LongSword. What should I go with, putting all data in one array or using the inherit style, with one class containing a single weapon?
View 2 Replies
Nov 2, 2009
I retrieve XML data in Flex via HttpService. I have the resultFormat property on the HttpService instance set to HTTPService.RESULT_FORMAT_OBJECT. The result contains data similar to this:
<!-- ... -->
<children>
<item><!-- ... --></item>
[Code]....
I get an array named item beneath the element children when there is more than one item sibling. If there's only one, the conversion can't distinguish it from a scalar.
What do I need to change to have Flex convert all item elements to an array with 0 or more elements?
What would I have to do to get an array member children, dropping the item wrappers altogether?
The XML is generated by Struts on the server side. I always have the option to change the structure of the document there, but right now I'm interested in what I can do with Flex.
View 2 Replies
Sep 13, 2010
so I have a JSON link that contains a couple of nodes (not sure what you call them in JSON) that I need to put into arrays in ActionScript, but I'm still having trouble trying to trace out all the specific node content.I found a similar question here, but the fix just showed how to trace out the entire JSON file (which shows up in my output window as [object Object],[object Object],[object Object],...)first node: {"captions":[{"content":"[hello world] ","startTime":0,"duration":4000}
My code:
private function onCaptionsComplete( event:Event ):void
{
//var jsonObj:Object = JSON.decode(event.target.data);[code].....
captions: undefined
TypeError: Error #1010: A term is undefined and has no properties.What I would like to be able to do is put the content data into the captionsContent Array, and the startingTime into a startingTime Array, same with the duration data.
View 1 Replies
Nov 4, 2011
Trying to make a grid based question answer game and load variables from a text file using for loops into an array. I wanted to reduce redundant code and use for loops to populate my arrays. The issue I am having is with my arrays being lost/destroyed outside of the loader function.
I understand that if an array is declared inside the function, naturally the array would be destroyed upon exit of the function. However I am declaring the arrays outside of the function so the arrays should remain intact after I exit the function.
BTW - I'm not having an issue with the loading of the data. The data is loading correctly. The array is simply being destroyed after the data has loaded.
//Create the arrays to hold the
//categories, questions, and answers
var categoryArray:Array = new Array();
var quesAnswArray:Array = new Array();
[Code].....
View 1 Replies
Oct 9, 2009
I have loaded an XML file in the class LoadXML and have here created a method which parses the data and returns various arrays: an array of background urls (i called the array: hintergrund[]), an array of image paths (pfad[]), an array of website urls (website[]) and so forth. In the main class I would now like to load the backgrounds and images. I must have made a mistake in my onBackgrLoad() because I keep receiving the error msg:Error #1084: Syntax error: expecting rightparen before colon.Here are the relevant sections in my Main class:
package { import flash.display.Sprite; import flash.net.*; import flash.display.*; import flash.events.*; import flash.display.Loader; import flash.filters.DropShadowFilter; import flash.net.URLRequest; import flash.text.*;// import de.container.text.Container_Text; // To
[code]....
View 18 Replies
Sep 7, 2011
I'm able to record sound with a Flash application embedded in my website, this audio is saved to a ByteArray, which I need to pass to Javascript in order to post to my server along with other required data.
I know I can use AS3 ExternalInterface class to communicate with Flash from Javascript, but what would be the appropriate format or variable type in javascript to hold the ByteArray, and how can I ensure that I won't lose much audio data when doing so?
View 1 Replies
Jul 6, 2004
i m doing a program which contain few text. When i click a button,'step 1' text will be view. When i second, 'step 2 ' text will be load out and 'step 1' text is still in the stage.. the method i m using is array.i put my text in an arrays.
View 9 Replies
May 18, 2005
I have been working on a Flash movie that loads variable data from an external XML file and dynamically displays the item names in a menu which may then be clicked to display other dynamically-loaded content that corresponds to the menu item that was clicked. I have now come to a standstill in the project as there is something I'd like to achieve but simply cannot work out how. This is my first attempt at working with XML in Flash and one of my early attempts at using variables. What I'm trying to achieve is; once the user has viewed the item's content, they can simply click "next" and "previous" buttons to display all of the content for the next or previous items in the XML document.
I know it probably sounds simple and I'm sure some of you could achieve this in 5 minutes (!) but I can't get my head around some of the coding. I assume previousSibling and nextSibling would come into play here as well as some sort of functions which access arrays of data for the previous and next items, but I'm just not sure how to correctly put these things to use. Rather than post my code and example images of the stage up here on the forums, I've created an html page here: [URL]
View 2 Replies
Jan 21, 2011
I am running into some trouble adding an array into another array to create a multi-dimensional array.The code appears as below:
var slideDataArray:Array = new Array();
var slideShowDataArray:Array = new Array();
slideDataArray[0] = xmlData.SlideShowParameters.SlideShowImagesDirectory;[code]........
I am looking for a means of placing the slideDataArray into a 'slot' or value of slideShowDataArray so that I can in the end pass the slideShowDataArray as a parameter to another function.As of now, the last slideDataArray appears 11 times (the loop runs 11 times) in slideShowDataArray and the way the code is written the slideDataArray is unique every iteration of the loop.
View 1 Replies
Jan 6, 2007
Is there a way to extract a swf from an exe? I overwrote my original FLA , and the only trace I have of my old work is in an EXE file. I want to convert it to swf then import is to flash. Is there anyway at all to get an swf from an exe? I know that vice versa is possible.
View 3 Replies
Apr 21, 2010
i was wondering, how can i extract thumbnail from a flash-video file, then display it in a listbox.the listbox is suppose to have many videos which i need to extract thumbnails from programatically with actionscript.the flash-player is going to be on the web, and the extraction must happen when the swf file is loading, therefore, the method must not be too time-taking.
View 4 Replies
Aug 30, 2011
have a SWF that I want to extract VideoFrames from.They appear under this name when the SWF is opened with 7-Zip (VideoFrame).Obviously, extracting them in that manner accomplishes nothing, as they are not in any recognizable image format.I have loaded the SWF into Flash Professional CS5, and am able to view all the Bitmap objects (assembled in a "UI", overlaying the video animation at one corner) in the Library, but I cannot find an enumeration of the video frames anywhere, or even find the object displaying them.
EDIT: I do NOT want to simply export the entire frames of the SWF, as there are several UI elements overlaying the video. I know for a fact that the entire video frames are present (just partly covered up). I want to extract the frames of the embedded video, not the SWF frames.
View 2 Replies