Find Largest Integer In Array
I've got an array:
ActionScript Code:
//for instancedistances[24,30,3];
How can I find the largest integer in it? Basically want to use it as "top score" kind of thing.
KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 10-02-2007, 04:39 PM
View Complete Forum Thread with Replies
Sponsored Links:
Largest Number In Array Question
Ok, this might be a noob question but here it is anyways...
I have an Array and I want to find the largest number in that Array.
Code:
myArray = [1,0,4,2];
for (var i:Number = 0, i < myArray.length, i++) {
//''Find the largest number in that array which is 4"//
}
anyone, papappapapaplease?
CHEERS~
View Replies !
View Related
Finding Smallest / Largest Values In An Array
Howdy!
I am trying to parse through an array and return the min / max numbers and although my method works it only works if there are values above & below my preset test var.
EX:
ActionScript Code:
sn = [
[50, 950],
[-300, 1075],
[400, 1200],
[150, 1150],
[-250, 750]
];
this.maxWidth = 0;
this.minWidth = 0;
this.maxHeight = 1000;
this.minHeight = 1000;
with (this) {
for (i = 0; i < sn.length; i++) {
// find our maxWidth value
if (sn[i][0] > maxWidth) {
maxWidth = sn[i][0];
}
// find our minWidth value
if (sn[i][0] < minWidth) {
minWidth = sn[i][0];
}
// find our maxHeight value
if (sn[i][1] > maxHeight) {
maxHeight = sn[i][1];
}
// find our minHeight value
if (sn[i][1] < minHeight) {
minHeight = sn[i][1];
}
}
As you can see if my values in the array are all higher or lower than my initial var values it botches the output. Any help?
Thanks in advance.
View Replies !
View Related
Retrieve An Integer From An Array
how can i retrieve an integer from an array and assign that value to a different variable
Code:
myArray = new Array(3);
myArray[0] = testing;
myArray[1] = 2;
myArray[3] = done;
var intnum;
intnum = myArray[1];
if(intnum > 1)
{
play();
}
else if(intnum < 1)
{
stop();
}
something like that... but that's not working
View Replies !
View Related
Array.sortOn With String And Integer Flawed..
I'm using the sortOn method to sort my array.
concider this array:
var list:Array = new Array();
list.push( {id: "1"} );
list.push( {id: "4"} );
list.push( {id: "12"} );
list.push( {id: "23"} );
list.push( {id: "9"} );
list.sortOn("id");
This will return the following:
1, 12, 23, 4, 9
because the sorting happens on the first digit. so 12 is first, than 4
-------------------------------------------
this can be fixed by using the following sort:
var list:Array = new Array();
list.push( {id: "1"} );
list.push( {id: "4"} );
list.push( {id: "12"} );
list.push( {id: "23"} );
list.push( {id: "9"} );
list.sortOn("id", Array.NUMERIC);
This will return the following:
1, 4, 9, 12, 23
which is fine
-------------------------------------------
But when you decide to use an id that consists of a string + integer, this way of working doesn't work anymore . . .
var list:Array = new Array();
list.push( {id: "fubar1"} );
list.push( {id: "fubar4"} );
list.push( {id: "fubar12"} );
list.push( {id: "fubar23"} );
list.push( {id: "fubar9"} );
list.sortOn("id");
and
var list:Array = new Array();
list.push( {id: "fubar1"} );
list.push( {id: "fubar4"} );
list.push( {id: "fubar12"} );
list.push( {id: "fubar23"} );
list.push( {id: "fubar9"} );
list.sortOn("id", Array.NUMERIC);
Will both return:
fubar1, fubar12, fubar23, fubar4, fubar9
How can this be fixed? I want my sort to have the following result:
fubar1, fubar4, fubar9, fubar12, fubar23
I think this is a pretty big shortcoming of the sortOn method
View Replies !
View Related
Find String Value In Array?
Hey, everyone. A quick question regarding arrays and strings. (Flash 5)
I have an array that holds three values: my_array("one","two","thr") which correspond to movie clips on my stage with the same instance names. Then I have buttons that sets a variable "selected" equal to _root.one, _root.two or _root.thr. Now I have a function that takes "selected" and manipulates it. This all works fine so far.
My problem occurs because after "selected" performs its actions, I want to remove the corresponding value from the array. So first I have converted the movieclip object "selected" into a string using remove1 = String(selected), then I slice out the _root. using remove2 = remove1.slice(7,-1) so now remove2 is equal to a string "one" "two" or "thr".
How do I remove this string value from the array? Is there a way to search the array values for this string and return its index? Any help is appreciated.
Thanks!
japangreg
View Replies !
View Related
To Find A Value Inside An Array
In Director I used getPOs() wich returned 0 if there was no such value or returned a number showing the position of the value in the array.
In FlashMX do I have to browse trough the array using for{} or what?
Is ActionScript less powerfull than lingo or is it just a different logic, because I find myself dealing with problems wich were very easily solved in Director
Thanks
Fernando
View Replies !
View Related
[F8] Find Next Array Item
This is probably an easy question.. If I have an array like "apples, oranges, pears, plums" and I want to find what comes after or before an item, how do I do it? For example, how would I create a button that would tell me the item that comes after (or before) "pears"?
Finding the index number of an item is easy, but how can I use it to find out what item has a higher (or lower) index number?
//find index number of "pears"
myArray = new Array('apples', 'oranges', 'pears', 'plums');
for (var i in myArray) {
if (myArray[i] == 'pears') {
arrayNum=i
break;
}
}
thanks!
Sebastian
View Replies !
View Related
How To Find The Name Of Selected Array?
Hi,
I have several arrays, the first of which is populated with the names of the rest of the arrays.
A function randomly selects one out of this list and then randomly selects something from THAT array.
The problem comes when I want to find out which array it selected in the first case. Basically I neeed it to perform another function if Array1 is chosen but when I try to query which array that was it just prints out all the entries.
I tried "ArrayVariable._name" but that is "undefined".
So its
ListOfArrays {
-Array1 - {values}
-Array2 - {values}
-Array3 - {values}
}
(if that makes any sense)
Whatever I try it skips stright through to listing the values. I need to find the value of ListOfArrays that was randomly selected.
Something tells me it's simple and overlooked.. hopefully I wont have to revert ListOfArrays to holding simple values then use a switch/case to turn that value into a refernce to the chosen array. That seems unecessarily messy.
Any help appreciated.
View Replies !
View Related
How To Find Key Of Associative Array?
Hello,
Does anyone know of an easy way to find the key value of of an associative array? This seems like it should be simple but I'm drawing a blank.
For example: I have an array that holds things like:
example_arr["CHILD1"] = "First Child";
example_arr["CHILD2"] = "Second Child";
...etc
If I know the value of the key then I can reference it like so:
example_arr[""CHILD1"]
However, I wont always know the key, hence lies the problem
Thanks!
Tommy
View Replies !
View Related
Find Two Numbers In An Array That Sum To A Particular Value
So, while working on my Dictionary/Hashtable tutorial, I decided to create a more interesting example that many of you may have encountered. Basically, given a huge list of numbers, the goal is to find two numbers from that list that sum up to a particular value.
I provide an example and a more elaborate description in this link. The code for it is:
Code:
//Declaring a Dictionary
Dictionary<int, int> numberHash = new Dictionary<int, int>();
//Collection of Integers
int[] values = { 144, 29, 46, 55, 33, 64, 174, 144, 168, 129, 73, 186, 24, 163, 3, 165, 160, 79, 39, 3, 81, 175, 183, 175, 15, 150, 177, 191, 29, 106, 104, 56, 58, 85, 172, 72, 119, 192, 134, 11, 10, 54, 34, 27, 194, 182, 71, 183, 132, 147, 23, 78, 70, 13, 144, 93, 104, 177, 181, 62, 155, 26, 50, 172, 158, 17, 139, 156, 105, 26, 162, 15, 65, 30, 174, 62, 175, 182, 121, 56, 23, 77, 179, 161, 168, 36, 25, 46, 137, 178, 51, 21, 65, 41, 78, 71, 196, 142, 78, 33, 130, 81, 55, 15, 131, 145, 135, 99, 116, 104, 20, 6, 22, 201, 135, 29, 148, 71, 110, 20, 104, 89, 105, 1, 10, 9, 53, 92, 75, 112, 161, 106, 196, 60, 163, 102, 109, 182, 148, 56, 88, 47, 151, 22, 119, 97, 163, 77, 126, 16, 151, 112, 143, 15, 76, 133, 124, 49, 114, 36, 183, 64, 4, 129, 201, 197, 161, 46, 103, 36, 58, 2, 78, 199, 113, 97, 53, 149, 60, 78, 63, 50, 152, 150, 140, 113, 101, 85, 80, 123, 186, 78, 95, 105, 195, 74, 121, 44, 40, 94, 149, 34, 74, 78, 28, 166, 126, 132, 51, 15, 200, 147, 77, 170, 171, 67, 67, 52, 57, 198, 186, 152, 69, 43, 194, 12, 37, 157, 144, 128, 153, 168, 130, 121, 186, 200, 195, 192, 162, 180, 95, 94, 24, 39, 37, 131, 177, 103, 106, 62, 28, 110, 145, 67, 99, 98, 137, 56, 26, 10, 56, 152, 36, 195, 150, 3, 87, 193, 16, 128, 186, 67, 122, 196, 162, 24, 56, 12, 2, 160, 190, 84, 17, 13, 112, 11, 200, 177, 120, 26, 33, 23, 11, 176, 7, 160, 49, 177, 92, 186, 176, 161, 175, 92, 30, 172, 186, 142, 145, 76, 44, 15, 171, 56, 158, 3, 9, 172, 92, 54, 101, 197, 158, 191, 102, 157, 32, 193, 156, 164, 74, 10, 106, 91, 176, 32, 132, 69, 197, 188, 184, 109, 5, 160, 200, 116, 55, 93, 143, 26, 82, 140, 52, 176, 120, 198, 178, 125, 122, 201, 44, 56, 96, 96, 29, 175, 156, 113, 17, 18, 70, 158, 159, 193, 162, 153, 40, 67, 170, 177, 182, 40, 78, 192, 173, 151, 55, 110, 142, 155, 56, 1, 134, 134, 50, 189, 105, 158, 34, 51, 17, 98, 131, 158, 89, 57, 158, 82, 112, 95, 149, 78, 60, 31, 144, 27, 94, 4, 45, 88, 152, 157, 82, 188, 73, 67, 198, 199, 198, 123, 201, 20, 171, 8, 115, 66, 144, 190, 126, 108, 5, 12, 14, 147, 35, 52, 139, 108, 57, 2, 128, 54, 157, 145, 75, 34, 26, 63, 201, 124, 198, 42, 109, 153, 177, 47, 173, 150, 3, 143, 198, 167, 110, 66, 20, 151, 147, 115, 108, 191, 142, 123, 169, 17, 127, 197, 86, 39, 144, 10, 165, 36, 151, 179, 185, 75, 39, 86, 194, 3 };
//Value to Guess
Random randomNum = new Random();
int x = randomNum.Next(10, 200);
//Trying to find two numbers that, when added, equal the sum
for (int i = 0; i < values.Length; i++)
{
int currValue = values[i];
if (!numberHash.ContainsKey(currValue)) {
int diffValue = x - currValue;
numberHash.Add(currValue, diffValue);
if (numberHash.ContainsKey(diffValue)) {
Console.WriteLine("Two values that add up to {0} are {1} and {2}", x, currValue, diffValue);
break;
}
}
}
As you can see, the code behind it is fairly simple. The ideas behind it have applications beyond this particular example, for there are many useful things you can do when storing/retriving data is really fast.
Just copy and paste that into a main method in VS2005 or another IDE and find out which two numbers in the array sum up to a value determined during runtime. You can also choose to run the attached file after extracting it. Whatever works
Cheers!
Kirupa
View Replies !
View Related
How To Find The Closest Value In An Array
All I'm trying to do is find a value in an array that's closest to the value of my variable...
So if the value of myVar = 50;
..and the array holds the values 25, 100, 150, etc.
I want to write a function that will be able to find the array element that's closest to myVar, which would be the first element in the array (myArray[0]), since 25 would be the closest value to 50.
If anyone out there has any ideas, I'd really appreciate it...
View Replies !
View Related
Find Highest Value In An Array
Can anyone tell me if there is a way to find the highest number in an array?
numbersArr(314,2613,221,103,77);
is there a way to loop though this, compare all the numbers to each other and find the highest value while keeping the array in order?
Thank you
View Replies !
View Related
Prototype - Find String In Array?
I have a multidimensional array
arrMenu=new Array()
arrMenu.header="header"
arrMenu[0]=new Array()
arrMenu[0].header="header0"
arrMenu[0][0]=new Array()
arrMenu[0][0].header="header0-0"
arrMenu[0][1]=new Array()
arrMenu[0][1].header="header0-1"
arrMenu[1]=new Array()
arrMenu[1].header="header1"
arrMenu[1][0]=new Array()
arrMenu[1][0].header="header1-0"
arrMenu[1][1]=new Array()
arrMenu[1][1].header="header1-1"
arrMenu[1][2]=new Array()
arrMenu[1][2].header="header1-2"
I wish to have my prototype search for a string and return an array of indexes.
E.g. if I search for "header1-1" the prototype should return
arrMenuPos=[1,1]
I am having trouble looping through a multidimensional array
Any help out there?
Regards
Podenphant
*******
Array.prototype.stringInArray = function (str){
??????? uaaargh
}
*******
View Replies !
View Related
Help With Array. Can't Find What's Wrong With The Script
Hey! I can't find what's wrong with this script. The way it should work: You click a button and it loads a random URL, the URL are dynamically loaded into an array form an external file. Any ideas?
Code:
btStart.onPress = function() {
dataHolder = new Object();
loadVariables('urllist.txt', dataHolder);
myArray = dataHolder.myValues.split(',');
for (i=0; i<myArray.length; i++) {
myURLarray.push(myArray[i]);
}
var nRandom:Number;
var sRandomURL:String;
function getRandomURL():String {
nRandom = Math.floor(Math.random()*myURLarray.length);
sRandomURL = myURLarray[nRandom];
return sRandomURL;
}
this.getURL(getRandomURL());
};
View Replies !
View Related
[F8] How Do I Find The Index (key) Of A Specific Value In An Array?
Hello All,
Is there a way to retrieve a specific element's index key if you only know the value of the element?
Usually, you give Flash an index ([0], [1], [2]...) and it gives you the value of the element at that position. I would like to do the inverse, because I know what the values of the array will be... however, they could be in any order.
Example:
myArray_array("Chris", "Mike", "Fred", "Jen", "Susan")
I want to remove "Fred" from the array; however, I don't know Fred's index key... and he could be anywhere in the array. Also, after removing "Fred", I do NOT want the array to contain an "undefined" or "empty" element where "Fred" used to be:
BAD:
myArray_array("Chris", "Mike", undefined, "Jen", "Susan")
GOOD:
myArray_array("Chris", "Mike", "Jen", "Susan")
Thanks!
View Replies !
View Related
Find Unique Items In Array
Hey party people,
I'm working on a project where I have an array of coordinate points (4 of them) and a menu system that, when clicked, rearranges the boxes so that they all move around. The problem is that the values I pull out of the array are not always unique so some of the items end up not moving (or sometimes it ends up moving two to the same spot because the last one didn't move and one of them moved to a spot that is already occupied).
Here is the code I was using which for the most part works, except as mentioned, sometimes the check for the last one in the loop sees that the conditional is not equal so it doesn't do anything because there is no other values to loop through and it just leaves it in that spot. i'm not sure how to fix this so any help would be greatly appreciated.
ActionScript Code:
private function checkCoordinates($item:MenuItem, $coords:Array):Void { var numItems:Number = $coords.length; for (var i:Number = 0; i < numItems; i++) { if (($item._x != $coords[i].x) && ($item._y != $coords[i].y)) { var ret:Array = $coords.splice(i, 1); var pt:Point = ret[0]; $item.moveTo(pt, 0); break; } } }
thanks to anyone who attempts to help, it's greatly appreciated.
View Replies !
View Related
How To Find Out What Number In An Array A Particular Element Is?
Essentially I need the MC to know whereabouts in the Array it is
Say you pick a movieclip at random, and assign in a function, how do you find out what number in the Array it is and remove it from the array?
For example...
Code:
for(a=0; a<arrayInQuestion.length; a++) {
if(arrayInQuestion[a]!=this) {
if(dist>50) {
arrayInQuestion.splice(this, 1)
}
}
}
But of course, "this" doesn't work, so I need to find out what number "this" is
Of course, it would be easy to remove the MC that I am checking "this" for distance with, it would just be splicing array[a], but it's "this" that I am just not sure how to splice.
Cheers,
Joe
View Replies !
View Related
Largest Of Three
hey, is there a better way to pick the largest varrible out of three then this?
Code:
if (_root.try1>_root.tryy2) {
if (_root.try1>_root.tryy3) {
_root.bestTry = _root.try1;
}
}
if (_root.tryy2>_root.try1) {
if (_root.tryy2>_root.tryy3) {
_root.bestTry = _root.tryy2;
}
}
if (_root.tryy3>_root.try1) {
if (_root.tryy3>_root.tryy2) {
_root.bestTry = _root.tryy3;
}
}
View Replies !
View Related
Problem W/ Targetting A Mc In An Array (cant Find The Level)
Firstly, thanks to the people that helped me out with this problem so far. It's really appreciated!
My main movie is set up much like a praystation tutorial, it is an array that links clips together horizontally with buttons on top that jump/slide the movie back and forth. Within each mc that is loaded into the array, there's a few for the subsection.
I have the subsection parts set up so when you hit the nav on the subsection, it loads a movie on top of the previous one (about_mc.swapdepths(mydepth++); within the MC (thats located within the main movie)
on my main timeline I have a variable-
_global.mydepth = 10;
the first main button has this script-
_level0.content_mc.section_0.sectioncontent_mc.abo ut_mc.swapDepths(mydepth);about_mc.gotoAndPlay(2);
When I had everything on the 10th level, I could target each clip and from the main time line, but since now it is loading a new movie (++) above the top level, I cant figure out a way to target the clips. What I want to happen is have each subsection reset itself to the beginning when the user hits the top button that slides the array over to a new section.
I have uploaded my current movies, maybe someone can help me out. It's for my portfolio.
www.quintessence-media.com/main.html
www.quintessence-media.com/topnavbar.fla
www.quintessence-media.com/section_0.fla
thanks in advance.
View Replies !
View Related
HELP: Find Position Of Word In Assoc Array
Hi all,
I'm trying to make a function that searchs an assoc array for a word and then returns its position in the array, but so far it's not working. Any know what I'm doing wrong?
ActionScript Code:
var aNames:Array = new Array({fname:"John", lname:"Smith"}, {fname:"Jake", lname:"Lane"}, {fname:"Owen", lname:"Bridge"});
//
trace("Word is at pos: "+wordPos(aNames, fname, "Owen"));
//
function wordPos(array, assoc, word) {
for (i=0; i<array.length; i++) {
if (array[i].assoc == word) {
return i;
}
}
}
View Replies !
View Related
Largest Number?
Has nayone got a shorter and easier way of finding the biggest number out of a set of variables. This is what I have up to now.
Quote:
// ---FIND THE BIGGEST NUMBER-----
if (_root.Q1>_root.Q2) {
// b ---------------------------------------------------------------
if (_root.Q1>_root.Q3) {
if (_root.Q1>_root.Q4) {
if (_root.Q1>_root.Q5) {
if (_root.Q1>_root.Q6) {
if (_root.Q1>_root.Q7) {
if (_root.Q1>_root.Q8) {
if (_root.Q1>_root.Q9) {
if (_root.Q1>_root.Q10) {
Q1P = "true";
}
}
}
}
}
}
}
}
// b ---------------------------------------------------------------
}
any help would be appreciated
View Replies !
View Related
Ver To Save For Largest Audience
Hi,
My name is Kim, and I'm a self taught flash designer. I have a site that I recently finished in MX. I'm wondering if, in this great source of knowledge and experience, someone can point me in the right direction as to what version of player I should save this site. Is the Flash 5 player still the prevelent version, or has Macromedia succeeded in expanding the viewer-ship of the ver. 6 player... and hey, with the new 2004 ver. now available, when do ya think this version will be widespread?
Any suggestions is greatly appreciated!
Many Thanks
Kim
p.s. always looking for feedback on my site, if ya get a chance, let me know what ya think.
www.frustrated-inc.com
www.frustrated-inc.com/testing
to reach me directly, please email: kim@frustrated-inc.com
View Replies !
View Related
Pick The Largest Variable
hello all
I need to know how to pick the largest variable out of a list..
im not sure what statements to look for in tutorials or anything so looking for myself is proving hard!
i have these variables and i just need to know how to see whic is the largest and then put that one into a variable
variable3 = curcode[3];
variable4 = curcode[4];
variable5 = curcode[5];
variable6 = curcode[6];
variable7 = curcode[7];
variable8 = curcode[8];
variable9 = curcode[9];
variable10 = curcode[10];
variable11 = curcode[11];
thanks if you can guide me!
View Replies !
View Related
How To Popup A Largest Blank Window?
Hi all
old question again , excuse me ...
How can I click a button in **HTML to popup a window with:
1. no buttons, no address bar,
2. make it the largest on the users' screen
3. my movie (scalable ?) inside it
Sorry I am bad with java...How can I do this?
Thx all in advanced
Cheers
MKit
View Replies !
View Related
Detecting Width Of Largest Object
Hi,
I am uploading pics and scaling them. I have variables to find out which width they are. Since they have different width how can I find out with a simple statement what is the largest width of any of the pics. I could do it by comparing each one with each one but that is very tedious. Is there a shorcut?
Thanks.
View Replies !
View Related
2 BIG PROBLEMS, Largest MC In Front, % Stopping All Animation Temporarily
Hi, I have 2 problems in a game. I have created creatures that get closer with scaling then when reached a certain size jump out at you.
this creature mc has been duplicated with a loop to produce 3 , all with random scale rates.
TWO BIG PROBLEMS I HAVE IF ANYONE CA HELP !!
my 2 problems are.....
----------------
1) When they are duplicated and moved towards you scaling I need to make sure the largest is always on top so it looks right and the smallest is the furthest away
--------------
2) I need to stop everything on the main timeline for a few seconds aprt from the clip that attacks you ??
The dupliacted movies that come towards you then jump out ... everything else needs to stop temporarily as it has a small killing animation... Ive tried using array notation to talk to the dupliacted clips, but Im not used to it ??
thanks in Advance
--
Dave Mattock
dave@mattockgraphicdesign.com
http://www.mattockgraphicdesign.com
View Replies !
View Related
Sorting User-defined Numbers Largest To Smallest?
Hi,
I am looking for a way to sort numbers enterred by a user, prefferably in order smallest to largest or vice verser - but at very least to find the smallest & largest numbers of the ones enterred.
There are approximately going to be 15 numbers or so.
So for example:
Enterred A = 56
Enterred B = 7
....
....
Enterred H = 72
then it should display:
Enterred B = 7
....
....
Enterred A = 56
....
....
Enterred H = 72
when sorted or the other way round (largest to smallest).
this could be done with comparrisons but for 15 numbers it would be A LOT of comparisons.
Does anybody know an algorithm or a way of doing this more simply ?
Array.sort may do it but not sure if it works for numbers?
Any help is much appreciated!
View Replies !
View Related
Sorting User-defined Numbers Largest To Smallest?
Hi,
I am looking for a way to sort numbers enterred by a user, prefferably in order smallest to largest or vice verser - but at very least to find the smallest & largest numbers of the ones enterred.
There are approximately going to be 15 numbers or so.
So for example:
Enterred A = 56
Enterred B = 7
....
....
Enterred H = 72
then it should display:
Enterred B = 7
....
....
Enterred A = 56
....
....
Enterred H = 72
when sorted or the other way round (largest to smallest).
this could be done with comparrisons but for 15 numbers it would be A LOT of comparisons.
Does anybody know an algorithm or a way of doing this more simply ?
Array.sort may do it but not sure if it works for numbers?
Any help is much appreciated!
View Replies !
View Related
2 BIG PROBLEMS- Bring Largest MC To Front-AND Stop All Animation Temporarily
Hi, I have 2 problems in a game. I have created creatures that get closer with scaling then when reached a certain size jump out at you.
this creature mc has been duplicated with a loop to produce 3 , all with random scale rates.
TWO BIG PROBLEMS I HAVE IF ANYONE CA HELP !!
my 2 problems are.....
----------------
1) When they are duplicated and moved towards you scaling I need to make sure the largest is always on top so it looks right and the smallest is the furthest away
--------------
2) I need to stop everything on the main timeline for a few seconds aprt from the clip that attacks you ??
The dupliacted movies that come towards you then jump out ... everything else needs to stop temporarily as it has a small killing animation... Ive tried using array notation to talk to the dupliacted clips, but Im not used to it ??
thanks in Advance
--
Dave Mattock
dave@mattockgraphicdesign.com
http://www.mattockgraphicdesign.com
View Replies !
View Related
Making The Largest Of A Duplicated Movie From Loop In Highest Level ?
I have created creatures that get closer with scaling then when reached a certain size jump out at you. this creature mc has been duplicated with a loop to produce 3 , all with random scale rates. in a variable called growth
firstly how do I always make the largest on a higher level so it is in front of the smaller ones so it looks closer ?
they are created in the main timeline with
------------
for (i=1; i<3; i++) {
evilbogey_mc.duplicateMovieClip("evilbogey_mc"+i, i);
}
for (n=4; n<7; n++) {
microNinja.duplicateMovieClip("microNinja"+n, n);
}
-------
-------------
then have this on each Movieclip (evilbogey_mc and microNinja)
--------------
onClipEvent (load) {
var attack = false;
function reset() {
this._x = (Math.random()*500);
this._xscale = 0;
this._yscale = 0;
attack = false;
growth = (Math.random(4)+1);
this.gotoAndPlay("start");
}
reset();
}
onClipEvent (enterFrame) {
this._xscale += growth;
this._yscale += growth;
_root.debug3 = growth;
if (this._yscale>=80) {
growth = 0;
if (attack == false) {
this.gotoAndPlay("attack");
attack = true;
}
}
}
on (press) {
this.gotoAndPlay("killed");
_root.headshot3.start();
}
-----------------------
this sets the scaling up etc
SO i need to make the one growing fastest or the largest in FRONT all the time?????
HOW DO I DO THIS Ive tried swapDepths
Thanks in advance
Dave Mattock
dave@mattockgraphicdesign.com
View Replies !
View Related
Integer Help
Hi! Need help on this script! How can I put the "media_ar" a integer number, without the decimals?
________________
tot_el = _root.myValue.length;
for(m=0 ; m < tot_el; m++){
valore = _root.myValue[m];
valore1 = new Number(valore);
valore2 = valore1.valueOf();
tot_ar += valore2;
media_ar = tot_ar/tot_el;
_root.media = "Média = <font color="#FFCC00">" + media_ar + "</font>";
}
_________________
View Replies !
View Related
Integer To Hex
Hey!
I need to convert an integer value to hex to use with the setRGB thingy. (I want a slide bar that controls the colour of a movie clip)
I know that you can use parseInt to get an integer from a hex value but how do you do the opposite?
Cheers
(feeling sick as a dog)
View Replies !
View Related
Integer To Hex
Hey!
I need to convert an integer value to hex to use with the setRGB thingy. (I want a slide bar that controls the colour of a movie clip)
I know that you can use parseInt to get an integer from a hex value but how do you do the opposite?
Cheers
(feeling sick as a dog)
View Replies !
View Related
Integer Divide
Hi, If I do a division I can make the answer into an integer afterwards. But that seems kind of CPU intensive, I know they don't like floating point calculations much. So is there any way i can go easy on it and just come out with the integer in the first place? I figure Mod must do it at some point but of course it doesn't give me the answer because thats not what its for.
Failing that, is parseInt() the simplest way to go? The answer doesn't have to be too accurate.
Thanks you guys!
View Replies !
View Related
Integer Problem
Hi guys,
I need your help on this litle issue:
I have a script that is made to calculate the average and I get it from an example in flashkit. it's like this:
----------------------------
tot_el = _root.myValue.length;
for(m=0 ; m < tot_el; m++){
valore = _root.myValue[m];
valore1 = new Number(valore);
valore2 = valore1.valueOf();
tot_ar += valore2;
media_ar = tot_ar/tot_el;
_root.media = "Média = <font color="#FFCC00">" + media_ar + "</font>";
}
----------------------------
This works fine, but I need the integer value. I know that is made with Math.Round but I try diferent ways to implement it and I cannot do it.
Can you help me?
View Replies !
View Related
String Into An Integer
Hi,
Simple thing I think
I have movieclips with instance names 1,2,3 etc and need to grab their names ( this.name = this._name ) but this becomes a string.
How do you convert a string into an integer.
Thanks in advance
View Replies !
View Related
|