How to create the text entry?

I created a table of text input fields class (TextBox) custom.  When the user types something into a text box, I want to compare the expected response (responses: Array).  I can't get the keyPressed function to read the input text.  When I trace box [boxnum] .text, it says "undefined".  What I am doing wrong and how I can fix it?


var box: Array = new Array (6);
responses of the var: Array = ['-36', '-36', '216', ' / 9 "," / 9 "," 24 "];
var boxNum:int = 0;

Sandbox (null);

function setBox(event:Event):void {}
box [boxNum] = new TextBox;
addChild (box [boxNum]);

box [boxNum] .x = 100; box [boxNum] there = 100 +(30*boxNum);
Box [boxNum] .addEventListener (KeyboardEvent.KEY_DOWN, keypressed);
}

function keyPressed(event:KeyboardEvent):void {}
Reply.Text = "";
if(Event.keycode == Keyboard.Enter) {}
var myText:String = box [boxNum] .text;
trace (Box [boxNum]. (Text);
If (myText is {answers [boxNum])}
Reply.Text = 'It.';
boxNum ++;
Sandbox (null);
} else {}
Reply.Text = "try again.";
}
}
}

This is why your code does not work.  your TextBox instances are movieclips and movieclips have no text properties.

If you assign the textfield object that is a child of TextBox and instance name, you can reference the textfield object using the dot notation:

var box: Array = new Array (6);

responses of the var: Array = ['-36', '-36', '216', ' / 9 "," / 9 "," 24 "];

var boxNum:int = 0;

Sandbox (null);

function setBox(event:Event):void {}
box [boxNum] = new TextBox();
addChild (box [boxNum]);

box [boxNum] .x = 100;

box [boxNum] there = 100 +(30*boxNum);
Box [boxNum] .addEventListener (KeyboardEvent.KEY_DOWN, keypressed);
}

function keyPressed(event:KeyboardEvent):void {}
Reply.Text = "";
if(Event.keycode == Keyboard.Enter) {}
var myText:String = box [boxNum].yourtextfield.text;  where yourtextfield is your textfield instance name class' are
trace (MyText);
If (myText is {answers [boxNum])}
Reply.Text = 'It.';
boxNum ++;
Sandbox (null);
} else {}
Reply.Text = "try again.";
}
}
}

Tags: Adobe Animate

