Author Topic: Flash actionscript Login  (Read 32901 times)

Offline Atari

  • Jr. Member
  • **
  • Posts: 114
  • Gender: Male
  • Hello
    • Old Sk00L Gamers
Flash actionscript Login
« on: August 30, 2004, 11:34:01 PM »

 Not sure if anyone is interested but I've been trying to get a forum login to work from flash and thought I'd post my results. This was done in flash MX . Now I went from flash 3 to MX so not sure if this will work in earlier versions of flash actionscripts  as I only know MX and higher  :P

on (release) {
    formdata = new LoadVars();
    formdata.send("", "_self", "POST");


I used the LoadVars object to submit the login  information to the server. To use the LoadVars, you have to first create an instance of it.

"formData = new LoadVars();"

Then you attach the variables to the instance with the


I made 2 input fields
1st instance named username , linetype = singleline
2nd named password, linetype = password.
And I attached all the code above to a button. And on release it submits all the data to the SMF login script.

If I understand the php part right the login is looking for the variables called user,passwrd,and the cookielength. So when the data is put together it is sent like:


Did I get that right [unknown] ?  :P

I know it works and took me a while to grasp the concept but thought I'd post up to help anyone down the road.

There are 10 kinds of people in this World.
Those who understand Binary and those who don't


  • Guest
Re: Flash actionscript Login
« Reply #1 on: September 03, 2004, 11:23:54 AM »

I will use this :P

Additional infos for install:
Use text field names not vars.
And works atm only with iexplorer not with mozilla ( i still run smf beta 5)

now tsted also under rc1

watch @


ps. Atari i playrtcw! :)
« Last Edit: September 03, 2004, 07:52:51 PM by roboter88 »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Flash actionscript Login
« Reply #2 on: September 03, 2004, 02:06:17 PM »
And works atm only with iexplorer not with mozilla ( i still run smf beta 5)

Why so?



  • Guest
Re: Flash actionscript Login
« Reply #3 on: September 03, 2004, 02:17:51 PM »
I have no clue under mozilla it didnt transfer the submitte data....(i tried session and cookies settings all is allowed)

It s a bug with the cookie session under mozilla and the beta 5.0 ?


with iexplorer it works.....
WITH MOZILLA ALSO┬░!!!!!  omg:

It was i had to clear cash for some reason...

ALL IS GOOD this FLAHS LOGIN roxxors now :) l8r

« Last Edit: September 03, 2004, 02:28:21 PM by roboter88 »


  • Guest
Re: Flash actionscript Login
« Reply #4 on: September 03, 2004, 07:34:40 PM »
Hmmm the code produce a session error.

When i log out doesn t matter if i was online forever or limited.
Then when i click the login button inside flash without entering the right login information SMF shows me logged in but im not....
i think it has something todo with this "cookielength=-1"

I think "-" is the maximum login session time.
So when i try to login back without entering the right login infos it uses the browser cache stored cookie session...

Well it is not the cache its the cookies who are activ till session time exeeding....

I will check this later and report back

« Last Edit: September 03, 2004, 07:38:47 PM by roboter88 »

Offline vern111

  • Semi-Newbie
  • *
  • Posts: 18
  • Gender: Male
    • math games online
Re: Flash actionscript Login
« Reply #5 on: March 02, 2008, 08:36:09 AM »
here's the actionscript 3 version of the Flash Log in script. ALl that is on the screen is a log in button  and two self-descriptive text fields: username_txt and a password_txt.

Code: [Select]

username_txt.border =true;
username_txt.borderColor =0x330033;
password_txt.border =true;
password_txt.borderColor =0x330033;

function sendData(event:MouseEvent):void{
var userName:String = username_txt.text;
var passwor:String= password_txt.text;
var scriptPage:String ="http://yourforumurl /index.php?action=login2";
var request:URLRequest = new URLRequest(scriptPage);
request.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.passwrd= password_txt.text;
variables.user = username_txt.text;
variables.cookielength= -1;'login'; = variables;

var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, handleComplete,false,0,true);

note the  handleComplete() function is a custom function that i use to get info about the user loaded from SMF and the SSI.php file...didn't want to bother confusing this example with some custom stuff i did.
« Last Edit: March 02, 2008, 12:39:57 PM by vern111 »
free math help [nofollow]| Hubalub private tutoring [nofollow]|Math Games [nofollow]

Offline Rumbaar

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,805
  • Gender: Male
  • Inherent Omniscience
Re: Flash actionscript Login
« Reply #6 on: March 04, 2008, 03:35:55 AM »
Thx for updating vern111.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]