Solved

listener not working past first frame

Posted on 2006-06-19
11
146 Views
Last Modified: 2010-04-03
I have a movie that is working with the sole exception of a password field.  The code works fine if you just enter the first frame that the password field is created.  The movie is set up where the user can enter at multiple points.  When that happens, the password field doesn't work.  I think that it is the listener, but can't figure out how to fix it.  Here is the code I have on the frames that the password field exists:

//form = new Object();
//lo = new Object();
windowListener = new Object();
password_listener = new Object();


form.focusOut = function(eventObject){
     var password:String = eventObject.target.text;
     if (mypassword.text == "popsicle" || mypassword.text == "cfd901" || mypassword.text == "hgi367" || mypassword.text == "yec820" || mypassword.text == "qmn274" || mypassword.text == "luv580" || mypassword.text == "wdf289" || mypassword.text == "hvl490" || mypassword.text == "iyb954" || mypassword.text == "mnr431" || mypassword.text == "toy671" || mypassword.text == "red396" || mypassword.text == "ams682" || mypassword.text == "web219" || mypassword.text == "agh413" || mypassword.text == "mwn765" )
     {            //if the password is ok
          trace("Passsword '" + password + "' is ok");
              _global.greenlight = "OK";
              trace(greenlight);
       }
     else
     {            // if the password is wrong
                 trace("Password '" + mypassword.text + "' is wrong");
                  myWindow = mx.managers.PopUpManager.createPopUp(_root,mx.containers.Window, true, {title:"Incorrect Password", closeButton: true});
                  myWindow.setSize(175,70);
                  myWindow.move(myWindow.x + 300, myWindow.y + 200);
                  windowListener.click = function(evt){_root.myWindow.deletePopUp()}
                  myWindow.addEventListener("click", windowListener);
         
     }
      trace(greenlight);
};
mypassword.addEventListener("focusOut", form);
password = mypassword.text;
stop();

500 points because this is urgent!!!!!!!
0
Comment
Question by:prostang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16939032
Hi,

two issues, I found. and as I fixed it, I found all working fine..

1.
uncomment following line
--------
//form = new Object();
----------

as you are using form object as listner, but it is not defined..
 so it should be there as
---------
form = new Object();
---------

2.
focusOut works only with Flash components, not with normal textField...
if you would use textInput instance for password, it will work fine

just add an instance of textInput component and assign instance name as "mypassword"
remove the normal textfield, if you have any.


Rgds
Aneesh
0
 

Author Comment

by:prostang
ID: 16939507
I am using a component.  I uncommented the form object command and published the swf.  Still not working.
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16939519
there is definitely something which u are missing here to mention..

i request if you can upload the source File for reviewing

you can use http://www.yousendit.com to upload your file

0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:prostang
ID: 16939585
uploaded.
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16939852
Got the issue..

you need to put above code on frame 11.
on selection of radio button "user" movie stops at frame 11, here this code should be placed.

I tested it and code works fine....


Rgds
Aneesh
0
 

Author Comment

by:prostang
ID: 16942040
that solution works for the user side, but doesn't work for Projects>Move or archive or unarchive.  I tried placing that code on the application layer and the secondary layer.  Neither of those worked.
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 500 total points
ID: 16942130
as you select user radio button, it directly moves to frame 11..

code inbetween fram2 to frame 10 does not run at all...

that code must be executed to work and while execution all related objects should be available at that frame..

if we execute this code frame 11 it works fine..

please confirm that does it run properly if you move the code frame 11?

If not, I can also send you the updated file..
0
 

Author Comment

by:prostang
ID: 16942143
OK.  got it to work by copying the code to frames 9 & 10, where the archive and unarchive are, but this presents a issue should I have to change passwords....
0
 

Author Comment

by:prostang
ID: 16956004
This to me is a work around and not a solution.  The listener was just copied (along with the other code) to three other frames.  I would like to have the listener work on a more global level.
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16956427
you have to attach listener to a textField, and the code can be written on a frame where textField exists.

and code should also be executed to work...


ok, if you want to write code on only once, you should write it on frame 1, and frame one should also have textInput component with instance name "mypassword"
and you would have to keep the instance alive on each frame, then your code will work for all frames.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

717 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