/ Forside / Teknologi / Multimedie & design / Flash / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
Flash
#NavnPoint
bentjuul 4251
molokyle 1978
Klaudi 1488
jhvp 1265
pallenoc 1160
katekismus 1020
Fnollerpi.. 790
slander 510
Dr.Disco 500
10  Flash77 500
Hvor lang tid tager en .split() ??
Fra : Michael Peo


Dato : 10-12-01 19:01

Så er det min tur til at spørge. Jeg beklager at jeg har skrevet på (skole-) engelsk, men det er nu een gang
nemmere når man skal spørge flere steder - Here goes..:

Time to split?.. No! please let me have a min. of your time to explain my prob.
Quite the odd question i know, but here is the setup to help explain.
SETUP - The idea -----------------------------------------------------------------
place a lot of buttons on a map according to a set of variables loaded from an external *.txt-file.
/end SETUP - The idea ------------------------------------------------------------

SETUP - the loaded variable -------------------------------------------------------
To place a lot of buttons on a map, i load a variable from an external *.txt-file containing all the
information the buttons need to be placed, x-pos, y-pos, size, name etc. Each single set of information for
each button would look like this ex:
145|547|10|name
As you can see, each of the values of this single set of information is split up by a " | " enabling me to do
a .split("|") later on.
The variable i load from the *.txt-file is made up from lots of these little set's of informations devided by
a " $ ". making the variable look something like this:
allCoords=145|547|10|name$645|314|8|name2$98|7|10|name3$387|661|10|name4$ etc. etc.
/end SETUP - the loaded variable ---------------------------------------------------

/SETUP - the loading and splitting ---------------------------------------------------
a clip called "map" has the following actions attatched to it loading the variable and doing the initial
splitting("$"):
onClipEvent (load) {
loadVariables ("coords.txt", "");
}
onClipEvent (data) {
pointsArr = allCoords.split("$");
this.gotoAndPlay(2);
}

the clip "map" now goes to frame number 2, were each of the set's of information is split up into smaller
pieces used to place, scale and give the propper atributes to the individual button.
map (frame 2):

for (i=0; i<pointsArr.length; i++) {
onePoint = pointsArr[i].split("|");
this.attachMovie( "buttonClip","bc"+i , i );
setProperty ("bc"+i, _x, onePoint[0]);
setProperty ("bc"+i, _y, onePoint[1]);
setProperty ("bc"+i, _width, onePoint[2]);
setProperty ("bc"+i, _height, onePoint[2]);
set ("bc"+i+".name", onePoint[3]);
}
/end SETUP - the loading and splitting ------------------------------------------------


All this works fine as long as the number of buttons to be placed is fairly low, but when i get to the map
with about 500 buttons, flash is brought to it's knees!??
Isi it because the initial split("$") is not all done before i send the map-clip to it's second frame were the
following split("|") is done...?
How long does a split take, and how can i check when it is done? Or am i doing this the wrong way?
Sugesstions, comments and especially alternate methods of solutions is more than wellcome, and i will be happy
to supply source-files etc.

Thanx for helping out...
--
Michael Peo
www.bandage.dk

ps: to speed up the actual splitting i am using a alternative and much faster split - a prototype called
quicksplit, written by a guy called Bokelberg, find it here:
http://www.bokelberg.de/actionscript/quicksplit.html
Thanx and credits to Mr. Bokelberg for a great site with lot's of usefull stuff.





--
/peo
peo@bandage.dk
www.bandage.dk



 
 
Søg
Reklame
Statistik
Spørgsmål : 177558
Tips : 31968
Nyheder : 719565
Indlæg : 6408925
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste