Using input text that's in a MC

Hi all -
Tearing my hair out on this, and it seems like it shouldn't be that difficult.
I've got an input text box (opAnswerTxt) that I've added to a movie clip (questAns) using AS3:
questAns.addChild(opAnswerTxt);
That's fine -- I'm able to type text into the text field. Now I need to trace this text. (Ultimately, I will want to capture the text in a variable and then reuse the text in a dynamic text field, but just tracing to make sure I can get the text first.)
I added a button (opSaveBtn) - also to the MC - and added an event listener to the button:
questAns.addChild(opSaveBtn);
opSaveBtn.addEventListener(MouseEvent.CLICK, saveOpInput);
but can't seem to trace the input text. Here's what I'm using:
function saveOpInput(me:MouseEvent):void
  trace (opAnswerTxt.text);
My output is the original default text I have in the text box, rather than the text I just typed in.
When I add the input text box to the stage, rather than to the MC, it works fine.
Note: I've tried targeting the instance -- see the following -- but I get an error.
trace (questAns.opAnswerTxt.text);
Also tried trace (MovieClip(root).questAns.opAnswerTxt.text) and that didn't work either.
Can anyone help?
Thanks!
Miriam

Thanks for your quick response. You may be right on this. The MC (and child text box and button) are all within a loop that's parsing an external XML file.
Basically, I'm trying to create a "form". The questions are in the external XML file (so they can be updated by the customer later). I've got a loop that's parsing the XML file and creating an MC for each question element it finds. Each MC has a question text field (dynamic - populated from the XML), an answer text field (the input text field), and a save button. Here's the code:
for (var i:int = 0; i < opLen; i++)
//declare variables - the XML is loaded in the first frame - this all works fine
var opQuestionElement:XML = opQuestion[i];
var opQuestText:String = opQuestionElement;
var opQuestionsElement:XML = opQuestions[i];
var opQuestNum:int = opQuestion[i];
//add container to hold each q&a
questAns = new qAndAMC();
questAns.width = 575;
questAns.height = 200;
questAns.x = 0;
questAns.y = 0 + i * questAns.height;
containerOp.addChild(questAns);
questAns.name = "Q&A #" + (i+1);
//add question text
var opQuestionTxt:TextField = new TextField();
opQuestionTxt.multiline = true;
opQuestionTxt.wordWrap = true;
opQuestionTxt.defaultTextFormat = qTextFormat;
opQuestionTxt.embedFonts = true;
opQuestionTxt.htmlText = (i+1) + ". " + opQuestText.toString();
opQuestionTxt.width = 545;
opQuestionTxt.x = 5;
opQuestionTxt.y = 10;
questAns.addChild(opQuestionTxt);
opQuestionTxt.name = "OpQuestTxt " + (i+1);
trace(opQuestionTxt.name);
opQuestionTxtFieldList.push(opQuestionTxt);
//add answer input text box;
var opAnswerTxt:TextField = new TextField();
opAnswerTxt.type = "input";
opAnswerTxt.multiline = true;
opAnswerTxt.wordWrap = true;
opAnswerTxt.background = true;
opAnswerTxt.backgroundColor = 0xFFFFFF;
opAnswerTxt.border = true;
opAnswerTxt.defaultTextFormat = qTextFormat;
opAnswerTxt.embedFonts = true;
opAnswerTxt.width = 545;
opAnswerTxt.height = 110;
opAnswerTxt.x = 10;
opAnswerTxt.y = 60;
opAnswerTxt.text = "Here's some text";
addChild(opAnswerTxt);
//add save btn
opSaveBtn = new saveButton();
opSaveBtn.x = 522;
opSaveBtn.y = 188;
opSaveBtn.buttonMode = true;
questAns.addChild(opSaveBtn);
opSaveBtn.addEventListener(MouseEvent.CLICK, saveOpInput);
function saveOpInput(me:MouseEvent):void
  trace (opAnswerTxt.text); //This currently traces "Here's some text", rather than what I type in
