Link to home
Start Free TrialLog in
Avatar of gikicikmaz
gikicikmaz

asked on

Basic Flash page that can store 20 name in array without using database

Hi everyone,

I have to create a Flash page and put inside user Id  and password label, text box and button.

The user name and password will check in Flash without using any database or asp page. I want to store 20 name and password in flash array. And when user enters their information FLASH try to check if user id and password correct.

I want to use 20 array and each array must hold user name and password.I do know how to do in C++ and VB but I am too new in Flash.

Example 01_LoginArray(1) If flash array starts from element 0 then element 0 holds user id for 01_LoginArray(1) and element 1 holds the password.

Then we will use (for next) loop to check the all 20 array and see if we success.

If we not success we must shows Denied Access in flash and that user try again or show links for previous html page or (home page in html), and
if we success we must show flash page that has 10 links inside and user selects any link and download the document in zip file.

I saw too many *.fla file but nothing satisfy me. I decide to do like in above.
In this way some server that do not support any script and asp page
can use above solution that provide home user to publish their web site.

This is my home work. I know this is not the westand we dont have enough resorcues such as telefeon connection or high speed access. We still use 33.6 and 56kbs access and we have few australian server. They are old and donot support script to run in their server.

I hope you can help me (us). If you send me solution with clear understanding documentation we will be glad.

Thank you very much.
Giki Cikmaz
gikicikmaz@yahoo.co.uk
Avatar of ocgstyles
ocgstyles

I made a quick FLA as an example:

http://www.elementfixe.net/ee/pw.fla

Here is the code:

usernames = new Array("user1", "user2", "user3", "user4", "user5");
passwords = new Array("pw1", "pw2", "pw3", "pw4", "pw5");
success = false;

function checkLogon(){
     for(i in usernames){
          if(username == usernames[i] && password == passwords[i]){
               success = true;
          }
     }
     if(success){
          gotoAndStop("success");
     }else{
          gotoAndStop("failed");
     }
}
stop();

//the button has the script
on(press, keyPress"<Enter>"){
   checkLogon();
}



So what this does is, make an array of names and an array of passwords.  The index for names corresponds with the correct password in the passwords array.  i create a variable "success" to check if there was a match.

the checklogon function will go iterate through the entire length of the usernames array.  At each iteration, it will check to see if that value you gave for username and password, is equivalent to ones that are in the arrays.  if a match is found, success is now true.

at the end of the function, the value of success is evaluated.  if true, it sends you the the frame labeled success, otherwise to the frame labeled "failed"

enjoy.

-styles

Avatar of gikicikmaz

ASKER

Thank you.

I will try first the link you provide.
I must say I don not anything flash and scares me more than C++. It's good job you did.

But I must use 15 characters name and password for security. Otherwise one Id can much in any one on 20 Id in aray.

My thinking was bit complex. I want to do 20 array and each array holds 2 element. In thgis way I can narrow the security issue.

But I am going to try your one now. It was qucik response and I am thankfull to you.

Regards,
Giki Cikmaz
C++ scares me more than flash! :)

I just coded 5 names above for simplicity.  You can add as many more names as you want.  It sounds like you are trying to use multi-dimensional arrays, which I don't think Flash supports, directly.  maybe you can construct your own in flash, (???) but i never tried.....

you can make 20 arrays if you wanted, but the looping would be so much more difficult and time consuming to code.  if that is definitly the way you want to go, let me know and i can write something up for you.

-styles
it didn't take as long as i thought, just more of a pain to create all the extra arrays, download the FLA and take a look.....

http://www.elementfixe.net/ee/pwv2.fla

enjoy

-styles
Thank you very much. I will download second *.fla.
I try the first one and it was good. Second one will be more secure than first one.

My problem is I fell so alien to Flash Layout. Accesing action part and see script is not much different than the other language. But Flash seems more complex. I had download some study material but I guess I need Visual Learning tool for Flash.

Now my problem is in the success section I want to add link for zip file.

Say If I compile this project and put it in html and upload the remote server that publish the web site, I want user to access the page after succesful log in and success page will provide up to 20 link. And each link calls zip file that user can download.

Example I have a document about part of the C++ code and I put it in zip file. The user when they need that code they will access the web site, enters the right page that flash file is publish and use the flash to Log In and if succesfull they will see succesful page that contains example: (pointer-array in C++).zip
and few more.

Now I know I have to convert the text label to button. But what kind of acction I must add that fires the action to download the zipfile.

I check the fscommand but wasn't helpful at all. Can you send me the action that shows the how to download the zip file.

Thank you very much for all your kind experties.

Regards,
Giki Cikmaz
Wowwww!

Second one was PERFECT. And after I see code I think i am going to love the Flash Action. Second code was same as MS C++. And already replace the first one.

I try to increase the points to 100 but I didn't have enough point to do that.

I will complete rest of the array, and it is more secure than before. Thank you very much. It was quick response and Perfect answer.

Thank you.

Regards,
Giki Cikmaz

//attach this to a button
on(press){
  getURL("myZipFile.zip");
}


when you press the button, it would call your default application for the ZIP filetype.  getURL is commonly used to open new browser windows with a URL, but it works for other file types too.

-styles
my pleasure! =)
Thank you it was greate exprience for me to get quick response and perfect answere about Flash.

Thank you very much.
Regards,
Giki Cikmaz
ASKER CERTIFIED SOLUTION
Avatar of ocgstyles
ocgstyles

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Quick response and Perfect solution. Makes me to love Flash :))))

Best Regards
Giki Cikmaz