r/actionscript • u/Noel9386 • Apr 29 '20
Using InputText as a function parameter?
Hello,
I am pretty new to actionscript and don't really get flash but am having to learn it for legacy stuff at work. I am currently stuck trying to optimize some functions for easier use down the line.
I am trying to pass some InputText (Classic Text > input Text) as a parameter of a function. I need to be able to set its selectability as well as check its text contents.
I am currently doing
var inputField1;
var inputField2;
DoSomething(inputField:TextInput)
{
inputField.text = "blah blah blah";
inputField.selectable = false;
}
DoSomething(inputField1);
but I get an error saying that the type doesn't exist or isn't compile time constant when I go to publish it.
Is there anyway to do what I am trying to do?
The original code was written in 2013 or before that, and each slide had the code modified to account for each different inputField.
View all comments
Show parent comment
1
u/Routerbox Apr 29 '20
Also, there are many different TextInput classes depending on if you're in flex (flash builder) or Flash itself, and what version.
Flex 3.x https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/TextInput.html
Flex 4.x https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/TextInput.html