The two things I need to solve are:
1. I want to be able to "save" the input text in each of the input fields, so if the user navigates away from this frame, the text they input last time isn't lost. Ideally, I'd like all of the input text fields to display whatever text they entered last time -- but they should still be an input field so they can edit the text if they want.
2. I want to be able to print (or save to a text file) ALL of the question and answer text fields. I believe I need to create a separate print job MC for this?
Any help you can give would be greatly appreciated!!
Miriam

Similar Messages

  • Using input text to alter movieclip

    I have a number of movieclips which I would like to move when a particular value is entered into an input text box. The movieclips simply need to grow longer when a value is added to the input text. eg '10' would cause 'this.movieclip1._xscale += 20;'
    The closest to an explanation of how to achieve this that I could find was here: http://forums.adobe.com/message/140884#140884, but I dont understand what an 'associative array' is!?
    Any ideas anyone? Thanks, R.

    Ok, well I sorted out that bit of script to make it work with my files and it worked, but I think flash is having trouble handling my script.. I am trying to produce a 'clock' where numbers typed into the text box play a single movieclip (as above), the problem being that I am using 60 individual movieclips, and therefore 60xthe 'if ' function code above, and I think it's having a problem as flash seems to get confused with a (seemingly random) part of my code way before I have added all the needed sections of code.
    This is the code I am using (It's a very clumsy way of solving the problem but I am a basic as2 user!):
    time.onChanged = function()
    if(time.text >= 1201 && time.text < 1213) {
              line1._xscale += 20;
      line1._yscale += 20;
      if(time.text >= 1213 && time.text < 1225) {
              line2._xscale += 20;
      line2._yscale += 20;
      if(time.text >= 1225 && time.text < 1237) {
              line3._xscale += 20;
      line3._yscale += 20;
      if(time.text >= 1237 && time.text < 1249) {
              line4._xscale += 20;
      line4._yscale += 20;
      if((time.text >= 1249 && time.text < 1300)or(time.text >=0101 && time.text < 0102)) {
              line5._xscale += 20;
      line5._yscale += 20;
       if(time.text >= 0102 && time.text < 0113) {
              line6._xscale += 20;
      line6._yscale += 20;
       if(time.text >= 0113 && time.text < 0125) {
              line7._xscale += 20;
      line7._yscale += 20;
       if(time.text >= 0125 && time.text < 0137) {
              line8._xscale += 20;
      line8._yscale += 20;
        if(time.text >= 0137 && time.text < 0147) {
              line9._xscale += 20;
      line9._yscale += 20;
        if((time.text >= 0147 && time.text < 0160)or(time.text >=0200 && time.text < 0202)) {
              line10._xscale += 20;
      line10._yscale += 20;
      if(time.text >= 0102 && time.text < 0113) {
              line6._xscale += 20;
      line6._yscale += 20;
      if(time.text >= 0102 && time.text < 0113) {
              line6._xscale += 20;
      line6._yscale += 20;
      if(time.text >= 0102 && time.text < 0113) {
              line6._xscale += 20;
      line6._yscale += 20;
      if(time.text >= 0102 && time.text < 0113) {
              line6._xscale += 20;
      line6._yscale += 20;
      if(time.text >= 0102 && time.text < 0113) {
              line6._xscale += 20;
      line6._yscale += 20;
    Where time.text is the input text box, line1, line2 etc are my movieclips (there are 60, but only the code for 6 here), and the number ranges are basically incriments of 12 as I am trying to use the time(12hr clock) digits as a number that I can then [ut into a number range that would play the appropriate movieclip.
    Complicated I know but I have attached the file, which works if you enter 1234/1256/1250 etc, and it's a firly basic idea, but I think I am approaching it in the wrong way and am not sure how to work around it!

  • How to use input text

    Hi, I have searched the forums and haven't found what I am looking for.
    I want to have an input text box for the user to enter their name into. On the next frame I want it to say Welcome 'username'.
    Thanks

    You can access the text of an input box using the text propery of it. It will return a string
    var str:String = inputBox.text;

  • (Help) Using Input text in Flash CS4 AS3

    I am trying to take a user's input (His Name) and then greet the user on the next frame using the name he previously entered. I googled for 2days and was unable to find a way to do this on flash CS4 AS3, i guess because im very new to flash (only 2-3weeks )
    Any help would be greatly appreciated, and i am sorry if this was already answered in the forums.
    thanks for reading.

    If your interested... here's some general "rules of the road" that are basically courtesies...
    Don't post the same question in different forums (crossposting).  Folks that help don't like that because they can waste their time providing the same response someone else already offered elsewhere, or their helpful info gets no attention because the OP (original poster) got wrapped up in the discussion elsewhere and never went back to the other forums.  I saw one time where the OP suffered from doing this... the first person to respond in one forum said what they wanted couldn't be done, while my response in another forum showed them how to do it... but they accepted that it couldn't be done and never returned.
    Don't post in someone else's posting unless the exact same situation applies to you and it is a current posting.  It is a bit rude to step into someone else's posting just to get attention, which some people do... some with totally unrelated problems.  Or if your problem is even slightly different, it can end up confusing matters for all involved... trying to juggle helping two people where different solutions are needed.
    If you get one problem resolved and have another you want help with that does not involve the first, start a new posting.  People search these forums so it helps to have topics match the postings, which will not apply if mutliple topics get resolved under one title.  I recently saw one person tell someone to start a new posting even though they were following up to clarify something of the solution they received... that's wrong and is more likely someone with a case of points greed... as useless as points are, it happens.

  • When we can use input method that fit for chinese?

    i use iphone many many years, but i cannot fit full keyboard yet. our chinese like inputting in number keyboard, so we urge to ask for a new input method in iphone!
    if apple cannot provide it, we all think that Mr.Tim donot understand our chinese and care us...
    when, when, when?

    https://discussions.apple.com/thread/3955843?start=0&tstart=0

  • Input Text Box

    Hi Experts!
    I have SP3 with its Fix Pack 3.1 installed
    I am not able to use Input Text box component
    when i hit preview i cant see the input text box. it gets hidden for no reason
    i am not using Dynamic visibility
    i have no other component in my dashboard except Input Text component. i have just started
    is anyone else experience the same issue? can anyone help please?

    Hi,
    Create a new dashboard and test as follows:
    1. Give some background color on the input box and then preview to check.
    2. Check whether you have marked for HIDE in the Object Browser for that input box.
    With best wishes
    BaaRaa.

  • Input text in scrolling area

    I am working on a site in Flash and the content is within a
    scrolling area. On one of the pages I am making a form using input
    text but when I publish the file you are not able to type anything
    in the input boxes. Does anyone have any idea why this could be
    happening? You can preview the file online at
    http://www.creativeradiocontent.com/test/index2.htm
    and the form is on the Contact Us page. Sorry if I posted this in
    the wrong area, but I think it may be a problem with
    ActionScript.

    I am working on a site in Flash and the content is within a
    scrolling area. On one of the pages I am making a form using input
    text but when I publish the file you are not able to type anything
    in the input boxes. Does anyone have any idea why this could be
    happening? You can preview the file online at
    http://www.creativeradiocontent.com/test/index2.htm
    and the form is on the Contact Us page. Sorry if I posted this in
    the wrong area, but I think it may be a problem with
    ActionScript.

  • Using Dynamic Text In iOS Applications

    Hey everyone,
    I'm trying to create a simple iOS app.  I want to add a Dynamic Text box into the stage that will show the score, but every time I do so, the application encounters serious lag trouble.  I'm using _sans font.
    Does anyone have a method for using Dynamic Text that works well in iOS?

    I had lots of lag when I used a TLF textfield... but decent performance when I used a "classic" TextField.

  • Hiding first record from database in input text fields.

    Hi,
    I have 2 pages, a main page and a popup page. The main page has attributes from a VO in the form of input texts (I just dragged individual attributes) and a link that brings up the popup page. On the popup page I have an ADF Search Form and a Read-Only Table with selection. A user is able to search for records in the database then select the result and submit that row back to the main page which populates the input texts. When you first load the main page, the input texts that are linked to the VO iterator are already populated with the first row in the database. Is there a way to hide these values (but not the entire text fields) until after the user has searched from the popup?
    Thanks in advance.

    Hi,
    thanks much for the replies. Luc, I tried adding that Refreshcondition to the iterator in the pagedef and the result was when I ran the page, the textboxes and record would be gone but the label remained (close but I still need the empty box to show). Also, after running a search in the dialog box and submitting the result back to the main page, the values would still not show up, it just looked the same as when I first run the page.
    Did I put the RefreshCondition in the wrong place, or is it something else?
    Thanks again.

  • Regarding Input text fields

    This is about fill in the blanks in flash 8 as2. In this i used input  text fields and three buttons.In first frame i used multiple input text  fields and a submit button. After filling all the blanks we click on  submit button then in the second frame we will show the result like if  the blank is correct it should change the color to green and if it is  wrong it should change to red.and in the frame i have check button when  we click on it will display all the answers. And when we click on  analyse button we have to display the answer which the user types and  the correct answers.
    And my problem is when we click on submit there is no difference in the blanks color all are in black only and i have assigned red to the wrong answer and green to the correct answer.
    and script on submit button is
    on (release) {
        gotoAndStop("Bl1");
        if ((_root.Bl.txt1 == "abc1") && (_root.Bl.txt2 == "abc2") && (_root.Bl.txt3 == "abc3") && (_root.Bl.txt4 == "abc4")) {
            _root.Bl.txt1.textColor = 0x006600;
            _root.Bl.txt2.textColor = 0x006600;
            _root.Bl.txt3.textColor = 0x006600;
            _root.Bl.txt4.textColor = 0x006600;
        } else {
            _root.Bl.txt1.textColor = 0xFF0000;
            _root.Bl.txt2.textColor = 0xFF0000;
            _root.Bl.txt3.textColor = 0xFF0000;
            _root.Bl.txt4.textColor = 0xFF0000;
    where "Bl" is the movie clip name and "txt1","txt2","txt3","txt4" are the var names for input text fields
    Please help........

    You are concatenating the conditions it will only work if all are true or  all are false
    on (release)
        gotoAndStop("Bl1");
        if (_root.Bl.txt1 == "abc1")
            _root.Bl.txt1.textColor = 0x006600;
        else
            _root.Bl.txt1.textColor = 0xFF0000;
        if (_root.Bl.txt2 == "abc2")
            _root.Bl.txt2.textColor = 0x006600;
        else
            _root.Bl.txt2.textColor = 0xFF0000;
        if (_root.Bl.txt3 == "abc3")
            _root.Bl.txt3.textColor = 0x006600;
        else
            _root.Bl.txt3.textColor = 0xFF0000;
        if (_root.Bl.txt4 == "abc4")
            _root.Bl.txt4.textColor = 0x006600;
        else
            _root.Bl.txt4.textColor = 0xFF0000;
    You can also run a for loop for optimizing the code further.
    www.darshanrane.com

  • Problem with "Input text with List of Value"

    Hi,
    I have a table where i am storing country code using "Input text with List of Value". I want a another non base table item where i would like to show the "Country Name" of the select LOV. Kindly let know a way to implement the LOV where it returns the "Country code" to base table item and "Country name" to the non base table item.
    thanks
    Sanjay

    Hi,
    I am getting lazy in chasing down the JDeveloper release by the ADF Faces component mentioned.. So I ask: Which verson of JDeveloper are you on ?
    Frank

  • How to add comma and dollar sign that places automatically in input text field

    I have this ROI calculator which has several text input field
    on frame one with calculate and reset buttons. When a user enters
    numerical values in the text field, and jumping to the next field,
    I want the input text filed be updated with dollar sign and with
    comma.
    Next when they hit "ENTER" key or click "Calculate ROI"
    button, all the input text fields on frame 2 as a result of
    calculations be updated with dollar sign and comma. I also need
    that once the comma sign is assigned then it would not add any more
    even if user presses the button. Can someone help me in
    this?

    If you want to Set the Comma when you Switch to next Text
    Field
    Use onKillFocus / onSetFocus Functions.
    to restrict multiple comma, Before Adding comma use
    myText.text =
    myText.text.split(",").join("").split("$").join("");
    So this will give you the value without Comma and Dollar
    symbol, Now add the Comma and dollar.
    or you need to use a Flag for onChange Event.

  • Use E-commerce Attributes to create an input text field

    Hey BC Community,
    Wondering if anyone has been able to create any specialized code to use an e-commerce attribute field as a input text field?
    I have a clients that needs to capture various input fields from the customer on the Large Product view.  Unfortunately I have no more open slots (yup - used up all 4 custom slots, unit type, product meta, etc.) so I can use the "How to Set Up Special Instructions Box" idea, as I need to put the <input> fields in a Content Holder, as not all of these products have this required input fields.
    Long story short, does anyone know how to use the {tag_attributes} area of the e-commerce platform to create user input fields, which will of course, populate into the Shopping Cart as well?
    Thanks,
    Aaron

    Your the third person to ask about this today:
    Open Field Attribute

  • Executing methods using an input text file

    Hello all,
    I was just wondering if I could get a little help with giving the input commands to my program through a provided text file. I have already made a stack program and want to test it by feeding it a text file with commands in it. Here is an example of the text that it would contain:
    bluePush 100
    blueIsEmpty
    print
    bluePush 101
    bluePush 102
    bluePush 103
    blueSize
    bluePush 104
    print
    bluePop
    print
    redIsEmpty
    Etc..
    Problem is, I'm not really sure how to make my test file. I've never taken a text file as input before and once it's in, I'm not sure how to parse the commands.
    Any help would be greatly appreciated.
    Thanks,
    Tyler

    You would open the file like such:
      String fileName = "c:\path\to\file.txt";
      BufferedReader input = new BufferedReader(
                               new FileReader(fileName));You would create a loop to read the text, line by line, something like this:
      String line = null;
      while ((line = input.readLine()) != null){
        //... do processing here
      }Inside the while loop, you would parse the string into command and value pairs. Maybe look into StringTokenizer... Something like this:
        //inside while loop
        StringTokenizer parser = new StringTokanizer(line, " ");
        String command = parser.nextToken();
        String value = null;
        if (doesCommandHaveValue(command)) value = nextToken();
        //Determine course of action based on command
    //*** Then have the method doesCommandHaveValue...
    // Returns true if "Push" is found inside of command,
    // since it looks like only push statements have values after them
    private boolean doesCommandHaveValue(String command) {
      return (command.indexOf("Push") != -1);
    }Then mabe do a series of ifs based on command, to call different methods, using the value read in.

  • Hello, I am trying to use a photo,that I've opened up in pages on a blank landscape, taken from my camera roll and use it as album cover art. All the custom text's will not paste when I copy.  Pic and texts are saved as a PDF, how can I paste the doc ?

    Hello, I am trying to use a photo,that I've opened up in pages on a blank landscape, taken from my camera roll and use it as album cover art. All the custom text's will not paste when I copy.  Pic and texts are saved as a PDF, how can I paste the doc ?

    Hello, I am trying to use a photo,that I've opened up in pages on a blank landscape, taken from my camera roll and use it as album cover art. All the custom text's will not paste when I copy.  Pic and texts are saved as a PDF, how can I paste the doc ?

Maybe you are looking for

  • SAP to External Non SAP Systems C++ Connections

    Hi guys, i should develop a C++ application that should transfer/receive data from an external Non SAP System to a SAP System (MM SD FI Modules) and viceversa, This bidirectional integration should be synchronous and asynchronous, depending on the da

  • Safari 7.0 in Mavricks not working correctly

    Yesterday, I bit the bullet and loaded Mavericks (OS X 10.9). The upgrade went well, or so it seemed. Now I am having issues with Safari 7.0. Sometimes it WORKS, other times it CRASHES. When It CRASHES i have to resort to Activity Monitor and FORCE Q

  • Why is Adobe installer unable to connect to a server

    Im trying to download adobe installer in order to use InDesign, however it won't connect to the server. What is going on!?

  • Is is the right time to buy a 720?

    720 is on sale for about 11 months now & its perfect for me but for 512mb ram. with mwc 2014 it MAY get 1gb successor and ram matters even wid nokia apps (refocus,beamer) so shud i or shud i not buy 720 ryt now???

  • Setting In and Out points

    Is it me or is it a complete PAIN to set in and out points in 7? Used to be easy. It's almost impossible sometimes to grab the playback head without it selecting an i/o point. Once I finally do get the markers where I want 'em, the In point moves whe