Similar Questions

  • How to create the text field that accepts (only Alphabates no numbers or numbers)

    Hey guys,.

    I just want to know how to create a text field that accepts (only text without characters or numbers)?

    I want to insert validation that field only accepts the alphabates no number or numbers are allowed!


    Thanks in advance!

    In the designer, click the field that you need to validate and open the script window, together the menu show drop-down list to validate in the drop-down list and place the code in the script window. Make sure that the language is Javascript and run is defined on the Client. If you don't see the script window goto window-> Script Editor Menu item.

  • How to create the text field?

    I can create symbols on the stage by using the command "sym.createChildSymbol".

    But how can I cretare textFields with script?

    concerning

    Hello

    Well, you can create a text symbol (best solution).

    You can also use jQuery, but you must rewrite properties panel: police, position, width, height...

    One case:

    $('

    a new paragraph

    ')

    .appendTo ("#Stage")

    . CSS ({'position': 'absolute', 'top': '40px', 'left': '40px', 'color': 'blue'});

    You can use other tags:

    ,
    ... See html5 tags.

    With the help of classes.

    $('

    a new paragraph

    ')

    .appendTo ("#Stage")

    . CSS ({'position': 'absolute', 'top': '40px', 'left': '40px'});

    SYM. $(".redText") .css ({'color': 'red', 'background-color': "#EEEEEE"});

    I want to hide this paragraph.

    $("#textField").hide ();

    or

    var myParagraph = $("#textField");

    myParagraph.hide ();

    later:

    myParagraph.css('color','black').show ();

    and so on...

  • How to place the text entry field in the center of the white page

    Hello

    I'm new to ADF, I develop here the ADF login page.

    I am just placing the user name, the field button and login password in the center of the page.

    I tried several page layouts but I do not know how to set the fields in the middle of the page.

    Can someone tell me please how to do?

    Thanks in advance,
    SAN

    THERE'S YOUR ANSWER,
    http://java2go.blogspot.com/2010/12/creating-centered-page-layout-using-ADF.html

  • How to create the text field to work with mathematical applications in Muse?

    How can I create text fields to work with the Muse?

    Example:

    A + B / 20 = C

    What to do with the Muse?

    Even more... I could put it on a mobile app with Muse?

    Hello

    Unfortunately not. But what you can try is to use a certain type of Javascript on your page to Muse and achieve this goal

    A code example can be seen here, example Code snippets | Qualtrics

    Output: online survey software | Survey of Qualtrics Solutions

    Hope this helps

  • How to create a text field containing text/label which can be modified by the end user?

    Hello

    I'm trying to figure out how to create a text field containing text or a label that can be changed by the end user. Can do something like this in LiveCycle?

    Below, I have a text field that contains a question and another text field where the user will enter their answer. Is there a way to allow the end user to change the text of the question, as shown in the example?

    Capture.PNG

    Hello

    If you used a standard text for the 'legend' field you could set the value by default (in the value of the object palette tab) in the legend and the legend of the value None (in the page layout palette).

    Concerning

    Bruce

  • How to validate the number of characters in the text entry box?

    Hello

    I have inserted a text box entry and assigned a variable (UserName). Now, I need to limit the entry of a number, maxinum of 20 characters. In other words, how can I validate the number of characters in the text entry area and provide feedback if it is more than 20 characters?

    I think that you should study the Jim Leichliter widget that allows you to use regular Expressions to validate text input.

  • Text entry boxes: how to align the text

    I'm not loving the certificaate widget in Captivate 5 I decided to create my own background image landscape certificate. I added all the text of the certificate to the image so users only things have to do when the lesson of Captivate viewing is enter their name and the date in the text entry boxes. The problem I have is that I do not see a Format tab where I can line up text as I can for areas of legend. Now the names and dates entered by using the text input boxes are entered as left aligned while the background text on the certificate is centered.

    Any suggestions?

    Thanks in advance!

    Hello

    No possibility of alignment in one TextBox entry, sorry. But why not replace it with TextArea Widget? There you have all the possibilities of formatting and if necessary, can be associated with a variable.

    Lilybiri

  • How to enter text in the text entry box using the virtual keyboard in a flex application

    Re: How to enter text in the text entry box using the virtual keyboard in a flex application

    Hello

    I'm using flash builder 4.

    I designed the virtual keyboard, I have to update the text in the input text permanently area using the virtual keyboard.

    I used the events.i button does a few he's cheating.

    can someone help me tat.

    Thanks in advance.

    I have included my mxml with this program.

    virtualKeyboard. MXML

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:fx s:Application ' http://ns.Adobe.com/MXML/2009 "
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx" minWidth = minHeight = "955" "600" creationComplete = "initfunc ()" >
    < fx:Script >
    <! [CDATA]
    Import mx.controls.Alert;
    private function initfunc (): void
    {
    B1.addEventListener (MouseEvent.Click, HandleEvent);
    B2.addEventListener (MouseEvent.Click, HandleEvent);
    B3.addEventListener (MouseEvent.Click, HandleEvent);
    B4.addEventListener (MouseEvent.Click, HandleEvent);
    B5.addEventListener (MouseEvent.Click, HandleEvent);
    B6.addEventListener (MouseEvent.Click, HandleEvent);
    B7.addEventListener (MouseEvent.Click, HandleEvent);
    B8.addEventListener (MouseEvent.Click, HandleEvent);
    B9.addEventListener (MouseEvent.Click, HandleEvent);
    B10.addEventListener (MouseEvent.Click, HandleEvent);
    B11.addEventListener (MouseEvent.Click, HandleEvent);
    B12.addEventListener (MouseEvent.Click, HandleEvent);
    B13.addEventListener (MouseEvent.Click, HandleEvent);
    B14.addEventListener (MouseEvent.Click, HandleEvent);
    B15.addEventListener (MouseEvent.Click, HandleEvent);
    B16.addEventListener (MouseEvent.Click, HandleEvent);
    B17.addEventListener (MouseEvent.Click, HandleEvent);
    B18.addEventListener (MouseEvent.Click, HandleEvent);
    B19.addEventListener (MouseEvent.Click, HandleEvent);


    B20.addEventListener (MouseEvent.Click, HandleEvent);
    B21.addEventListener (MouseEvent.Click, HandleEvent);
    B22.addEventListener (MouseEvent.Click, HandleEvent);
    B23.addEventListener (MouseEvent.Click, HandleEvent);
    B24.addEventListener (MouseEvent.Click, HandleEvent);
    B25.addEventListener (MouseEvent.Click, HandleEvent);
    B26.addEventListener (MouseEvent.Click, HandleEvent);
    B27.addEventListener (MouseEvent.Click, HandleEvent);
    B28.addEventListener (MouseEvent.Click, HandleEvent);
    B29.addEventListener (MouseEvent.Click, HandleEvent);
    B30.addEventListener (MouseEvent.Click, HandleEvent);
    B31.addEventListener (MouseEvent.Click, HandleEvent);
    B32.addEventListener (MouseEvent.Click, HandleEvent);
    B33.addEventListener (MouseEvent.Click, HandleEvent);
    B34.addEventListener (MouseEvent.Click, HandleEvent);
    B35.addEventListener (MouseEvent.Click, HandleEvent);
    B36.addEventListener (MouseEvent.Click, HandleEvent);
    B37.addEventListener (MouseEvent.Click, HandleEvent);
    B38.addEventListener (MouseEvent.Click, HandleEvent);
    B39.addEventListener (MouseEvent.Click, HandleEvent);
    B40.addEventListener (MouseEvent.Click, HandleEvent);
    B41.addEventListener (MouseEvent.Click, HandleEvent);
    B42.addEventListener (MouseEvent.Click, HandleEvent);
    B43.addEventListener (MouseEvent.Click, HandleEvent);
    B44.addEventListener (MouseEvent.Click, HandleEvent);
    B45.addEventListener (MouseEvent.Click, HandleEvent);
    B46.addEventListener (MouseEvent.Click, HandleEvent);
    B47.addEventListener (MouseEvent.Click, HandleEvent);
    B48.addEventListener (MouseEvent.Click, HandleEvent);
    B49.addEventListener (MouseEvent.Click, HandleEvent);
    B50.addEventListener (MouseEvent.Click, HandleEvent);
    B51.addEventListener (MouseEvent.Click, HandleEvent);
    B52.addEventListener (MouseEvent.Click, HandleEvent);
    B53.addEventListener (MouseEvent.Click, HandleEvent);

    }
    public void handleEvent (e: MouseEvent): void
    {
    var a: String = e.target.name;
    Alert.Show (e.Target.Name);
    var b:String = null;
    Switch (a)
    {

    case 'Button20 ':
    b = TextBox.Text;
    TextBox.Text = "a";
    TextBox.Text = b + "a";
    break;


    case 'Button21 ':

    TextBox.Text = "b";
    TextBox.Text = b + "b";
    break;


    by default:

    TextBox.Text = "s";
    TextBox.Text = b + "s";
    }
    }

    []] >
    < / fx:Script >

    < s:Panel = "43" x y = "82" width = "527" height = "213" >
    < mx:Button = "71" x y = '86' id = "b1" label = "1" width = "30" height = "24" / >
    < s:Button = "180" x y = '86' id = "b2" label = "5" width = "30" height = "24" / >
    < s:Button = "127" x y = '86' id = "b3" label = "3" width = "30" height = "24" / >
    < s:Button = "99" x y = '86' id = "b4" label = "2" width = "30" height = "24" / >
    < s:Button = "323" x y = '86' id = "b5" label = "0" width = "30" height = "24" / >
    < s:Button = "294" x y = '86' id = "b6" label = "9" width = "30" height = "24" / >
    < s:Button = "265" x y = '86' id = "b7" label = "8" width = "30" height = "24" / >
    < s:Button x = '237' y = '86' id = "b8" label = "7" width = "30" height = "24" / >
    < s:Button = '209' x y = '86' id = "b9" label = "6" width = "30" height = "24" / >
    < s:Button = "42" x y = '86' id = "b10" label = "" ' "width ="30"height ="24"/ >"
    < s:Button x = "382" y = '86' id = "b11" label = "=" width = "30" height = "24" / >
    < s:Button = '353' x y = '86' id = "b12" label = "» largeur" width = "30" height = "24" / > "
    < s:Button = "410" x y = '86' id = "b13" label = "back" width = "76" height = "24" / >
    < s:Button = "157" x y = '86' id = "b14" label = "4" width = "30" height = "24" / >
    < s:Button = "43" x = "109" id = "b15" label = "tab" width = "66" height = "24" / >
    < s:Button = "105" x = "109" id = "b16" label = "q" width = "31" height = "24" / >
    < s:Button = "247" x = "109" id = "b17" label = "y" width = "30" height = "24" / >
    < s:Button '303' = x y = "109" id = "b18" label = "i" width = "31" height = "24" / >
    < s:Button = "361" x y = '110' id = "b19" label = "p" width = "34" height = "23" / >
    < s:Button = "394" x = "109" id = "b20" label = "[" width = "31" height = "24" / >] "
    < s:Button = "191" x = "109" id = "b21" label = "r" width = "34" height = "24" / >
    < s:Button '424' = x y = "109" id = "b22" label = "]" width = "31" height = "24" / > "
    < s:Button = "222" x = "109" id = "b23" label = "t" width = "31" height = "24" / >
    < s:Button = "161" x = "109" id = "b24" label = "e" width = "31" height = "24" / >
    < s:Button = "133" x = "109" id = "b25" label = "w" width = "31" height = "24" / >
    < s:Button = "332" x = "109" id = "b26" label = "o" width = "31" height = "24" / >
    < s:Button = "275" x = "109" id = "b27" label = "u" width = "31" height = "24" / >
    < s:Button = "220" x = "133" id = "b28" label = "g" width = "31" height = "24" / >
    < s:Button '424' = x y = "132" id = "b29" label = "enter" width = "62" height = "24" / >
    < s:Button = "43" x = "132" id = "b30" label = "caps" width = "66" height = "24" / >
    < s:Button = "275" x = "133" id = "b31" label = "j" width = "42" height = "23" / >
    < s:Button = "314" x = "132" id = "b32" label = "k" width = "31" height = "24" / >
    < s:Button = "133" x = "133" id = "b33" label = "s" width = "31" height = "23" / >
    < s:Button = "161" x = "133" id = "b34" label = "d" width = "31" height = "23" / >
    < s:Button = "250" x = "133" id = "b35" label = "h" width = "31" height = "23" / >
    < s:Button = "105" x = "133" id = "b36" label = "a" width = "31" height = "23" / >
    < s:Button = "191" x = "133" id = "b37" label = "f" width = "31" height = "23" / >
    < s:Button = "342" x = "132" id = "b38" label = "l" width = "31" height = "24" / >
    < s:Button = "152" x = "154" id = "b39" label = "x" width = "31" height = "24" / >
    < s:Button = "353" x = "154" id = "b40" label = "'." " Width = "31" height = "24" / >
    < s:Button = "325" x y = "154" id = "b41" label = "," width = "31" height = "24" / >
    < s:Button = "294" x = "154" id = "b42" label = "m" width = "31" height = "24" / >
    < s:Button = "259" x = "154" id = "b43" label = "n" width = "37" height = "24" / >
    < s:Button = '236' x y = "154" id = "b44" label = "b" width = "31" height = "24" / >
    < s:Button = "211" x = "154" id = "b45" label = "v" width = "31" height = "24" / >
    < s:Button = "181" x = "154" id = "b46" label = "c" width = "31" height = "24" / >
    < s:Button = "122" x = "154" id = "b47" label = "z" width = "31" height = "24" / >
    < s:Button = "380" x = "154" id = "b48" label = "/" width = "31" height = "24" / >
    < s:Button '368' = x y = "132" id = "b49" label width = ';' = "31" height = "24" / >
    < s:Button = "396" x = "132" id = "b50" label = "" ' "width ="31"height ="24"/ >"
    < s:Button = "43" x = "154" id = "b51" label = "shift" width = "82" height = "24" / >
    < s:Button '407' = x y = id = "154" "b52" label = "shift" width = "79" height = "24" / >
    < s:Button = "455" x = "109" id = "b53" label = "------" width = "31" height = "24" / >

    < / s:Panel >
    < s:TextInput = "161" x = "27" id = "textbox" width = "253" / >

    < / s:Application >

    Kind regards

    Saran r

    Hello

    http://gumbo.flashhub.NET/keyboard/

    It is a small example of a 'virtual' keyboard that will enter the text into a textinput/textarea component selected. Capslock and shift key States really aren't quite right (really need control shift/cap lock combo), but there is a simple tab and backspace (delete) and enter the function key.

    hope this is useful

    David.

  • How to get the text have the same effect as the video?

    Hello

    For the first time post here, but I wonder how to get the text of the titles have the same effect as the video behind her.

    For my video, I use 'bad tv' and other effects such as Gaussian that obviously changes the appearance of video, creating the look of VHS. However, I then inserted text via the title, but it normally appears. How can I make this text have the same effects as the video behind it?

    A friend told me I might need to add text to the video first, then do the effects, I have not tried, but wonder if there is an easier way, as this would require me to restart.

    EDIT: That's what I'm looking for. https://youtu.be/7_2PHQI89dI?t=24s The text has the same effect as the video.

    Thank you

    One way is to create a clip made up based on the title and the original clip. Then apply the effect.

    Another way is to use an adjustment layer.

    Good luck.

    Russ

  • How to get the text of a SystemPrompt (Cascades)

    Hello

    I've been struggling with this for a few hours now. I followed the example of "dialogues" on github, so I have successfully created a SystemPrompt (the dialog box that allows the user to enter text and accept / reject). Curiously, in this example there is no use of user text input. Do you know how to get the text in my QML? Here you have an example of code that I use:

    My QML:

    // Default empty project template
    import bb.cascades 1.0
    import bb.system 1.0
    
    // creates one page with a label
    NavigationPane {
        id: navigationPane
        Page {
            attachedObjects: [
                SystemPrompt {
                    id: prompt
                    title: qsTr("Enter a text for the label")
                    modality: SystemUiModality.Application
                    inputField.inputMode: SystemUiInputMode.Default
                    inputField.emptyText: "Label text..."
                    confirmButton.label: qsTr("Ok")
                    confirmButton.enabled: true
                    cancelButton.label: qsTr("Cancel")
                    cancelButton.enabled: true
                    onFinished: {
                        if (result == SystemUiResult.ConfirmButtonSelection) {
                            lab1.text = ????? // Here is where I don't know what to do
                        }
                    }
                }
            ]
    
            Container {
                layout: StackLayout {}
    
                Label {
                            id: lab1              text: "Label text"
                    objectName: "lab1"
                    textStyle.base: SystemDefaults.TextStyles.TitleText
                    horizontalAlignment: HorizontalAlignment.Center
                }
    
                Button {
                    text: "Update label"
                    horizontalAlignment: HorizontalAlignment.Center
                    topMargin: 150.0
                    onClicked: {
                        //_appUi.editLabel();
                        prompt.show();
                    }
                }
            }
        }
    }
    

    Be sure to add this in your .cpp file or all of app:

    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    

    and don't forget to include them in your app .cpp file (probably not all are needed, but just in case I leave here for the moment):

    qmlRegisterType("bb.system", 1, 0, "SystemUiButton");
        qmlRegisterType("bb.system", 1, 0, "SystemUiInputField");
        qmlRegisterType("bb.system", 1, 0, "SystemToast");
        qmlRegisterType("bb.system", 1, 0, "SystemPrompt");
        qmlRegisterType("bb.system", 1, 0, "SystemCredentialsPrompt");
        qmlRegisterType("bb.system", 1, 0, "SystemDialog");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiError", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiResult", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiPosition", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiInputMode", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiModality", "");
        qRegisterMetaType("bb::system::SystemUiResult::Type");
    

    Thank you very much

    If you look very carefully by the docs, you'll trip over https://developer.blackberry.com/cascades/reference/bb__system__systemprompt.html#inputfieldtextentr...

    So, replace your? with inputFieldTextEntry() and you will get the text you need.

  • Illustrator on Mac: how to create the symbol of the editor, P in a circle?

    Illustrator on Mac: how to create the symbol of the editor, P in a circle?

    Thank you.

    Create an insertion point in the document with the text tool, and then from the Type > glyphs menu, double click the glyph you want to insert.

  • How to set the text of creepy stationary?

    How to make the text text in a fixed position in a specific spot while crawling from left to right? EXAMPLE; I don't want the text to analyze the frame from left to right. I just want that it ti be in the middle of the image, but still have the effect of the analysis. I'm stuck and comes to mind. Any help is very appreciated.

    Ok

    A few ways to do this... but here's an interesting way. (and I really hope that you are in CC 2014 version)

    Create your title (titration) for example "TEXT GOES HERE"

    Set up and position it on your Clip, exactly as you wish in the Titler.

    Place layer above your video Clip in the Timeline. It will overlap.

    Duplicate video Clip (Alt click drag) and place it directly above title and Clip Original

    Click the Clip duplicate (top layer)

    Open the window controls Effects > opacity

    Click on the mask of rectangular shape and set it on the edges of the "TEXT GOES HERE" - it will go away.

    Click REVERSE in the mask settings. It will be published.

    Click on the layer title.

    The effects control window > Motion > Position

    Set X of left hand to move the text out of the mask > Set Key Frame

    Move the cursor in the timeline for new times and > set X of left hand to move the text out of the mask on the other side > Set Key Frame.

    Play with keyframes to set the Timings on duration (drag them anywhere)

    Play with mask feathering if you want soft input output

  • How to recognize the manual entries

    Hello

    In the tables GL, GL and GL headers lines, how can we identify whether a journal entry is an automated entry or manual entry.
    In other words, contributions can be sent in the General Ledger through Interface programs or other methods of importation. We describe it as some automated.
    And if the journal entries are made directly in the GL, to identify those automated.

    I need to know in a perspective of backend, i.e. which column in the table GL Specifies whether an entry is a manual or automated log entry.

    For Ex: In the table of GL_JE_Headers, the JE_Source and the JE_Category mentions hence is the source.
    Want, JE_Source Payables and Je_Category can be invoices purchase or payment.
    Looking at the above line, we can identify that it is an automated accounts payable entry.
    How to identify the manual entries.

    Your help is greatly appreciated.
    Thank you
    Bob

    Hi Bob,

    In the GL_JE_HEADERS table, column JE_SOURCE would have value as a 'MANUAL', this indicates that this journal is created manually in general accounting module and not imported from subsidiary ledgers. There is no indicative column for us in order to determine whether it is automatic or manual... not values such as MANUAL and REPETITIVE indicating entries that were created directly in general ledger...
    Also in table GL_JE_LINES for the GL_SL_LINK_ID and GL_SL_LINK_TABLE columns, the column values would be blank, because these columns normally contains reference to the basis of the auxiliary accounting transaction... .for a manual transaction it'll not be a reference to the auxiliary accounting, where they would remain under empty...

    Kind regards
    Ivruksha

  • How to create the rainbow effect in the formulation

    Screen Shot 2014-06-19 at 1.19.16 AM.jpg

    I can't understand how to create the same type of effect (completely in the wording) as indicated in the text of the image above. I'm new to Illustrator, and any useful information would be greatly appreciated, thank you.

    STO

    You can:

    (1) in the tool box, set the fill to none;

    (2) in the appearance palette dialog box, click Add new fill;

    (3) with the new fill selected / highlighted in the main window of Apperance palette, apply the gradient.

    In the case shown and similar, you can click the gradient in the Toolbox instead of filling Uni, then change the colors in the palette degraded for each stop end of levels of grey, white and black for the right colors in the color palette (RGB or CMYK), then add stops with intermediate colors. you select / Create to stop clicking in the gradient bar, and you can move the stops in ClickDragging or by setting the percentage values.

    The image looks like a little green at 0%, blue 50%, red 755% and flame red / yellow 100%.

Maybe you are looking for