12-28-2010 05:40 PM - edited 12-28-2010 05:40 PM
I've been trying so hard to move the location of a multiline TextInput's 'prompt' textField.
I tried tinkering with y, matrix, scrollRect.. But it is stubbornly stuck in the middle. I am trying to move it so that it shows up in the top area of the TextInput, instead of middle. Any ideas?
12-28-2010 06:08 PM
hey,
to fix that problem do the following:
var myInput:TextInput = new TextInput();
(...)
myInput.getChildAt(2).y = 10;
that should do the trick. good luck!
12-28-2010 07:24 PM
12-28-2010 07:38 PM
hey,
it should work. it worked on my end without a hitch. here's the exact code i used to test it:
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.geom.Rectangle;
import flash.text.TextFieldAutoSize;
import qnx.ui.text.TextInput;
[SWF(width="1024",height="600",backgroundColor="#6 66666",frameRate="30")]
public class TextInputTest extends Sprite
{
private var myInput:TextInput;
public function TextInputTest()
{
super();
// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
myInput = new TextInput();
myInput.setSize(300,200);
myInput.prompt = "Insert some comments here...";
myInput.setPosition(10,10);
myInput.autoSize = TextFieldAutoSize.LEFT;
myInput.textField.scrollRect = new Rectangle(-10,-10,290,190);
myInput.textField.wordWrap = true;
myInput.textField.multiline = true;
myInput.getChildAt(2).y = 10;
addChild(myInput);
}
}
}
and here are the screen shots showing the out put on both the AIR Desktop debugger and the Simulator:
AIR Desktop:
Simulator:
the screen shots i posted will take some time to show up (pending approval from a moderator). but for now run the code i posted above and see if you get the same result i did. there should be a prompt that reads "insert comments here..." when you compile and run it.
also what is the rest of your code? maybe you are doing soemthing different with your TextInput that is changing the order of children within the TextInput object. hope this helps. good luck!
12-28-2010 09:44 PM - edited 12-28-2010 09:53 PM
I finally figured out was causing my problem.
Changing the width or height of the TextInput resets the y position of the prompt textField! I never suspected width would have affected the vertical position of the prompt Textfield ![]()