Solved

ActionScript - coding

Posted on 2011-03-23
3
202 Views
Last Modified: 2012-05-11
hi experts,

im working on a site using ActionScript2. Im at "Login" section, where i need to read some variables from a .txt file and load them in a movieClip. see the following code:

this.createTextField("hty", 1, 100, 180, 450, 40);
hty.multiline = true;
hty.wordWrap = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.font="Tahoma";
my_fmt.size=14;
my_fmt.bold=true;
my_fmt.color = 0xFFFFFF;
hty.text="Verifying your credentials...";
hty.setTextFormat(my_fmt);
hty._visible=true;

this.createEmptyMovieClip("target_mc", this.getNextHighestDepth());
target_mc.user_activationk = NULL;
target_mc.loadVariables("login.txt");
function checkParamsLoaded()
{
 
 if (target_mc.user_activationk == NULL) 
  {
   target_mc.loadVariables("login.txt");
  }
 else
  {

          //this code create the login result text
          if (target_mc.user_m=="ok" & target_mc.user_p=="ok" & target_mc.user_stts=="activated")
           {
             result="Welcome " + target_mc.user_n + " " + target_mc.user_ln + ".";
             user_loged=true;
           };
          if (target_mc.user_p=="nok")
           {result="Wrong password.";};
          if (target_mc.user_m=="nok")
           {result="You are not registered yet.";};
          
          if (target_mc.user_stts=="verifying" & target_mc.user_m=="ok" & target_mc.user_p=="ok")
           {result="You did not activated your account. Check your emails to activate it.";};

          hty.text=result;
          hty.setTextFormat(my_fmt);
          hty._visible=true;

          clearInterval(param_interval);
  }
}
var param_interval = setInterval(checkParamsLoaded, 100);

target_mc.unLoadMovie();

Open in new window


Basically as long as "target_mc.user_activationk" is NULL the code is still reading the .txt content. The .txt content contains the values of the variables in a query form and the "user_activationk" variable is the last one in the query. Once the reading reach the last variable in the .txt the result is defined in some "if" decision codes and display it on the screen by setting the "hty.text" TextField.

The code works fine at first running, but if i try to run it the second time with different user credentials it shows the first user credentials and then the execution is stopped, the browser cracks.
I suspect the last line doesnt clear the "target_mc" object. Is there any other way to "reset" the content of it?

Any help in this matter will be highly apreciated.

Thank you in advance.
Raul
0
Comment
Question by:raulmonda
  • 2
3 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 35201676
why are you looping this in the interval?
can you upload your file and the txt file.
0
 

Author Comment

by:raulmonda
ID: 35201709
hi,

im not using Fireworks or other adobe soft. Im using Selteco Alligator, which is more or less limited in features. anyway what code i should use to upload the file content?

Regards
Raul
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 500 total points
ID: 35206077
i have no idea what alligator is.
will i be able to open it in flash?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now