Actionscript 2.0 :: Loop To Load Xml Items Into Flash?
Sep 3, 2009im trying to do a for loop to load xml items into flash but im stuck,
[Code]....
im trying to do a for loop to load xml items into flash but im stuck,
[Code]....
I am trying to do this in as3
for (var i = 0; i < 8; i++) {
var clip = "markerMC" + i;
this.scoreGridMC[clip]._visible = false;
}
But I get compile errors all the time.
I'm creating a facebook application in flex. I'm actually working on the friends component that shows your friends who are using the application. now, each friend has a profile image.
I created the component using a s:List element.
In the Skin Class of the element i configured the requestedColumnCount to 3, which means it shows 3 friends. i added buttons to scroll left and right in the list.
Whenever I scroll to see a different friend, for a half of a second i see no image because the List component is loading the image in order to view it.
is there a way to make the list preload all the elements so i won't have this kind of problem ?
just trace out the data within the "item tag" below. I can trace out the three at the top but can't get into the items. Having it nested like this is giving me problems. I would really like it to loop through the items and display each in a single text field.
[Code]...
I was wondering if you could loop through your library or a specific folder in your library and get alle linkage names of items that have 'Export for Actionscript' checked. I have an amount of items in my library of which I want to random pick one. Of course I could just use an array of linkage names that correspond to my library items, but I was wondering if there is a more efficient way.
View 2 RepliesWhat I've got is a menu that loads images as buttons. It will only display menu items that are within a certain group (i.e. if themenuitem.node Value == groupid[q] then it will display that menu item. Each of the menu items has a unique number (Itemnumber[n]). I have a loop that goes through and displays the menu items that are within a certain group. I am currently able to also find out the unique number of each of the menu items where themenuitem.nodeValue == groupid[q], but what I want to do with these numbers, is place them all into an array as it loops through.So, say for example, it finds an item in the loop. It tells me this item is number 4 (if I tell it to trace(Itemnumber[n]) within the loop). Then, it finds another item in the loop, and it tells me this item number is 6. I want to be able to add items to an array as it loops through, so I'll have an array at the end like this: (4, 6).Currently my ActionScript looks like the following. Never mind if there are variables that are not defined in there -- they have been defined in other parts of my movie.[code]As you can see, I've made an attept at achieving this by trying numarray[numarraylength] = n; -- but all this does is send me an array, then overwrite it next time it loops (so I get an array like (4, 4), then one like (6, 6). I've added comments in the code to further explain what I'm trying to do.
View 2 RepliesThe following for loop removes children from their parent if they're in the display list. It works correctly, but I also want to remove each child from memory with the same loop.
View 1 Repliesthere are 11 buttons in my stage which is called button0,button1,....button10, i want add addlistener for all buttons through a single loop. here i have attached my code,But its not working.What is the mistake.
ActionScript Code:
var count:Number = 11;
var temp:MovieClip = new MovieClip();
[Code].....
If you have a series of sprites created in a loop:
ActionScript Code:
for (var i:int = 0; i < numItems.length(); i++) {
var mySprite:Sprite = new Sprite();
}
Which you added event listeners to, in the same loop:
ActionScript Code:
for (var i:int = 0; i < numItems.length(); i++) {
var mySprite:Sprite = new Sprite();
mySprite.addEventListener(....
}
How can you remove those listeners, then add them again? I need to kill and re-enable the listeners of many sprites which were created that way.
Well, i have this line of code
Code:
var t1:thumbBack = addChild(new thumbBack(x, y));
And i want to create many thumbBacks with names t1, t2, t3... with a for loop.
I tried something like this, but it doesnt seem to work
Code:
for(i=0; i<8; i++){
var this["t"+i]:thumbBack = addChild(new thumbBack(10 + i*200 , y));
}
Basically I have five mcs on the stage, MC1, MC2, MC3, MC4, MC5, and I would like to change the alpha, for example, each time I click on nextBtn. I would control the number of mcs but altering the if (j <= 4){ line.
[Code]...
I could pop, shift, splice or slice it out of there (hey, that had a nice ring to it...)
how to properly remove items from an array while in the middle of a for loop:
Code:
//This will cause errors, because if the condition is met, it will skip the next array in line
for (var i:int = 0; i < arr.length; i++)
[Code].....
If someone is reading through my code, will they understand what I am doing without me having to clarify with comments each time?
So, I have an application where flash receives this string:'mp3, pdf, doc'using .split(), i managed to separate the values in an array.I need to add a "*." on each item of the array. i used for, but the result is always the last one. How do i manage to add the "*." string on all items of an array and display them on a dynamic textfield?[code]
View 12 RepliesI have 10 dynamic text fields inside a movieclip, which are populated via an XML file. However, the xml file sometimes has less than 10 items. It never has more than 10. This results in the following error, which is normal. I need the code to count the amount of items in the XML file and then create a for-each loop. I can visualize it, but I don't know how to write it. Basically what I need the code below transformed in to is this... (notice the #'s)
[Code]....
So i have my items that I bring onto stage with my loop function with dynamic text fields within the loop. If I want to clear these items using a reset button on the stage how can I do this. From my code below when I press the reset button I receive: TypeError: Error #1010: A term is undefined and has no properties.So a little snippet of my code just to give an idea what I use to bring items to stage and what Im trying to use to reset[code]....
View 4 RepliesI'm making a highscore table in flash using AS3, I have successfully got working code that displays the names and the scores but also part of my high score table it needs to display the users country flag. The images for the flags are stored on a remote server.
Now I know how to load in a single image and add it to my movie clip but things get very complicated when I want to load in 20+ by iterating through a loop. I've looked at many examples and just cant adopt the sample code to work for me. Anyway without a further a do here is what I have so far.
[Code]....
I have a MovieClip called item with the same linkage set and my first task is to display 10 of these items on the stage nested inside a movieclip called MainItem. I have dragged MainItem to the stage and have the following for loop:
[Code]....
My file name is slider_1_1.swf. But once complete file then user next button click load in slider_1_2.swf this use in loop function.
View 1 RepliesI can not alter the content of the XML file, as a third-party program creates it. I need to select only certain XML items. I specifically need to exclude the SAMPLEINFO and TIMEINFO items. The problem is the existance of these items creates empty cells in the datagrid (see picture below). I need the rows with the red x's removed.
XML:
Code:
<?xml version="1.0" ?>
<SampleData>
<SampleInfo Class="Sprint Cars" TopQual="Someone" RaceName="Sprinters of America" RaceNum="24" RoundNum="2" />
[Code].....
I am stumped. I have tried to load a comboBox with a for-loop to load k school names and can not get it to load dynamically. Here is what works:schools_cb.addItem({label:varLoad.data.school1});It manages to paste the name of school1 into the comboBox k times.Then, when I try:schools_cb.addItem({label:this["varLoad.data.school" + k]});orschools_cb.addItem({label:this.getChildByName("var Load.data.school" + k)});it brings up k blank entries in the comboBox.I am a poor teacher trying to make a signup page for our school's math contest
View 5 RepliesI have created a bit of flash that buffers and loads an flv which plays up to a certain cue point and then seeks back 2 seconds ina loop, Got that OK.Now what I want to do is make certain movieclips visible and fade in when the video has initially buffered but heres the problem, when the video loops back it re-does these actions of fading in the movieclips as if it has just buffered again, but I want it to only fade the clips in when it has initially buffered not when it re-loops.[code]
View 9 Replieshow to Load SPECIFIC XML items to datagrid?
View 1 RepliesI used to put a load of instance names linking to library objs into an array in AS2, then use a loop to add them to the stage..[code]...
View 3 RepliesI have a couple of movieclips in my library (there's 52 of them actually, I'm making a card game. ) and I have them exported for actionscript through the property menu.Is it possible to load them by passing a variable with the name of the movieclip class?[code]
View 2 RepliesI've included the .fla and source files I'm working on. Here is what I need some help to figure out:
1. How can I show the items in rows of 4 and 4.. Instead of just repeat them vertical?
2. How can I load the thumbnails in the menu items?
3. How can I load the image for the chosen item in the image placeholder?
The three text fields below (txt1, txt2, txt3) are in three different frames (1, 2, 3)... With my current code, text data from my xml file seems to be uploaded only in the textfield in the first frame. How do I load the other items from my xml file into the other textfields?
Code:
var myXML:XML = new XML;
var myXML:XML = new XML;
myXML.load("file.xml");
myXML.ignoreWhite = true;
[Code]...
[Code]....
As you see from the code above I have a loop that loads images on each pass using the same loader. This works, however, it is looping too quick (I believe) and as such the "addBook" function that handles pushing these into an array is pushing them into the array in the wrong order. Two questions: (1) Am I approaching this incorrectly? (2) If not, is there a way to listen to the loader event so the loop proceeds only after the load of that image is complete?
I have a project underway where I am making an interactive game. It is a personal character creator game and I need Actionscript 3 help with this.Something similar here:http:[url]....
I have tried already with toggling visibility and 'gotoAndStop()' to make items appear over other items when the corresponding button is pressed, for example, when the user tries out different pants/shirts on their character.
I would like to use the selectionMode=multiple described in the Flex docs, but with a few modifications:
1) I would like the box that the user drags over the graph to remain there until the user drags a new one.
2) In the top right corner of the box I want to display the sum of the items selected by that box.
How to make list items as tool tips for combo box items?
View 2 Replies