00:00
00:00
Newgrounds Background Image Theme

jailander1 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

AS: Password

11,129 Views | 53 Replies
New Topic Respond to this Topic

AS: Password 2005-06-29 21:40:51


AS: Main

This is a code that is very simple to make and allows you to have passwords for your games. Why would you want to have passwords? Well, if you're making a game, it acts like a save alternative. In a 5 level platformer game, you really don't need a save feature but a password feature would be helpful. If you are making a site in flash, passwords will keep people from accessing certain parts of your site that only you and other admins can access. So open up flash and lets get started! What you need to do first, is create a textbox that you want to be the spot for people to enter their password. Then, once you have that done, go to the document properties and make sure that the textbox is in "input text" format. After you have done that, change the variable name to "password" without the quotes. Then, (this is optional) go to the little box where it says "single line" and change that to "password". Now, create the submit button that you want the user to press after he/she has inputed the password. Give it these actions:

on (press) {
if(_root.pass=="password") {
gotoAndPlay (2);
}else {
gotoAndPlay (3);
}
}

Remember, you can change on (press) to on (release). To change the password from "password" to what ever you want, change password to what ever you want (except numbers) and make sure it's between the quotes. You can also change 2 and 3 to whatever frame numbers you want. If you want a number password, remove the quotes around password and add a number. Test your movie and you will see that you can enter your password and it will take you to frame 2. The else statement is basically saying that if the password is wrong, it will go to the "wrong frame". Oh, if you don't want people to cheat your password, add this code on the first frame of the main timeline:

Stage.showMenu=false;

That will disable the right-click options from your movie. I hope this helps you with your future games/movies!

Response to AS: Password 2005-06-29 22:05:32


Ahh! Error! Change the variable name of "password" to "pass"

Response to AS: Password 2005-06-29 22:10:54


At 6/29/05 10:05 PM, Dancing-Thunder wrote: Ahh! Error! Change the variable name of "password" to "pass"

You mean:

on (press) {
if(_root.password=="PIE_IS_NICE") {
gotoAndPlay (2);
}else {
gotoAndPlay (3);
}
}


- - Flash - Music - Images - -

BBS Signature

Response to AS: Password 2005-06-29 22:11:52


At 6/29/05 10:10 PM, Denvish wrote:
At 6/29/05 10:05 PM, Dancing-Thunder wrote: Ahh! Error! Change the variable name of "password" to "pass"
You mean:

on (press) {
if(_root.password=="PIE_IS_NICE") {
gotoAndPlay (2);
}else {
gotoAndPlay (3);
}
}

Either way works, you can change the var name to pass or you can do what you did. XD

Response to AS: Password 2005-06-29 22:30:54


While passwords are nice for games and can be helpful for restricting sections on your site, I wanted to warn everybody not to put any sensitive material behind a Flash password. We all know swfs are easily decompileable, which means all of the passwords are visible to anybody who has internet access and a few minutes. Anyway, the tutorial was good, this was just a friendly reminder to those who didn't already know.

Response to AS: Password 2005-06-30 01:16:15


what about that "protect from import" thing that you can check off...yet another password they'd have to get through...brute forcer ne one? XD

Response to AS: Password 2005-06-30 02:59:56


At 6/29/05 10:30 PM, BleeBlap wrote: We all know swfs are easily decompileable, which means all of the passwords are visible to anybody who has internet access and a few minutes.

Funny you should say that, I found this today. I haven't tried it yet, but it might be the answer to a few Flashers' prayers.


- - Flash - Music - Images - -

BBS Signature

Response to AS: Password 2005-06-30 03:05:43


And the swf can still be viewed? This has to be too good to be true! If I ever actually start publishing my stuff, I think it will give it a go. If anybody else tries it before then, let us all know.

Response to AS: Password 2005-06-30 05:13:44


Dancing thunder,I think you should calm down with your AS: threads and put more effort into them.Look at other people's ASs,Joe,BleeBlap,Denvish,etc..I bet they barely had any caracters left to their posts because they are very explanatory and teaching.
No offence,but I have an impression that your AS thread don't teach anything but a code.
Perhaps there should be rules for making AS threads,this is my idea of a AS thread:

Title

introduction
:blah blah blah

Why and when to use it
:stuff

How to use it
:code and explaantions


BBS Signature

Response to AS: Password 2005-06-30 05:37:24


Here's another password way if you wanna use it...

Paste this to a button next to an input text box for the password enter thingy...

on (release) {
if (lvl3 == "hopskip") {
_root.gotoAndPlay("lvl 3");
}
}

change lvl3 to the variable of your input box,and change "lvl 3" to the frame number or lable for it.Type in hopskip on my second boxing game in the 3rd box and you should be sent to the 3rd lvl :)


wat

Response to AS: Password 2005-06-30 05:38:47


Oh,yours is probably better...mine doesn't have the thing for if your password is wrong.


wat

