ActionScript 2.0 :: Output Values For Buttons In Loop?
Jan 13, 2009
I have this little loop that creates buttons. My aim is to change value of variable 'thevalue' on everytime button is pressed, first button should give value 0, second 1, third 2 and so on.
Code:
for (jo=0; jo<xmlData.firstChild.childNodes.length; jo++) {
value1= xmlData.firstChild.childNodes[jo].attributes.value;
_root.attachMovie("button", jo, (1000-jo), {_x:20, _y:20+(jo*20)});
[Code]....
View 2 Replies
Similar Posts:
Dec 6, 2010
I've gotten these sliders to work but can't get the output values to add up. For instance, depending on the values for slider 1, 2 and 3, I need the total to show up in a separate text box. I keep getting a NaN message in the text box.Here's the code I have so far:
//item 1
sliderOne.width = 600;
sliderOne.value = 0;[code].....
View 3 Replies
Oct 17, 2009
I just started working with CS4 / as3 and I'm working on extracting simple text from an xml file. I got the code off youtube, and it seems that even after copying this guys code line for line, it doesnt work. More speficially, the trace/output doesnt want to output variables. I did use trace("hello") and that worked fine, so its not the omit output option, but it just wont display the values from variables.[code]...
View 5 Replies
Oct 2, 2009
i am using FlashDevelop and i have created 2 very simple classes, [code]When i create an instance of the Vehicle class in my VehicleOnly.as file and send the values to my constructor, and run the appplication, it does not show any output to my Output panel.[code]
View 4 Replies
Jul 20, 2009
I have need of loops / nested loops that pick different figures depending on where you are in the loop. The whole function needs to run through 'ml' times. 'ml' is a dynamic figure. Loop 1 = While the loop is within the first 12 iterations, 'exconemp' must equal 100. For iterations 13 - 24, 'exconemp' must equal 102.5, for 25 - 36 it will be 105.06, for 37 - 48 it will be 107.69. This needs to change every 12th iteration until it has reached 'ml'. The calculation takes the value of the previous 'exconemp' and then multiplies that by 0.025.
Loop 2 = While the loop is within the first 120 iterations, 'abc' must equal 0.015 and any further iterations must use 0.01. This must also work in a way to figure out whether 'ml' is higher or lower than 120 and work accordingly. My main issue is this - how do I get the loops to run through as this: While the iteration is < 12, do this, THEN take the final figure (12th iteration) and start on 13 - 24, do this THEN etc etc. How do I produce a THEN statement? I can get the code to pick up the final values, but not change along the way.
[Code]...
View 6 Replies
Jan 21, 2010
i have a drag and drop exercise that will output a value based on the drop positions of 2 points. What I would like is to be able to add a button that basically has a whole new set of outputs based on the same drop positions. Here is an example. If I place an object on drop target 1 and 3. The output says something like "good job". Now if I click a button and place and object on 1 and 3 the output would say "try again".
View 4 Replies
Dec 16, 2011
This includes some code and some traced output. I've been looking at this for 2 days and it stupifies me. I'll elaborate: There is a game object, its a dictionary object containing a screen tile with index/name tile_x_y So i can look it up using the x and y coords. The object contains lost of stuff but in this case especially: x, y , width, height, xtile, ytile (self explanatory i assume) & xmove, ymove (-1,0,1 depending on direction.)
So, now these objects move around the screen (yes its just a game) and check if they hit the screen bounds and if they try to move onto tiles that are occupied/non traversable. It goes fine for most objects but sometimes, or for some objects (no clue why and it changes on restart), halfway the boundaries check, the object internal x and y values go ballistic and i end up with a reference error on the dictionary object because tile 280 30 just doesnt exist.
[Code]...
View 1 Replies
Dec 3, 2010
Why does for in loop show different results in as2 and as3
[Code]....
View 5 Replies
Mar 3, 2009
I have a loop that is supposed to run a set of functions and output movieclips on a main movieclip. Each of these smaller movieclip is supposed to be a tile. The code below is supposed to make 50 movieClips each one from a different reference on the tileSheet. However it outputs 50 of the exact same movieclips.
Code:
var tDMax:int = 50;
//Start Get tiles
function getTiles():void{
tList.graphics.beginFill(0x000000);
tList.graphics.drawRect(0, 0,tWidth * 5, tHeight * 10);
[Code].....
Strange enough whatever I made tDMax which is supposed to be the limit for the loop, that's what all the movieclips become. For example if I put it at 25, then all the movieClips become tiles from the bitmap sheet reference # 25. That leads me to think that it's not passing the variable to the functions correctly, and it's only doing it once the loop finishes. But when I trace things like rowT and colT the references to the bitmap are correctly. And when I trade tn within the other functions that's always correct also..
View 2 Replies
May 18, 2011
How can I reorganise the code below so the trace commands output i for each element in the photourls array and not just the last element? In a 6 element array, the trace(i); line outputs 5,5,5,5,5,5 rather than 0,1,2,3,4,5.
[Code]...
View 2 Replies
Apr 23, 2011
I'm trying to Have multiple buttons that when clicked on, they display a text unique to each button. I don't want it to simply throw a textfield on top of the old one but rather to hide the other text field and insert a new one.
ActionScript Code:
var fl_TF:TextField;
var fl_TextToDisplay:String = "Text 1";
var fl_TextToDisplay2:String = "Text 2";
[code]....
Clicking on 'button', it displays the proper text.Then when I click on 'hider' button, it displays the right text and takes the text from 'button' away.However, the file crashes when I click on 'hider' first. Also, clicking on 'button' a second time doesn't take away the text that 'hider' symbol produces.
View 4 Replies
Nov 13, 2011
I want to do a loop of this
Code:
t_1=parseInt(mcArray1[0]);
t_2=parseInt(mcArray1[2]);
[code]....
View 3 Replies
Dec 7, 2011
So I have an array, which consists of xml-values. I want to check a node from each array entry. I've tried reaching xml-values as such:
var eventArtists:XML;
for each (xmlEvent in arEvents)
{
[code].....
View 1 Replies
Apr 24, 2010
I've solved this problem in AS2 but I can't seem to sort it out in AS3.[code]...
View 1 Replies
Apr 18, 2008
I have five buttons on stage and I simply want to trace "1" when I click the first button and trace "2" when I click the second button and so on.I am always getting the last number and cannot figure out, how to store the values.
View 4 Replies
Mar 15, 2010
I have a query regarding assigning values to buttons in a for loop, I will explain:This is a string which I want to assign to a button value via getURL:
var myURL = "http://www.mywebsite.co.uk" + "/?Group=" + mySharedObject.data["destination"+i] + "&" + "SearchType=654&" + "Target=offers&" + "Paging=on&" + "HotelName=" + mySharedObject.data["hotel"+i];
[code].....
View 1 Replies
Nov 8, 2009
I have a movie clip (mc_moviegroup) which is made of a group of many dynamic text fields. I want to loop through the dynamic text field children of mc_moviegroup and pull out their text values in a string. Does a movie clip have a property which gives the number of it's children movieclips?
View 2 Replies
Sep 9, 2007
I have a bunch of thumb mc instances on my stage, using the same mc symbol. They're all sized differently so the widths(which are same as heights) vary.I want to be able to access their width value from an array independent of all the scaling I'm doing with rollovers. That is, I need to have each mc instance's original width accessible from anywhere in my code.The simplest way to do this is to hard code an array, like:
var Twidth:Array = new Array();
Twidth[0] = "33";
Twidth[1] = "45";[code]....
But since I have 22 thumbs and several portfolios, and want the option of changing their original sizes on the stage, I want to create the array above on the fly using information in a loop. For instance, I already have a loop in a function called generateThumbs(). Here's what I've tried:
for (var i = 0; i<total; i++) {
Twidth = new Array();
Twidth[i] = this["thumb_mc"+i]._width;[code]....
for trace on the first method, replacing 'i' with the key I want (Twidth[2]):
undefined
undefined
45
undefined
undefined
As you can see, this gives me non-indexed non-delimited value for the whole loop (the actual in my real movie is 22). There's no length or array because its actually just one value. Entering a number in the key will display a bunch of undefined with one defined. I have no way of extracting that one key without getting all the other undefined values.my question is: How do I put 'this["thumb_mc"+i]._width' values into a loop with each value indexed for the rest of my functions to access?
View 2 Replies
Mar 23, 2009
I have a array of categories, for e.g.
var categoryArray = new Array('value1', 'value2', 'value3');
I would like to loop and create new arrays from each of the values in the categoryArray I tried...
for(var i=0;i<=categoryArray.length-1;i++){
this[categoryArray[i]] = new Array();
}
value1[0] = "dsfsdf";
trace(value1[0]);
It doesn't seem to work.
View 3 Replies
Dec 9, 2009
DISCLAIMER: relatively new to Flex/AS3, I might be missing something obvious. After doing some research it appears that using the for(var property:String in object) does not guarantee the enumeration order of properties, however it doesn't say anything about modifying the VALUE that property points to as changing the for...in loop.
[Code]...
As a solution I can create a temp object to store the data while doing the loop on the original object, and then replace the original object with the modified data, but I'd like to know what exactly is going on.
So my question is, does the value of object property modify the looping order of the for...in construct? And if so, should it or is this a bug?
View 3 Replies
Mar 4, 2007
im having problems with a nested loop. i found some post here, but they didn�t help me. i need to extract the individual values from a nested xml node. i simplyfied the xml.
this is the code:
[Code]....
View 1 Replies
Mar 9, 2007
i got this perlinnoise called function and movieclip.filter = [displacementMapFilter] inside a onEnterFrame and it's eating me at 100 percent. are there any substitutions for making it much less processor intensive? I'd like to show a picture rippling and i'd like to use perlinNoise. Is there a way i can pre-calculate the perlin noise values and then loop through it in an OnEnterFrame
View 7 Replies
May 23, 2009
While a for loop runs through all the elements in an array I want to get the width of each element and add it to the sum of the width of all previous elements.
View 2 Replies
Jun 1, 2011
Here is the structure of the XML file: PHP Code: <xmlfile><page></page><page> <source></source> </page></xmlfile> Some "page" nodes contain the extra "source" node. What I'm currently doing is looping through all the page nodes and looking for any source nodes. If there is a source node, I create a variable, and want to assign it a value of the contents of the "source" (HTML).
[Code]....
View 1 Replies
Oct 12, 2009
I`m trying to assign values to a dynamic text field.[code]Can you please tell me how to make it work trought for loop #1
View 1 Replies
Aug 23, 2010
i have a simple matrix form that consist of 3*3 textfields. my problem is how to get the values that the user will enter into it by a loop, i mean not using a long way such:
[Code]...
View 7 Replies
May 7, 2009
This one is tripping me up. I'm creating a simple 10 question 'quiz' with simple "yes" or "no" radio buttons for each question. If they picked "yes" the value is 5, while "no" is 0. I want them to be able to choose all of the answers and then click submit. On submit it would add up all the answers and save that number as a variable named "score".
I know how to setup all of the radio button groups, calling each group question1, question2, question3 etc and giving the values to each yes and no radio button. I just don't know how to capture the values on submit, add them up and save to a variable.
View 1 Replies
Feb 24, 2010
I am new top actionscript that is why I am trying to learn AS3 instead of the AS2 etc.anyway I am trying to create a number pad in flash (like a calculator but wothout the add, subtract etc) so that when I press a number its displays the number in the flash movie. I nearly have it but it only displays one number at any one moment but i need to be able to add upto 5 digits in the display, so that later on in the project I can validate this field to make the input is correct.here is the code that I have made but remember this is my first AS3 flash program so go easy on me
stop();
display.maxChars = 5;
// start of the array
[code].....
View 7 Replies
Feb 4, 2007
I have an MC with the instance name "building". I want to be able to change the RGB color values of this MC with three buttons for example. for example, one button would change the RGB values to 60 89 159 another button would change the RGB values to 50 251 59 another button would change the RGB values to 22 21 59 And, when the button is clicked, the new RGB color value should fade in without the old values fading out.
View 3 Replies
May 21, 2007
I need to make the buttons that are associated with this code, toggle, so once you press them they become greyed out. So I was thinking of after you press a button, the alpha is reduced to 40%. Can someone help me place that piece of code into this monster? -I know it should go into the presto function of my script. Which works fine, but then it stays at 40%alpha after the user click on a different button. I need it to toggle off once someone clicks on the next button. [code]
View 1 Replies