And what about that ?
var arr:Array = [17, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
arr.sort(16);
trace(arr[arr.length-1]);
Patrick
2007/4/24, Sherif Elshazly <[EMAIL PROTECTED]>:
Could be irrelevant or could be useful so I'll mention it anyway.
That looks fine to me, but i would create a new variable to hold the value
of arr.length to test against, it'll be more efficient to access a
variable than an array's property.
var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var greater:Number = 0;
var loopCount:Number = arr.length;
for(var i:Number = 0; i < loopCount; i++){
greater = Math.max(greater,arr[i]);
}
trace("greater is " + greater + "\n");
Sherif
----- Original Message ----
From: Gilles Roquefeuil <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, April 24, 2007 11:51:18 AM
Subject: Re: [Flashcoders] there is a problem plz help
Hello,
is this better ?
var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var greater:Number = 0;
for(var i:Number = 0; i < arr.length; i++){
greater = Math.max(greater,arr[i]);
}
trace("greater is " + greater + "\n");
Gilles
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com