ActionScript 2.0 :: Get Array Number From Its Content?
Jul 17, 2009I would like to find out the index in the array from a string in the array. E.G[code]...
View 3 RepliesI would like to find out the index in the array from a string in the array. E.G[code]...
View 3 Replies[code]I want to input a number and find a match for the number, returning the values on the row in to specific fields for each number. For example, if I input the number 10 in an input field, I want the number 1.2276, 0.00100, 106.38 and the rest of that row to output these values I have seen so many options, don't know where to start.
View 2 RepliesI'm trying to create a shuffle button for my mp3 player. I don't want it to repeat any song in the xml playlist until all the songs are played. Is there to display a random number on the click of a button, without repeating any number in the array until all the numbers in the array are used?
View 9 RepliesI think it would be simplest to explain it like this:
[Code]...
I am working on an interactive quiz type game using arrays and multidimensional arrays.
I am trying to make a dynamic textfield say "the current question" + "Sorry, the correct answer is..." + "the second answer in the first string of answers in the array".
I think I am pretty close, but there is an error in the syntax.
Here is the line of code where I try to do this:
questionHolder.question.text=(String (cat4Questions[0]) + "Sorry, the correct answer is "+ String (cat4Answers[0,2]));
I am getting this error:
VerifyError: Error #1030: Stack depth is unbalanced. 1 != 0.
I have two arrays. One contains numbers and the other contains strings. I want to do a sortOn(DECENDING) for the number array and then have the string array sort to match. if my string array is
[Code]....
i have an xml which has several nodes, each has an attribute which holds a num (a price of product). Now, after the xml loaded into flash i list out all the product, displaying the names and the price. Under the lis I've got to write out the sum for all the prices. But when I just simply use this method
sumNum += accNum
inside the main cycle, I create the list, it just doesn't work, coz it sees the price tag as a STRING, so it just puts each tag after one another, insted of adding them together.
I have a textfield. I want to verify if the content inserted by the use is a number, and if it is not I want to give a message.
How can I verify if it is a number?
I am trying to use the code below to get the info from the arrays and if the value is +,-,* or / the array value is posted into a new array otherwise it is posted to a number array:
Code:
var i = 0;
operator = new Array();
calc = new Array();
var myArray = ["0","1","+","2","*","5"];
while(myArray.length > 0){
[Code] .....
Which shows the length at only 1??? however the code seems fine from the other trace info.
if I have an array like this:[code]then I want to get the order number of the orange, which is 1, out. Is there any way to do that?
View 3 RepliesWhy code below traces "False". I am nearly sure that it has to be "True".
Code:
var a1:Array = new Array(1,2,3);
var a2:Array = new Array(1,2,3);
trace(a1 == a2);
this is my code:
var arr:Array = new Array("ABCD","BCDA");
for(var i:int =0; i < arr.length; i++)
[code].....
Is this the best way to compare a value with the content of an array?
for (var p:Number = 0; p < minaMaxAntal; p++) {
if (minaStatus[p]==1) {
code...
}
I have 12 empty Movie clips on stage. I want to get the content (jpg's or swf's) for these containers from an array. This is all fine, but I would like the contents to be loaded randomly into one of the 12 containers. The containers load the jpg's, which are preview thumbnails that need to link to the actual larger image plus some text. Loading eveything is OK, but I haven't figured out how to load the content into a random MC...
I attached the fla and images.
I have 12 empty Movie clips on stage. I want to get the content (jpg's or swf's) for these containers from an array. This is all fine, but I would like the contents to be loaded randomly into one of the 12 containers.The containers load the jpg's, which are preview thumbnails that need to link to the actual larger image plus some text. Loading eveything is OK, but I haven't figured out how to load the content into a random MC
View 3 RepliesI have taken this script from a tutorial which uses a scrollbar and buttons to control a number of sections created by an array. I have an empty movie clip called 'content_mc' on the main stage, linked to which is a movie clip with the identifier 'section'. The tutorial doesn't explain and I can't figure out how to actually add different content into the 5 sections.
[Code]...
You can do this:
PHP Code:
public function (args ...)
To take in any number of arguments. Is it possible to then give the content of that args array to a new function:
PHP Code:
public function bla (args ...){
pleh( changeArrayIntoArgs(args) );
}
So that that would be the same as just passing arguments manually. lets say bla got 3 arguments:
PHP Code:
bla(v,vv,vvv);
So that bla then executes:
PHP Code:
pleh(v,vv,vvv);
I'm having some trouble with arrays, especially comparing a keyword which the user writes in to a TextField with a word placed in my Array.[code]
View 4 Repliesi am trying to output the content of an array into a textfield.
For instance this is my array:
var MyArray:Array = ["item 1","item 2","item 3","item 4","item 5"];
And trying to output to textfield via a for loop and a textfield with an instance name "products".
for(var i:Number=0; i<MyArray.length; i++){
products.text = MyArray[i];
}
My problem is that this only outputs the last item in my array into the textfield. But not all of the items..
So my array has 5 numbers in it and also the ability to add more to it as the user sees fit.I want to be able to display the max and min number in the array. I made a loop but i am not sure how to make it select the highest or lowest number automatically without me selecting it manually by typing it in.This is my code for determining this:
// Determine Min and Max Markfunction maxandminMark(){var markIndex:int;markIndex=(marks.indexOf(marks));if (markIndex != -1){ for (var i = markIndex; i < marks.length; i++) marks[i] = marks[i+1]; trace(maxandminMark);}}}
[code].....
How do you add a range of number within an array? for example my 2 arrays consist of 1-30 and 31-100.[code]...
View 2 RepliesI'm using a PHP Script to create XML. Which pulls through the data from a Database. I have an video list, which pulls through X amount of videos. But I want to show them 5 at a time. I want to hide a button once it reaches the amount of videos in the XML.Hope there's enough detail in this question. My script is as follows.....
// Event Handler
protected function videoRetrieval_resultHandler(event:ResultEvent):void {
var videoData:ArrayCollection = event.result.videos.video;
[code].....
If I want a a random number not to be equal to a number in an array so that the random number dose not repeat itself.Or if can't be done with an array how would you get a random number to randomly generate numbers but not repeating itself?
View 9 RepliesI'm struggling to add my array number values together within my addListener. I'm able to trace all of the numbers.[code]...
View 0 Repliesi hv an array that contains numbers, when iam trying to perform the addition operator on the numbers, it doesn't summing the numbers algebrically:
a[1][1]=a1.text
a[1][2]=a2.text
b=a[1][1]+a[1][2]
trace(b)
and the result is putting the two texts of a1 and a2 together not summing them, means if a1.text=1 , a2.text=2 the output of b is 12 how could i make it to sum the numbers?
need to convert a mathematical eqaution I have in an array
eg. 1+1
into a number
eg. 2
Which is the simplest way to get the biggest number in an array?
Is there any method that does it directly or I have to order the array and get the last element of it?
I have an array, strictly numbers, how could I add... say array[0](value=2)+array[1](value=1) to equal 3? What I come up with is an undefined error, or not a number...
View 3 RepliesI'm trying to write a script that can copy multiple inputs that i've stored inside my array to the clipboard. Is it possible for me to get all my data inside "storage" array to the clipboard? All it seems to do is copy the last input given.[code]...
View 2 RepliesOne last time and then I abandon this idea of importing XML files forever
I have attached a sample .fla file plus folders with the other files in the Variables not found only on "simulate download" post if you want to try running it.
There are 42 XML text files and 42 buttons on stage. In 'Test Movie' all 42 external XML files load perfectly every time - switch to 'Simulate Download' and keep clicking. It won't take long to "break it" and an 'undefined' will appear. But if you keep clicking, the same text will be defined on the next time around - so this isn't simply a case of the array not being created properly.
This is the frame in the preloader that creates the array that holds the XML files - it loops until they are all loaded - the counter is set and incremented in the other preloader frames:
Code:
function loadXML(loaded) {
if (loaded) {
//loops back to load all text
[Code].....
'textNum' will never fail to show the number clicked when 'undefined' appears - but 'textForStage' which is the actual text in the array will show 'undefined' in the output window.