This content has been marked as final.
Show 29 replies
-
1. website security actionscript
elearningdiva May 30, 2007 1:09 PM (in response to mich75)Can you try something like this that tells it where to go?
on (release, keyPress "<Enter>") {
nextFrameAndPlay();
Username = "";
Password = "";
}
-
2. website security actionscript
Damon Edwards May 30, 2007 1:11 PM (in response to mich75)instead of nextframe(); use, gotoAndStop(2); or gotoAndPlay(2);
edit: you are missing an opening curly bracket as well after "else" -
3. Re: website security actionscript
mich75 May 30, 2007 1:46 PM (in response to mich75)Thanks for responding.
I tried nextFrameAndPlay, gotoAndStop(2) andgotoAndPlay(2) but every time I press enter it just clears the text boxes that I am typing into. Is there anything else you can suggest. This doesn't seem like it should be a difficult thing to do!
Thanks again. -
4. Re: website security actionscript
elearningdiva May 30, 2007 2:09 PM (in response to mich75)try this:
if ((Username+Password).toLowerCase() == "myUsername" + "myPassword") {
gotoAndStop(2);
} else {
gotoAndStop(1);
} -
5. Re: website security actionscript
kglad May 30, 2007 3:08 PM (in response to mich75)none of the code in this thread is correct or moving towards a resolution of the issue. the problem is the if-statement. it's incorrect.
using nextFrame() is fine (as long as it's attached to a true button and NOT a movieclip button).
first, where are the variables Username and Password defined and what are they supposed to be in order to be qualified by your if-statement? -
6. Re: website security actionscript
mich75 May 30, 2007 3:28 PM (in response to mich75)My Username and Password are defined in the properties window as variables.
Thank you for your response. I am a relatively new flash user and am feeling a little frustrated! -
7. Re: website security actionscript
kglad May 30, 2007 4:48 PM (in response to mich75)well, how does a user change their values?
and "...what are they supposed to be in order to be qualified by your if-statement? " -
8. Re: website security actionscript
mich75 May 30, 2007 5:27 PM (in response to mich75)I guess this is where I am a bit confused. I basically used a tutorial that I found off the net so I am unsure about a few things. It said to set the variables in the properties window as "Username" and "Password", other than that everything is defined in the actionscript that I entered above. The user is given the Username and Password, "myUsername" and "myPassword". There are text boxes that I have set as the variables Username and Password and that is where "myUsername" and "myPassword" are to be entered.
I hope I have clarified things a bit.
I appreciate your help! -
9. Re: website security actionscript
kglad May 30, 2007 9:38 PM (in response to mich75)yes, that clarified things. you have 2 input textfields one with associated variable Username and the other with associated variable Password. and you expect the user to enter "myUsername" and "myPassword" in the appropriate textfields.
in that case you would use:
-
10. Re: website security actionscript
mich75 May 30, 2007 10:09 PM (in response to mich75)kglad,
I tried to enter the code:
on (release, keyPress "<Enter>") {
if (Username.toLowerCase()=="myusername&&Password.toLowerCase()=="mypassword") {
nextframe();
} else {
stop();
}
and I received the following error messages:
**Error** Scene=Scene 1, layer=enter button, frame=1:Line 3: ')' expected
(Username.toLowerCase()=="muUsername&&Password.toLowerCase()=="myPassword") {
**Error** Scene=Scene 1, layer=enter button, frame=1:Line 4: Syntax error.
nextframe();
**Error** Scene=Scene 1, layer=enter button, frame=1:Line 5: 'else' encountered without matching 'if'
} else {
Total ActionScript Errors: 3 Reported Errors: 3
I have tried a number of things to try and fix this, but it doesn't seem to work. Any suggestions?
Again, thank you so much for your help! -
11. Re: website security actionscript
kglad May 31, 2007 6:27 AM (in response to mich75)copy one of the code blocks that i gave above and paste that into your actions panel. -
12. Re: website security actionscript
mich75 May 31, 2007 8:41 AM (in response to mich75)I tried to cut and paste the code that you gave me but I still receive the same error messages. The words: Username and myPassword are highlighted in black and everything else (other than a few brackets) is highlighted in either green or blue. Does this mean anything?
Thanks! -
13. Re: website security actionscript
kglad May 31, 2007 8:47 AM (in response to mich75)copy the code in your fla and paste it into this forum using the attach code option. -
14. Re: website security actionscript
mich75 May 31, 2007 9:35 AM (in response to kglad)Here is the code from my fla.
Thanks.
-
15. Re: website security actionscript
mich75 May 31, 2007 9:37 AM (in response to mich75)When I view the code online it doesn't show the { after "myPassword"), but I do have one there.
Thanks. -
16. Re: website security actionscript
kglad May 31, 2007 9:48 AM (in response to mich75)that's not the code i posted in any of the 3 blocks that i suggested.
post a link to your fla -
17. Re: website security actionscript
mich75 May 31, 2007 10:04 AM (in response to kglad)The following code is the last suggested code that you posted for me. The only thing I changed is that I added a stop action near the end.
Here it is again.
Thanks!
-
18. Re: website security actionscript
kglad May 31, 2007 10:10 AM (in response to mich75)you're either not copying and pasting or you're seeing a message that's not currently on this forum.
in either case, post a link to your fla. -
19. Re: website security actionscript
mich75 May 31, 2007 10:51 AM (in response to kglad)I haven't uploaded my fla anywhere yet, I am still working on it on my own system. Is there a way to attach a flash file to the forum? Probably not I suspect.
I appreciate all of your help. I'll understand if you want to give up on me!
Thanks again. -
20. Re: website security actionscript
kglad May 31, 2007 11:35 AM (in response to mich75)no, you can't attach a file to this forum.
if you don't have a server you can use, there are free ones that let you upload files. geocities is one. there are others that you can find using google. -
21. Re: website security actionscript
vDiaz761 May 31, 2007 11:53 AM (in response to kglad)The problem is that you are missing a quote when testing comparing the strings. Also, you are not calling the text property of the text box.
You should have two text boxes and a button. Name them as follow:
button = "btn"
username field = "username"
password = "passwordbox"
Now add this to your your timeline:
Hope this helps
-
22. Re: website security actionscript
mich75 May 31, 2007 2:52 PM (in response to vDiaz761)I tried the code suggested in the last post but I had problems making it work, I kept getting error messages about the mouseevent.
I thought I would try something different. In the attached code when I type in the username and password it directs me to frame 2 but I can also type in anything else and get to frame 2 as well. Do I need a better else statement? I'm not sure what to add to the code to remedy this. Any suggestions?
Thanks! -
23. Re: website security actionscript
kglad May 31, 2007 3:08 PM (in response to mich75)now remove the 2nd and 3rd lines (var name... and var password...) and retest. -
24. Re: website security actionscript
mich75 May 31, 2007 3:20 PM (in response to kglad)after removing the second and third lines, var name etc var pass etc. nothing happens. I can type in the username and password but when I press enter nothing happens. -
25. Re: website security actionscript
kglad May 31, 2007 3:32 PM (in response to mich75)then your textfields don't have associated variables name and password.
click on an empty part of the stage and then click on the textfield that should contain the user's name. in the properties panel in the variable variable field type "name" without quotes. similarly for your password textfield. retest, -
26. Re: website security actionscript
mich75 May 31, 2007 3:42 PM (in response to kglad)Thanks for your response.
I already had the variables defined in the properties panel as name and password. I'm not sure why this isn't working. The only way that I can get the fla to go to the next frame is to define the variables name and password with their actual meanings in the code like I did originally. Do I need to give the textfields an instance name as well, or am I way off.
Thanks -
27. Re: website security actionscript
kglad May 31, 2007 3:51 PM (in response to mich75)you don't need both an instance name and associated variable. using an instance name is better than using the variable, though.
is your button a true button or a movieclip button? -
28. Re: website security actionscript
mich75 May 31, 2007 4:19 PM (in response to kglad)My button is a true button, not a movieclip button. Should it be a movieclip button?
Thanks. -
29. Re: website security actionscript
kglad May 31, 2007 6:22 PM (in response to mich75)no, a true button is fine. but your textfields are either, not on the same timeline as your button, or you have not labeled those textfields as you reported.