Although you should use an IF statement instead… otherwise you will get a loop error as the while loop will loop all the time its condition is true…
The condition will not be allways true. It’s not an infinite loop.
THis was the point. Whenever it gets a space in it’s way it should add it (the space) to the resultcode (resultcode += " “) and increase it’s index (i++) and search again if it’s not another space.
I used while because some user may type multiple spaces. If i use IF statement it will imediatly pass to the substr. and could result in variables named something like " go” instead of “got” ergo errors at the eval statement.
Mdjstudio you should read this too and maybe you will understand how the script works. I edited it for you… not for prophet … because I realize he knows how the script works :p.
I won’t have access to flash till monday. But you could post here. What are you confused with :)?
attached a working fla (space support as well ;))
have a look at it…
im afraid unless you want 26 IF statements in your decryption script you would be better off sticking to a uniform number of characters…
o and i had to change the vbariable i because obviously there is an I in the alphabet and thats where your numbers were coming from.
also added a few lines to set your second input box equal to the first result box if there were no contents in it - i was too lazy to keep coipying and pasting! lol
seems to me like this decoding program takes up a hell of a lot of resources such as memory/cpu… its only 25kb? why would it take up so much resources?
becuase it’s not a gradual task your asking you cpu to uncode the entire thing at that second. And i don’t see how its really taking up that of your cpu’s power. Theres a small steady jump of processing power (hit the button when your ctrl+alt+delete is up performace tab). Flash can only use a certain mount of ram so it stays steady (strait line) then it goes back down.
Note: this could be bad if you were to have a lot of text incoded and try to decode it. Thats about it so.
the while loop shouldnt be a problem… but try swapping it out for an IF statement instead only problem is that double spaces wont be translated… but of course, chances are if the user typed a double space then it was in error… normally i would say that its probably the idea of putting a loop within a loop is daunting for yourprocessor… but the while loop would only be run once or maybe twice so i dunno :S