ActionScript 2.0 :: Nested Loops With XML Data?
Oct 19, 2005
I'm trying to build a musicians site. I'm populating menus, the musicians page, and some other stuff with XML. getting all the attributes (of the artists CD) for each artist. Here's one artist entry in my XML file:
Code:
<ARTISTS>
<ARTIST>
<NAME>AP.9 FED-X</NAME>
[Code]....
Yeah, I don't know how to handle several CDs for each artist. I can see I need a nested loop, but do I store those CD attributes in an array, or create a variable like some_mc["CDLIST"+j] ???
Then I gotta think about building the discography movieclip. I'll worry about that later. What I got working so far is at [URL]
View 5 Replies
Similar Posts:
Aug 17, 2002
Why nested loops must be used. I have this code that I took from the Training from the source book:
v = 0;
i = -1;
while(++i < 2){
j = -1;
while(++j < 2){
[Code] .....
What I don't understand is why I have to have this to create two columns couldn't I just change the while (++i < 2){ to
while(++i < 4){ instead.
View 3 Replies
Jan 12, 2010
I have the following function but despite using the break statement, it doesn't seem to be stopping after it finds a match in the array:
[Code]....
View 3 Replies
Jun 6, 2011
The code is supposed to receive one system id and then scan around that system in all directions, with each direction having its own length. It is like scanning a rectangle around that system where 9*9 = 81 systems.The code works very well; but the problem. I get 8 duplicate results and there is a complete row missing from the results. The one just above the middle row. I think the problem is in the topsystem integer but I don't know what is wrong with it.[code]if you watch the part of the code that has if statements. this part handle the edges.specially zero and 10k. about what i want to do. think about it like a 9*9 dots field in rectangular shape. has 9 rows and 9 columns. each dot has an id from 1 to 10k. the input is the id of the dot in the center of the field (column 5, row 5). as now i know this centeral dot id. i want to loop through the whole field to find the other dots ids using topsystem(the distance between the centeral dot to the upper edge).downsystem (the distance between central dot to the lower edge). leftsystem (the distance between central dot and left edge).rightsystem (the distance between central dot and right edge).the code is working fine but there is 8 missing ids that replaced by 8 duplicated ids.
View 1 Replies
Mar 18, 2010
I have a program where I have around 100 LatLng (latitude longitude) points, and i have to get the largest distance between any 5 of them but you can only go forward (so if latlng_1 is the point number 5 latlng_2 can only be point number 6,7,8,....,100).
<-- skip the colored thing if its unclear
So I calculate the distance like this:
Code:
Select allfor(i=0;i<points_num;i++) {
for(j=i;j<........
// three more for loops
// and than calculate the distance between all five points and compare if it is larger than previous...
The problem is that the program stops responding for about 2 minutes to calculate this and I would like to know if there is anything I can do to calculate this thing faster? Yes I can reduce the point but than the thing I want to get is less accurate and even if I reduce the points I still want the calculation to be as fast as it can be.
View 2 Replies
Jan 23, 2008
why code snippet #1 works, but code snippet #2 doesn't? i thought the array operator would work in this case...
CODE SNIPPET #1:
Code:
for (i=0;i<products.length;i++)
{
// XML data code
for (j=0;j<prodItems.length;j++)
[code]....
View 3 Replies
Feb 29, 2004
I'm making something like a dynamic Picture Viewer, wich should display Pictures named by photo1, photo2, etc. dynamically from an url I give the viewer as a parameter. Thats not my problem by now, my problem is that I try to give the viewer few "parameters" through a text-file
NumberOfPictuers=12
I load this file like this
loadNumber = new loadVars();
loadNumer.onLoad = function()
{
[Code].....
View 2 Replies
Feb 29, 2004
I'm making something like a dynamic Picture Viewer, wich should display Pictures named by photo1, photo2, etc. dynamically from an url I give the viewer as a parameter. Thats not my problem by now, my problem is that I try to give the viewer few "parameters" through a text-file
NumberOfPictuers=12
I load this file like this
loadNumber = new loadVars();
loadNumer.onLoad = function()
{
[Code].....
View 2 Replies
Oct 13, 2003
I'm working on a small validation script, to check elements of a data object for duplicates... it goes a little something like this (hit it!):
[Code]....
and continued my loop, it would work, but instead, it would catch the first duplicate, but miss the rest after that. Basically what I'd like to do is simple: If this record[i] is equal to record[i+1], skip record[i+1] and go through it again... I just can't seem to figure it out
View 1 Replies
Nov 30, 2006
just completed a little test for making a treecomponent with custom icons / bransch.However, i can only get my first branch to show customicons.(links - document) I figure I need to make a nested loop to Iterateover nextSibling?. I tried ALOT, but i guess Im doingsomething completely rong.here is code for my tree so far:
my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.load("tree.xml");
[code].....
View 1 Replies
Feb 23, 2009
My main SWF file, "working_login.swf" has a movieclip that loads another SWF file, called "membership.swf". It loads this SWF file inside of a movie clip which, upon a press of a button, tweens the movie clip containing the "membership.swf" onto the screen. Membership.swf allows you to login using "testing" as the user, and "testing" as the password. I have no idea how to dynamically change the username_txt dynamic text on the main swf.
What I want:
I want it to display "Hello, guest!" when there is noone logged in and no cookie set. I want the program, upon someone logging in as "testing" to have the dynamic text box display "Hello, testing!" upon a successful login. Right now, I have absolutely no idea how to go about this. I am using a class to set the dynamic text, but I cannot figure out for the life of me how to set it up to recognize a guest VS someone logged in. These are the following files that I am using: [URL]
View 1 Replies
Feb 22, 2009
My main SWF file, "working_login.swf" has a movieclip that loads another SWF file, called "membership.swf".
[URL]
It loads this SWF file inside of a movie clip which, upon a press of a button, tweens the movie clip containing the "membership.swf" onto the screen.
membership.swf allows you to login using "testing" as the user, and "testing" as the password.
MY PROBLEM:
I have NO idea how to dynamically change the username_txt dynamic text on the main swf.
What I want:
I want it to display "Hello, guest!" when there is noone logged in and no cookie set.
I want the program, upon someone logging in as "testing" to have the dynamic text box display "Hello, testing!" upon a successful login.
Right now, I have absolutely no idea how to go about this. I am using a class to set the dynamic text, but I cannot figure out for the life of me how to set it up to recognize a guest VS someone logged in.
These are the following files that I am using:
[URL]
View 1 Replies
Sep 18, 2009
I'm attempting to create a movie where 100 different facts are faded in and out sequentially. The text will need to be updated monthly so I figured I'd use the dynamic text feature along with an XML file to streamline the updating process. I've worked through Kirupa's Displaying XML Data in Flash tutorial (which was very well presented) and was able to get it to work while understanding the theory of how it worked. However I can't seem to get it to function when applied to my particular application.
After 4 hours of troubleshooting, I think I've isolated the problem to the actionscript component: I think (and I could be wrong) that something needs to reference the nested movieClip that contains the dynamic text layer. It works fine if everything happens on the first frame of the _root timeline. But any elements that I try to bury within a movie clip fail to display. I'm using the code from the tutorial as follows:
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("content.xml");
[code]....
View 2 Replies
May 19, 2011
I have a datagrid and the dataprovider for this grid is the result of a RPC call. The result set has the following structure[code]...
View 2 Replies
Jun 7, 2011
I have a data grid and there's a method attached to clicking on any item in a row of the grid.Now, some of the items in the table row are also buttons. Each of these are associated with a different action.We only want one of these actions to be performed.[code]we have currently a member variable to track which selection was made and to ignore the the contents of the other method (the else portion of the method resets this value).Now, if the methods just happen to execute in a different order (or at the same time), the behavior will be unpredictable.Is the member variable flag the way to do this (it smells so bad)?
View 1 Replies
Jan 11, 2010
I have a Flex tree with an ArrayCollection as data provider. The collection holds an array of CategoryVO objects. Each object can have another array of CategoryVO objects inside it's "child" attribute. This way the tree displays the data correctly. Now I want to get the parent of a specific item, e.g. tree.selectedItem. Using XML as data provider the item parent is avaiable thorugh the parent() method. But I can't convert my data to XML. How can I get an item's parent? Perphaps using the tree's dataDescriptor?
View 2 Replies
Jul 25, 2010
Well this is the problem right here. In my flash movie, I made it so a member from my PunBB Forum can login using their login information from the forum, This is using the LoadVars and it loads the variables into flash and displays the username. In the php script i made it so it will display profile information that user has on the forum, this is where the problem comes in.. I can trace the data perfectly fine in the output panel when you are successfully logged into flash.
I can also display the data in Dynamic text boxes IF they are on the main stage.. I need to be able to load the data of the user inside of a movie clip.. that is loaded when you click "User Profile" on the menu, Once the movie is loaded, no data is displayed. Yes i have all the instance names and paths correct, but no matter what i do I cannot load the data into this movie clip. So me thinking it just wouldnt work, I tried making a profile page on a different keyframe in the timeline, That also did not load the data onto another frame.
View 5 Replies
Jun 24, 2005
As the title says, i would like to have an object which is nested beneath another objects depth set higher than that of one the is NOT nested. Is this possible if so how, may be real easy and im just over-looking it but
View 1 Replies
Mar 29, 2009
Shouldn't flash detect these before running the script and crashing and having to force quit and restart (and flash startup takes a while)? Like just give an error: infinite for loop or something? And this happened to me a bunch when working with for loops within for loops, when I accidentally used the same variable for both loops, so of course it never ended and crashed flash.
View 2 Replies
Nov 29, 2010
The scenario is to create a lotto game that matches 6 user inputted numbers with 7 randomly generated numbers. The 7th number is a special case (eg bonus ball) WOULD LIKE TO SHOW A KIND HEARTED FALSH GENIUS ALL OF THE SCRIPT IF POSS! (its not tooo long) This code works, but it just outputs the default message: There seems to be a problem with my arrays not comparing? Part of the code is: (prioir to this the user inputs numbers, they are copied to text areas beginning with O, on a button press) On a second button press randomly generated number appear to a timer. //compareResult checks how many numbers match between the two sets of numbers to determine winnings.
[Code]....
View 4 Replies
Jul 25, 2011
I'm new here and I'm wondering if I can use the Sound Loops for commercial uses?
View 3 Replies
Feb 7, 2011
I have section of code which works for bouncing some fish movie clips off of the 'ceiling':[code].....
However, I would like to find a more succinct way to program this using a 'for loop'. I tried the following, which did not work and gave me an error (posted at the bottom). [code].....
TypeError: Error #1010: A term is undefined and has no properties.at Function/<anonymous>()
View 3 Replies
Apr 1, 2011
I'm pulling data from an xml doc and created 4 XMLLists to hold the children of the 4 different elements. Inside the onLoad function, I created a series of for loops to go through each list. But Flash stops after going through the first two. I'm very puzzled by this. I got around it by creating a 2nd onLoad function for the last 2 lists, but should I be using a different loop? Curious.. I inserted a break after the first 2 and then the 3rd loaded up...
View 1 Replies
Jun 8, 2011
I've got the following code and i would like to add an delay of 200 ms after each trace statement
for (var x_pos:uint = 0; x_pos <= 12; x_pos++){
for (var y_pos:uint = 0; y_pos <=12; y_pos++){
trace("hello world " +"("x_pos+","+y_pos+")");
[Code].....
View 4 Replies
Jul 25, 2004
i am new to flash and i was wondering if there is a way to slow down for loops.Like i can set how many seconds till it goes and loops again. I have tried setInterval but didnt work.here is my code:[code]
View 10 Replies
Aug 11, 2004
My situation is that in the game I'm making, I have a movable turret firing duplicated bullets. I need to hittest them against a duplicated set of oncoming robots. I've tried using a for loop, but I just can't get it to work.I've attached the .FLA, and I would be grateful if anyone could point out what I'm doing wrong (ignore the values for removing the clips and the random duplication; I had to shrink the stage size to make the file size smaller!)
View 3 Replies
Nov 24, 2004
why this code dosent work at the same time in the timeline, and why only envent put inside the attacHMovies or duplicated Movies work, if i put them in the forr loops they don work.
Code:
img01 = new Array();
img01 = ["001.jpg", "002.jpg", "003.jpg", "004.jpg", "005.jpg", "006.jpg", "007.jpg",
[code].....
View 10 Replies
Jun 28, 2005
are there loops in flash like Do while loops, or for next loops?
View 1 Replies
Sep 14, 2005
I would've thought of a better title but I honestly have no idea what's going on. I have this code on the main timeline:
Code:
dots = new Array();
for (i = 0; i < 10; i++) {
[Code]...
View 1 Replies
Apr 9, 2006
I want to attach a MC dynamically so that I have 12 rows and 12 columns of _mc box on the main stage:[code]I think it can be done only with a nested loop but so far, well, my head's in a loop!
View 11 Replies