PDA

View Full Version : [Q] FlashLite2 : Inline TextField by Richard Leggett...


CyanBlue
07-06-2006, 05:12 PM
Hi... :)

I have found Richard's inline textField component and love using it... Thanks, Richard... :)

http://richardleggett.co.uk/blog/index.php/2006/02/21/flash_lite_2_0_inline_textfield

I have gotten into a weird problem today though...
The problem happens when I am attaching the inlineTextField movieClip onto the stage second time...

Here is a code that can explain where the problem is...
(Or download the attached sample zip file)
function attachITF()
{
trace("Function attachITF this = " + this);
this.itf.removeMovieClip();
this.attachMovie("InlineTextField", "itf", 1111, {_x:25, _y:35});
this.itf.setFocus(true);
}

function setKeys()
{
trace("Function setKeys this = " + this);
fscommand2("FullScreen", true);
fscommand2("SetSoftKeys", "", "");
var keyPadListener:Object = new Object();
keyPadListener.onKeyDown = function()
{
// trace("\tKey.getCode() = " + Key.getCode());
switch (Key.getCode())
{
case 33 :
case ExtendedKey.SOFT1 :
trace("left soft key");
attachITF();
break;
}
}
Key.addListener(keyPadListener);
}

setKeys();
attachITF();
Everything works fine first time... I press '2' key four times, and it goes through a, b, c, 2 sequence just fine...
I get to remove the textField when I press on the Soft1 key and recrete it... It does replace the textField visually...
If I press '2' key this time, it only goes through b, 2, b, 2, b, 2...
If I refresh the textField and press '2' key again, it now goes through c, b, a, 2 sequence...
If I refresh the textField again, I am stuck with 2 this time...
If I refresh the textField one more time, it is back to normal a, b, c, 2 sequence...

I am still living in AS1 realm so I am not really comfortable going into the AS file unless I really have to... :(
Does anybody know why it is happening and how I can fix this problem???

Oh, I'm using FlashLite2/ActionScript 2.0 setting...

Thanks... :)