Response to AS: Password 2005-06-30 05:39:14


At 6/30/05 05:37 AM, WaterBottleClock wrote: on (release) {
if (lvl3 == "hopskip") {
_root.gotoAndPlay("lvl 3");
}
}

Uhh..Dude,it's the same password that Dancing Thunder gave except that it doesn't have the else function...


BBS Signature

Response to AS: Password 2005-06-30 05:42:43


on (press) {
if(_root.pass=="password") {
gotoAndPlay (2);
}else {
gotoAndPlay (3);
}
}

...no,I don't think so.He's got a double gotoAndPlay(); AS.


wat

Response to AS: Password 2005-06-30 07:40:29


now, you're not encrypting your passwords, anyone can decompile your flash and get your top secret passwords out, get the flash cryptography extention and md5 all your passwords and compare them to md5 text.

Response to AS: Password 2005-06-30 07:44:42


At 6/30/05 05:42 AM, WaterBottleClock wrote: ...no,I don't think so.He's got a double gotoAndPlay(); AS.

No.It's not a "double gotoAndPlay",it's the else function.That;s what I said.
it makes that if the password is NOT pass,it goes to frame number 2.


BBS Signature

Response to AS: Password 2005-06-30 09:40:15


Sorry I made this stupid thread. I will think before I make another one.

Response to AS: Password 2005-06-30 09:43:35


At 6/29/05 10:10 PM, Denvish wrote: some code

just a small meaningless fix

on (press) {
if(_root.password === "PIE_IS_NICE") {
gotoAndPlay (2);
}else {
gotoAndPlay (3);
}
}

and while I'm at it

on(press){
gotoAndPlay(2+(_root.password === "PIE_IS_NICE"));
}

1 line ;)

Response to AS: Password 2005-06-30 09:44:47


At 6/30/05 07:40 AM, Inglor wrote: now, you're not encrypting your passwords, anyone can decompile your flash and get your top secret passwords out, get the flash cryptography extention and md5 all your passwords and compare them to md5 text.

I'm feeling lazy... link?


- - Flash - Music - Images - -

BBS Signature

Response to AS: Password 2005-06-30 09:48:44


Response to AS: Password 2005-06-30 09:53:09


on(press){
if(Hash.hex_md5(_root.password)=="5d41402abc4b2a76b9719d911017c592"){
trace("omg j00 guessed teh password");
}
}

the password is "hello" here btw

Response to AS: Password 2005-06-30 15:05:32


ok, so i got that mxp file...so wat do you do with it? remember I=new at flash and AS, so i got no idea how to do alot of things...>_<

Response to AS: Password 2005-06-30 15:14:40


double click it or open it with macromedia extention maneger

Response to AS: Password 2005-06-30 17:43:27


Response to AS: Password 2005-07-08 04:00:27


i dont know if you are allowed to ressurect threads but is it possible to put different password possiblities on one thing like if you type in crazymonkies and thats the password for level 1 then is it possible on the same password thing to have a different password u could type in that would take u to level2

sry for the blurred description but plz help and for the ressurection of this thread

Response to AS: Password 2005-07-08 04:22:18


I hate to keep you running around in circles in the AS threads, but the explaination lies within the if / else statement explained here: AS: Conditions and Loops.

Response to AS: Password 2005-07-08 04:35:37


At 7/8/05 04:00 AM, redarmy1 wrote: i dont know if you are allowed to ressurect threads but is it possible to put different password possiblities on one thing like if you type in crazymonkies and thats the password for level 1 then is it possible on the same password thing to have a different password u could type in that would take u to level2

Sure. Adaptation of Thunder's code (input text box has the VAR: "PIE")

on (press) {
if(_root.PIE=="password1"){
gotoAndPlay(2);
}else if(_root.PIE=="password2"){
gotoAndPlay(3);
}else if(_root.PIE=="password3"){
gotoAndPlay(4);
}else{
gotoAndStop(1);
}
}

Alternatively, you could use an array to hold passwords. Put this on frame 1:

Password_Array = new Array("password1", "password2", "password3");

Then this on the button:

on(press){
for(i in _root.Password_Array){
if(PIE==_root.Password_Array[i]){
_root.gotoAndStop(i+1); //or whatever
}
}
}


- - Flash - Music - Images - -

BBS Signature

Response to AS: Password 2005-08-19 14:15:32


HM... U see errors.
Wow, I thode that peoples knows this...I will have to put it to my tutorial(next one).

Response to AS: Password 2005-08-27 20:09:45


when i write in my password i only want too see stars like this: ****** so ppl cant see what im writing... how do i do this?

Response to AS: Password 2005-08-27 20:12:11


How do you put it to input text format?


British Columbians: Speak out against the new meal tax or you'll be paying 7% tax on top of the 5% you already pay. http://www2.nomealtax.ca/

Response to AS: Password 2005-08-27 20:13:47


it wasnt too hard only chose password on propeties