Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: array trouble - final. really!
From: Helen Triolo
Date: Wed, 20 Dec 2000 19:01:19 GMT

Hi Paul,

I agree, if you wanted to do array operations, you'd be better off
creating a new array object. But if you just needed to be able to
access the variables in a loop, you could do so just as well with
_root["soundpress"+i] (or _root.somemc["soundpress"+i]). And I didn't
mean that my solution was necessarily the final one, just that I would
stop going on and on with different thoughts. It often seems that just
as I send a reply, I think of some qualifier I should've added, or some
different way of doing it that's better, but think I must be providing
more confusion than solution with those zillion different posts all with
the same header. That's why I said final (as in "Brain dump complete.
I'll shut up now"). But having said that, I also find that I learn the
most from posts that continue beyond just one person's question and
another person's answer, especially if the original poster follows up
with a "this is what ended up working best because..." kind of post.

Regards,
Helen
-----------------------------------------------------
i-Technica http://i-technica.com 301.424.6037
developer resources: http://i-technica.com/whitestuff

Paul Willoughby wrote:
>
> Hi Helen,
>
> I've just been following this thread as I'm trying to get my head round
> a similar sort of thing.
> But I don't quite understand this 'final' solution. I understand that
> the loaded variables can be accessed with the array syntax, but if you
> do it look this is there any way you can still use array methods (like
> array.pop, array.join). Surely you'd have to use your previous
> suggestion of creating a new array object before you could use those
> methods on the array???
>
> regards
>
> confused paul
>
> Helen Triolo wrote on 20 December 2000:
>
> > You already have an array, once
> > you've read the
> > variables in. (doh!)
> >
> > If you do loadVariablesNum("yourtext.txt",0) then they'll be
> > accessible
> > as _root["soundpress"+i], as mentioned below.
> >
> > If you read them into a separate movieclip (which provides the
> > additional benefit of being able to check for variables
> > loaded with the
> > onClipEvent(data) routine instead of the 2-frame loop mentioned
> > previously), with eg, LoadVariables("yourtext.txt","varclip"), you
> > should be able to access them with _root.varclip["soundpress"+i]. So
> > you don't even need to create an extra array either way.
>
>
> > Helen Triolo wrote a bit earlier:
> > >
> > > Yes, that's what I was saying. But thinking about it a bit more, I
> > > think my idea isn't so great. Flash may barf on such a big
> > string for
> > > one variable, and the split method is really slow. Probably your
> > > original way is better, using a text file with
> > > soundpress0=55555&soundpress1=44444&...soundpress899=33333.
> > >
> > > Then after you've read in the 900 variables, you could put
> > them into an
> > > array with
> > >
> > > aSounds = new Array(900);
> > > for (i=0; i<900; i++) {
> > > aSounds[i] = _root["soundpress"+i];
> > > }
> > >
> > > You would still access the array elements as aSounds[thiselement].
> > >
> > > Regards,
> > > Helen

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and the Flash(tm) Film Festival
November 27-29, 2000, LONDON, National Film Theatre

Produced by United Digital Artists and lynda.com
-Sponsored by Macromedia, Adobe Systems and Apple Computer
-http://www.flashforward2000.com or UK tel. +44 (0870) 751 1526
Register before November 10 and save 200
http:// www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  RE: FLASH: array trouble - final. reall, Paul Willoughby

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]