Mailing List
Home
Forum Home
MUD Dev - Discussion of MUD system design, development, and implementation
Mac Game - Mac game development
Rivers of MUD - a Diku and Merc based multiuser dungeon
SMAUG
Subjects
Getting UDP through NAT/firewalls/whatever for a game
Getting UDP through NAT/firewalls/whatever for a game
QuickTime errors
Python script as stand alone MUD server
Various sound problems
Fragment Shaders & GL TEXTURE RECTANGLE EXT
Timers and global variables
Re: Language and platform for Text MUD server
Apparent acquisition of Yantis (mysupersales) by IDE
HID keyboard
Getting UDP through NAT/firewalls/whatever for a game
Microsoft Sparkle
Director MX
Congratulations Horizons
Yet more problems fullscreen mode
Apple Dev Kitchen Them 's tasty vittles, Maw!
NSOpenGLContext, Pbuffers, and drawables
More DCR "theft " naughtiness
dynamic sprite creation and imaging lingo
Re: Find stuff in Flash array?
Effects of skill imbalances?
QuickTime errors
Rom 2 4/Quickmud Enhancement/Bug fix
Working with XML files/CFURL
smooth scrolling/subpixel tweening
RE: (Ron help me?) Flash text
Flash Racing
MudDev FAQ 2
Browser based games
Installing GLUT
Special character in Flash XML
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
Re: Find stuff in Flash array?

Re: Find stuff in Flash array?

2003-12-03       - By Daniel Isenhower

 Back
Reply:     1     2     3  

> Does anyone here have knowlege of Flash arrays?
> Say I've got an Array(1,3,5,7,11).  How can I find out if 3 is in the
array?

...and just to clarify what I've already been through:

I obviously can't access it like this:

var someNumbers = Array(1,3,5,7,11);
var lookingFor = 3;
trace(someNumbers[lookingFor]);

...becuase that would return 7.
I've also tried it like this:

var someNumbers = Array(1,3,5,7,11);
var lookingFor = 3;
trace(someNumbers[String(lookingFor)]);

...and it returns "undefined".  Not that I was expecting that to work
anyway, but I'm getting desparate.  Is there no other way other than looping
through the entire array?

var someNumbers = Array(1,3,5,7,11);
var lookingFor = 3;
for (var i in someNumbers) {
    if (someNumbers[i] == lookingFor) {
         trace("i've found it the inefficient way :-/");
    }
}

...the array could potentially be very big.  I would think that would slow
down my project quite a bit eventually.

Surely there's another way?  I've looked through the AS help and on
macromedia.com, but to no avail :(

-Daniel
www.triinfinite.net
www.freewebhome.com
www.fervorstudios.com

__ ____ ____ ____ ____ ____ ____ ____ ____ ____
dirGames-L mailing list  -  dirGames-L@(protected)
http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames-l

Earn $52 per hosting referral at Lunarpages.