Get Xml Tag Name When Iterating Through A XMLList In Script?
Apr 6, 2011What I want to do is loop through an xml file, and assign the contents of each node to a static variable with the same name. [code]...
View 1 RepliesWhat I want to do is loop through an xml file, and assign the contents of each node to a static variable with the same name. [code]...
View 1 RepliesI have an XMLList 'Keywords', which consists of about 30 elements. I want to count the number of unique keywords in the List, and how often they occur. Then display the top 3 most occuring keywords.
View 1 Repliesi've got a loop which creates a movie clip for each day of the month and lines them up. so, depending on how many days are in the current month, the counter var for the loop is 28, 30, or 31.
Code:
for(var j:Number=1; j <= lastDay; j++){
// Create the Empty Movie Clip
_root.createEmptyMovieClip("dateClip"+j,300+j);
var dateClip:MovieClip = _root["dateClip"+j];
within this very same loop i am also using the same counter var (j) to iterate thru an array that is created from parsing my xml file.
now....i don't have 28, 30, or 31 dates in my xml file -- just about 4 or 5. so if i trace out this array i'll get values for the first 4 or 5 positions but then a series of 'undefineds' for the rest. that's normal, right?
Code:
trace(ArrDate[j].attributes.day);
the problem comes when i try to target the movie clip instances based on the "dateClip" and the "ArrDate". here it comes up totally undefined in all circumstances and i can't figure out why.
Code:
trace(dateClip["thisDate"+(ArrDate[j].attributes.day)]);
i can trace out dateClip and i can trace out the ArrDate (even though it returns only 4 values and the rest undefineds).
I am trying to make a class that would convert an arrayCollection to XML. I want to make it useful for all ArrayCollections.
My arraycollection looks like this....
newsDB.addItem( {
title: titleText.label,
clickURL: clickURL.text,
info: itemInfo.text,
[Code]...
I can access the AC with a for loop and arrayCollection.length, but how to I go deeper into the AC while making it work for any ArrayCollection? I could easily do dataSource[i].title but want to make this work for any arrayCollection passed into the class.
I need to loop through all the child inside a .fla file, and I can reach only the first frame movieclips when I loop through the childs, I found a "solution" that consists in copy all the movieclips to the first frame.Is there a way to loop to every movieclip, even if those are located in, let say, frame 120 in the timeline?
View 2 RepliesI have an application that I need to fade out all of the visible objects on stage and replace with a different set.How can one iterate through (or perhaps do all at once) all visible objects on stage and then fade out.
View 3 RepliesIs there any way to iterate through instances placed manually on the stage in Flash IDE? For example I have 3 "Dog" class instances placed on the stage and I'd like to access them all from document class without giving them instance names.
View 3 RepliesI'm making a very short text adventure, not one that will be all that fun, but just so I can learn a little as3. So I was designing a system that splits the persons input into an array of words, and then goes through and takes out unimportant words like "on." To test this out, I quickly (and messily) coded it up, and the only thing you can do is sit on a box. but it doesn't seem to be working. if you type "sit box" it works, but "sit on box" does not.
[Code]...
I would like to use the AS "for each" syntax to loop over a collection of items. Within the loop I sometimes need to remove an item from the collection I am iterating over.
Using a "for" loop, I would code this like (note the "--" operator to move the index back):
for (var n:int=0; n<ac.length; n++) {
var s:String = ac.getItemAt(n) as String;
if (s == 'c')
ac.removeItemAt(n--);
}
Is it also possible to do something similar using a "for each" construct?
I have a few MCs named fruit1, fruit2, fruit3, all instanced off a MC...I would like to loop to shorten my code and just loop through and stop all of them at once... My Code:
for (var i:Number=1; i<=7;i++){
fruit[i].stop();
}
I get an 1120: Access of undefined property fruit.I want the result of my loop to do:
fruit1.stop();
fruit2.stop();
etc..
I have a small problem with iterating over array. I would like to iterate through items gathered in my array in a way of "one at a time" in each muse click event but whenever I'm using a simple loop it just takes all my elements to process. Is there a way to make a single iteration in each click and still increment the index value in loop?
View 5 RepliesI am trying to load multiple images by iterating through a for loop. For each image I instantiate a loader and send a loader request. I want to stop the iteration of the loop and cancel all loader requests sent, in case a user navigates out of the screen. How can I do this?
View 2 RepliesI want to iterate over an ArrayCollection in Flex while there can be items added and removed.
Since i didn't find a way to use a "classic" Iterator like in Java, which would do the job. I tried the Cursor. But it doesn't really work the way i want it to be ;) So how do I do it nicely ?
var cursor:IViewCursor = workingStack.createCursor();
while (!cursor.afterLast)
{
[Code]....
I am creating an option in my application to create a PDF report based on the results from the application.The results are represented as an ArrayCollection of XMLList objects, which I am using to populate a BarChart.To create a screenshot of each result (as a PNG), I am loading the Results Window (a Title Window) and hiding it (visible = false). I am using AlivePDF to add the capture to a PDF report.
I have been using a Timer to iterate through the results, load each result to the chart, create a delay, and then capture the image and add it to the report.
UPDATE.Currently, I am able to iterate through the results (using the Timer), but the chart does not refresh properly before capturing the screenshot and saving as PNG.Essentially,I am trying to see if there is any other possible solutions for iterating through the results and creating a delay so that I may be able to load a result to the chart, capture the screenshot, and add it to a PDF.Is there any other way to do this in Flex?Initially, I was thinking of iterating through the results array using a for loop,but this was not working due to the fact that the results were not loading in time before capturing the screenshot of the chart.
i have this method:
private function findConnectedNodes(node:Node):Array{
var test_node:Node;
var surrounding_nodes:Array = [];
[code]......
I have a large-ish array of points.
The graphics object I am using has it's alpha value set to 0.1.
When these points are plotted iteratively, and the line being drawn overlaps another line drawn earlier, there is no visible change in the colour at the intersection.
If I draw the line differently, not using an array of points, the alpha is not ignored.
ActionScript Code:
public function render(e:Event):void
{
if (segmentsCollection.length > 0)
[Code].....
This all occurs on each ENTER_FRAME event until the array is emptied.
I have tried loads of options but the alpha is always ignored.
Trying to get XML into an XMLList, having seemingly nonsensical problems.
Code:
package
{
import flash.display.*;
import flash.net.*;
[Code].....
[Code]...
xmlList is alive and well in the xmlLoaded function. I need to access it in the loadMusic.fla.
difference between XML and XMLList in my example code? I am passing a node to the function and extracting the url of the file:
private function getFile(node:XMLList):String {
var file:String;
for(var i:uint=0; i<node.children().length(); i++) {
trace("Test 1: "+node.children()[i].@id);
[Code]....
Why do I have to have 'current' as XML and not as XMLList? I thought XMLList's with length == 1 are handled as XML's anyway, aren't they?
I am trying to parse some XML i have retrieved via e4x in an HTTPService. The loop works and for each episode in the list it goes through the loop. However i get the following error when it is trying to append to an XMLList.TypeError: Error #1009: Cannot access a property or method of a null object reference.I am trying to query the local SQLite database and see if the episode exists (working) and if it does append to one xmllist and if not then append to the other xmllist.
public static function seasonFavHandler(evt:ResultEvent):void {
Application.application.ManagePage.selectedShow =
Application.application.ManagePage.gridFavourites.selectedItem as XML;
[code]......
How can you tell if an XMLlist object in AS3 contains a specific node?
View 2 RepliesMy Flash designer is reading an XML stream I'm sending back to the browser (I'm a C# dev). We have this working fine.
He is then selecting into an XMLList where a element has its id a certain value i.e. . This is also working just fine.
In this XmlList, are Events, that look a little something like this:
event
startdate
enddate
end event
I don't know how to use the formatting here - but each of those items is an element. startdate would have a value such as 04/02/2010 and enddate 6/30/2010.
Now, from this XmlList I do have of Events, I need to select all Events where a new variable myDate, falls in between the startdate and enddate.
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 have the following XMLList and am trying to return the XMLList with the node having the label Mail Box or Outbox, depending on string variable called folder. folder can either be equal to "Mail Box" or "Outbox".
`<fx:XMLList id="treeData">
<node label="Mail Box">
<node label="Inbox">
[code].....
I'm trying to loop through an XMLList and rather than giving me each item in the list as XML, it's just coming back with the positions as strings e.g.
[Code]...
It just alerts "0" or "1". If I inspect the 'item' variable, I see the same thing. But if I inspect 'myList' it looks like the XML. I've also tried myList.children() and strongly typing 'items' to 'XML' but nothing I do has worked.
I have this xml file.[code]But I want these node names, example: element,attribute,element in arrayList.[code]
View 1 RepliesThe aim is to get the flat xmllist out of a xml: each item of the xmllist would be a descendant (not just child) of the xml. This way I have all the nodes of an xml inside the xmllist.
For example:
XML=
<a >
<b >
<b1/>
[code]....
I am trying to get my loop to look through the XMLList and print out each entry before moving on the next but it prints out all three then loops through the whole things three times??
[Code].....
I am trying to make a simple news feed. Same code as the Basic AS3 XML sample by Lee. Can't get the XMLList to return anything.If I trace the var "xml" I get my xmlfile. But as soon as I try to trace the newsBoxContent XMLList object, I get "undefined" in the output window. Here's the AS3 code:[code]
View 5 RepliesI'm pulling some events out of a MySQL db, parsing to an XML file, and having flash pull that in. All works fine, but I'm encountering an XML tag, and I'm not 100% sure why. I searched but the keywords are so vague I didn't find anything of value.
[Code]....
So with one event, it works fine. With more than one, I get in the info.eventNameTxt textfield something like <name>Christmas Afterbash</name>. how to circumvent this? I haven't quite been able to wrap my head 100% around the E4X stuff.