 |
Featured jobs
Featured template
View more templates
 |
 |


Next 5
Basic array shuffler
2d array from text file
 |
 |
_root.myConstuctor = new LoadVars();
_root.myConstuctor.load("MytextFile.txt");
_root.myConstuctor.onLoad = function(true) {
if (true) {
_root.myParsingVar1 = _root.myConstuctor.myTextFileVar;
_root.myParsingArray = _root.myParsingVar1.split("\n\n");
_root.myMainArray = new Array();
for (j=0; j<_root.myParsingArray.length; j++) {
for (n=0; n<3; n++) {
_root.myParsingVar2 = _root.myParsingArray[j];
_root.mySecondaryArray = _root.myParsingVar2.split(";;");
}
_root.myMainArray[j] = _root.mySecondaryArray;
}
}
};
Posted by: mothh | website
http://www.mothh.com
|
 |
 |
 |
7 out off 49 Lottery
 |
 |
/*how to do a lottery? Draw 7 (unique) out off 49 balls for example */
pickfrom = new Array();
winlist = new Array();
all = 9;//49 easy to configure
shown = 7;//show 7 winner
for (i=0; i<all; i++) {
pickfrom[i] = i+1;
}
trace("2003 by www.advance-media.com \nBegin: "+pickfrom);
for (i=0; i<shown; i++) {
rand = Math.floor(Math.random()*(all-i));
winlist[i] = pickfrom[rand];
pickfrom.splice(rand, 1);
}
trace("Rest: "+pickfrom+"\nShow Winner: "+winlist);
/* I used it for loading 7 randomly picked movies
(holding nothing but pictures) out of 17 total and no repetition!
Each time the user clicks back to the site he gets to
see different pix on my slider bar....*/
Posted by: Folko Langner | website
http://www.advance-media.com
|
 |
 |
 |
a count
 |
 |
//count (a1+a2+---an)*(b1+b2+---bm)
//author: tigerchina
k=0
Number.prototype.mu=function(a,b){
for(i=0;i<a.length;i++){
for(j=0;j<b.length;j++){
this=this+a[i] *b[j]
}
}return this
}
temp=new Number()
a=new Array(1,6)
b=new Array(3,4,7)
trace(temp.mu(a,b))
Posted by: tigerliao | website
http://www.yahoo.com.cn
|
 |
 |
 |
Add Values In Arrays V1
 |
 |
I developed this script to help o ut a Director user who wished to be able to perform operations like:
[10,10] + [5,-5] = [15, 5]
This function ads only. I thought of making it a prototype but then I thought better of it, as it's prolly more useful as a function for iterative applications, etc. Enough talk, here it is:
// Add values in arrays V1
// Jesse Stratford, www.actionscript.org
function arrayAdd (a, b) {
tmp = new Array();
// Math.max used to ensure no items are dropped
// if one array is longer than the other
for (var j = 0; j<Math.max(a.length, b.length); j++) {
tmp[j] = a[j]+b[j];
}
return tmp;
}
// Usage Examples
answer = arrayAdd([10, 10], [5, -5]);
answer2 = arrayAdd([10, 10], [5, -5, 10]);
// Note answer2.length = 3
Posted by: Jesse Stratford | website
http://www.actionscript.org
|
 |
 |
 |
Next
5
|  |
Search Entire Site
Advertisements
Latest New Articles
- Set up a simple IIS Server for Flash
by Peter McBride - Day 1 at FITC Toronto 2008
by Anthony Pace - Simple reflection effect with AS2
by Jean André Mas - ActionScript.org Meets Josh Tynjala (aka dr_zeus)
by ActionScript.org Staff - Rapidly Create Online Flash Movies to Help Users Market, Sell and Support Software and Hardware
by Sabrina F
|
 |