You guys can help me find where I made the mistake?

Hi guys...

I work in two different settings, where in one of them I a user input field and also I have a button that takes me to the next section.

In the next section, I have the outlet box, but I'm not there what I typed in that entry.

Any help?

That's what I have:

FRAMEWORK 1

import flash.utils.Timer;

import flash.events.TimerEvent;

import flash.text.Font;

import flash.text.FontStyle.

import flash.text.FontType;

to import flash.display.SimpleButton;

var txt_inp:TextField = new TextField();

txt_inp.x = 20;

txt_inp.y = 700;

txt_inp. Width = 400;

txt_inp. Height = 50;

txt_inp. Restrict = '0-9 a - z A - Z';

txt_inp.maxChars = 28;

var myText:String = "type your name here / Escriba su number aqui";

var format: TextFormat = new TextFormat();

format.font = "CooperBlack."

format.size = 20;

txt_inp.defaultTextFormat = format;

var ok: Ok = new Ok();

captureText();

function captureText (): void

{

txt_inp.type = TextFieldType.INPUT;

txt_inp. Background = true;

addChild (txt_inp);

txt_inp. Text = myText;

txt_inp.addEventListener (TextEvent.TEXT_INPUT, textInputCapture);

}

function textInputCapture(event:TextEvent):void

{

OK.x = 450;

OK.y = 720;

OK. Width = 80

OK. Height = 80;

addChild (ok);

}

var str:String = txt_inp.text;

ok.addEventListener (MouseEvent.CLICK, toGameOver);

function toGameOver (e:MouseEvent): void {}

ok.removeEventListener (MouseEvent.CLICK, toGameOver)

gotoAndStop (5);

}

FRAME 2

removeChild (ok);

removeChild (txt_inp);

var myOutputBox:TextField = new TextField();

var GOver:gameOver = new gameOver();

GOver.x = 300;

GOver.y = 337,85;

GOver.width = 1500;

GOver.height = 1000;

myOutputBox.x = 420;

myOutputBox.y = 700;

myOutputBox.width = 400;

myOutputBox.height = 50;

myOutputBox.defaultTextFormat = format;

addChild (GOver);

createOutputBox (str);

function createOutputBox(str:String):void

{

myOutputBox.background = true;

myOutputBox.x = 200;

addChild (myOutputBox);

myOutputBox.text = str;

}

Thank you very much!!!

You need to consider when you set the value of str...

var str:String = txt_inp.text;

The way in which you have indicated as, it will affect the nothing that is in the textfield object, as this line will run before any text is affected.

You want to make this assignment after the text in the textfield changes.  You should always declare the variable outside of any function so that it can be available to the framework both in terms of scope, but the assignment must take place in your textInputCapture function.

Also, using the event TextEvent.TEXT_INPUT will probably miss the mark as well because it will raise until the text is changed in the textfield, which will result in the text was missing the last character entered.  You must instead use the Event.CHANGE event.

Tags: Adobe Animate

Similar Questions

Maybe you are looking for

  • 9.2 messages will not send any messages on MacBook

    I am running OS X El Capitan version 10.11.6 on a MacBook Pro 15 "retina (mid-2015) with 9.2 Messages. I also have an iPhone running iOS 10.0.1 6. A few days ago, I got an alert that someone had logged on to iMessage on iPhone 4S that I didn't own. I

  • Dead button, mini home iPad does not

    I left my mini ipad charging for a whole day yesterday and was just dead when I arrived home (connected at about 07:30, got home around 22:00). I tried locking push button and the "home" button and went into account before that, my home button works

  • How to uninstall windows powershell in vista

    I'm trying to fix my computer and the cd said I need to uninstall windows powershell.  I don't know what it is.  Can you help me to unintall Vista Home premium?

  • How to identify which windows is my serial number?

    I lost my HD and bought a new.I have the license in my computer, I have the number but where I say which windows is erased (vanished).Have I not any place can I put my serial number and tell me what windows is? See you soon

  • your opinion on the use of auto lab to lab configuration vsphere5.5?

    http://www.vhersey.com/2014/03/autolab-with-vSphere-5-5-support/all negative to set up automatic lab for hands-on lab for VCP5 vsphere5.5?