PDA

View Full Version : Button to make input text into symbol


griswol6
12-02-2010, 05:34 PM
Hello,
I am trying to make a magnetic poetry board for a class. Instead of having people just use the words I chose for them, I want them to be able to input their own text and than re-arrange it on the screen to make a poem.

I figured the best way to do this would be to have a text input box, and do a on(release) to make the input text into a symbol that they can manipulate?

can anyone help me out with the script to do this? or if there is a better way to do it, I would appreciate any help! Thanks everyone, im new to flash so any help/suggestions are appreciated.

Noct
12-02-2010, 07:50 PM
Welcome aboard,

Try this:

function typeDrag():Void {
//When the user clicks the stage
this.onMouseDown = function():Void {
//Store next depth
var nD:Number = this.getNextHighestDepth();
//Create container clip
var tH:MovieClip = this.createEmptyMovieClip("tf"+String(nD), nD);
//Create textField
var tF:TextField = tH.createTextField("inpText", 0, this._xmouse, this._ymouse, 50, 50);
tF.type = "input";
tF.autoSize = true;
//Overwrite mouseDown event
this.onMouseDown = function():Void {
//Kill text select/input
tF.selectable = false;
//When the field is clicked
tH.onPress = function():Void {
//Drag it
this.startDrag();
delete this.onPress;
};
//When the text is released
tH.onRelease = function():Void {
//Stop dragging it
this.stopDrag();
delete this.onRelease;
//Start Over again
typeDrag();
};
};
};
}
//Call Method
typeDrag();