-
KeyPress "<Enter>" VS Flash Component
Hi guys, i have a little silly problem that make me quite confuse..
I made a login movieclip that assign an input text (as a password) n a button to execute with onRelease n KeyPress Enter function.
It work well firstly. Button will execute the password whether i click it, or press Enter Key. The problem came when i insert a flash component into the scene or just into the library. The KeyPress "<Enter>" doesn't work anymore. SO i press the Enter key, n nothing happened. It seems that keyPress Enter didn't recognice anymore.
KeyPress "<Enter>" will work again after i delete component from library.
Please someone can check my fla Keypress.zip. So that i know, is it my adobe flash gone wrong, or it's just script problem.
I used Adobe Flash CS3, AS2
Thx in advance
-
I briefly explored components until I heard and learned that components are better to be avoided. They typically really screw with all kinds of things.
-
.
Hi,
you should remove the code ferom the button and try something more like so.
put the code on the main timeline.
PHP Code:
var keyListener = new Object(); keyListener.onKeyDown = function() { if (Key.isDown(Key.ENTER)) { checkPass(); } }; Key.addListener(keyListener);
login_mc.ok_btn.onPress = function() { checkPass(); };
function checkPass() { if (login_mc.inputPass == "123") { login_mc.display = "Right"; } else { login_mc.display = "Wrong"; } }
you may need to diasbale keyboard shortcuts in test mode, try it and see.
There is nothing wrong with components really if you use them correctly, the AS2 components are far less customisable than AS3 components.
-
Originally Posted by fruitbeard
Hi,
you should remove the code ferom the button and try something more like so.
put the code on the main timeline.
PHP Code:
var keyListener = new Object();
keyListener.onKeyDown = function()
{
if (Key.isDown(Key.ENTER))
{
checkPass();
}
};
Key.addListener(keyListener);
login_mc.ok_btn.onPress = function()
{
checkPass();
};
function checkPass()
{
if (login_mc.inputPass == "123")
{
login_mc.display = "Right";
}
else
{
login_mc.display = "Wrong";
}
}
you may need to diasbale keyboard shortcuts in test mode, try it and see.
There is nothing wrong with components really if you use them correctly, the AS2 components are far less customisable than AS3 components.
Wow... You're the man...
Thanks a lot once again, my friend
-
Originally Posted by swak
I briefly explored components until I heard and learned that components are better to be avoided. They typically really screw with all kinds of things.
When components v2.0 are used, it is recommended to avoid using (getNextHighestDepth()) when attaching movieClips.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|