Skip to content Skip to sidebar Skip to footer

Swiffy Input Textfield Workaround

I'm a noob to this forum and a noob to javascript, but I know a fair share of as3. So swiffy doesn't support input text-fields. I thought that a workaround would be to call a javas

Solution 1:

Thanx to your anwser and using the code you posted I made another working demo for a flash file in actionscript 2, to interchange data between swiffy and javascript (in and out).

Here are the steps:

1) The key is to send the value to the swiffy object with this line in javascript:

function sendValue() { myValue=inputFieldName.value; stage.setFlashVars('myMessageFromTextfield='+myValue); }

2) Then, inside the fla file, in actionscript2, get the value:

getValue = function() { if(_level0.myMessageFromTextfield == "undefined" || _level0.myMessageFromTextfield == undefined) { this.cat.animCat.myText.text = ""; } else { this.cat.animCat.myText.text = _level0.myMessageFromTextfield; returnButton._visible = true; } }

3) We need to constantly monitor when te data apears so use a setInterval:

myInterval = setInterval(this, "getValue", 100);

4) Now, to send the value back to html file, we use getURL with the data attached:

returnButton.onRelease = function() { getURL("Javascript:showMessage('"+_level0.myMessageFromTextfield+" says the cat');"); }

5) And finally, again in javascript inside the html we execute the function with the parameter:

function showMessage(message) { alert(message); }

It works perfectly in IE, Firefox, Chrome, safari (ios).

So now we can send text in ipad or iphone.

I attached the source files in the next link:

https://onedrive.live.com/redir?resid=E64343A7ADE7D670!1401&authkey=!AO86aUEdyZRqQN4&ithint=file%2czip


Post a Comment for "Swiffy Input Textfield Workaround"