Dynamically created Text field inside of empty Movieclip

Hi there.
My goal is to have a button that, when clicked, an empty
movieclip is created and a text field is attached to it.
I could write it easily if the newly created instance names
where hard coded, the problem comes with the syntax to generate
them dynamically.
Here's the code i have so far:
ActionScript Code:
button.onRelease = function() {
createText();
var count:Number = 1;
createText = function () {
_root.createEmptyMovieClip("placeholder"+count,this.getNextHighestDepth());
this["placeholder"+count].createTextField("my_txt"+count,
this.getNextHighestDepth(), 100, 100, 100, 100); count++;
After that's done i still need to assign a text value to the
text field, which i have no clue on how to do it...
In other words I want to accomplish something like:
placeholder[count].my_txt[count].text = "my text";
I hope it's not confusing... Any help would be greatly
appreciated.
Thanks in advance!

if your createText() function isn't working the way you want
check your use of "this" and "_root". if they're not the same,
you're not referencing your newly created movieclip correctly. and
your textfield depth isn't what you really want, but it should work
ok.

Similar Messages

  • Dynamically created text field doesn't appear when imported

    Greetings,
    I have 2 issues regarding dynamically created text fields.
    What I'm trying to do is to create a text field inside a swf file,
    then import that swf into another file. The main problem is, the
    text field is created and displayed perfectly when i execute the
    first swf, but when i try to import the whole thing into another
    file, the text is not displayed.
    I have to point out that, when I add "stage" before the
    addChildAt command, the text appears, but I don't want the
    coordinates of the text box depending on it's location on the
    stage.
    The second problem is, I want the scroll buttons to appear if
    the text is longer than the text box, however they appear no matter
    what. I trace the values and they are correct, so I can't really
    understand why they keep appearing.
    Thank you very much for your help.

    The same thing is happening to me and it is starting to get annoying. I too am using Chrome and I think that might just be part of the issue. I am running a Macbook Pro 2010 13". Any insight on this would be helpful. Sorry I don't have a solution, but know that your not alone in dealing eith this issue.

  • AS3: How to get height of a dynamically created text field

    I am importing text from an XML file and want the lines of text to display in separate text fields beneath each other. How can I set the y value of each succeeding text field so that there is some space (40 pixels or so) from the above field, regardless of the length of the text? Here is my current code. Any help would be greatly appreciated.
    var textArray:Array = new Array();
    for (var i:int; i <myXML.TOPIC[0].QUERY.length(); i++) {
    var textField:TextField = new TextField();
    textField.htmlText = myXML.TOPIC[0].QUERY[i].QUESTION;
    textField.x = 100;
    //below is my problem....I want the y value to be based on the height of all the previous text fields that have been created
    textField.y = 100+(40*i);
    textField.border = true;
    textField.width = 800;
    textField.textColor = 0x000000;
    textField.multiline = true;
    textField.wordWrap = true;
    textField.selectable = false;
    addChild(textField);
    textArray.push(textField);

    There's nothing wrong with the approach you took... retain it as is.  What I was suggesting is basically the same, just a slightly different angle that doesn't need the conditional....
    var currentY:Number = 100;
    for (var j:int = 0; j <myXML.TOPIC[0].QUERY.length(); j++) {
       textArray[j].y =  currentY;
        // text gets added somewhere in here
        currentY =  currentY+textArray[j].height+5;

  • Dynamically create Text Fields

    hi,
    i hav a form which contains 2 radio buttons.
    ...If v click one radio button, a text field should be displayed and should contain information returned by view object.
    ...If v click another radio button, the previous text field should not appear and new text firld should appear and should contain information returned by another view object...
    .....can anyone say how can this b done?....

    To make a textfield programmatically you can use something like this:
        public CoreOutputText createOutputText(String text) {
            CoreOutputText label = (CoreOutputText)FacesContext.
                    getCurrentInstance().getApplication().
                    createComponent(CoreOutputText.COMPONENT_TYPE);
            label.setValue(text);
            //System.out.println("label id = " +label.getId()); //TEMP
            return label;
        }I put that method in a UIComponentFactory class. To add the created OutputText to your PanelPage for instance you do:
    CoreOutputText output = UIComponentFactory.getInstance().createOutputText();
    getPanelPage().getChildren().add(output);Like this you add the output text to the the children of the panelpage.
    To remove the output again you can use getPanelPage().getChildren().remove(output);

  • Using external XML document to update / change text fields inside of published captivate output.

    Hello
    I currently have a project where the client has requested to have the ability to update the text fields inside the project at a later date.
    This is due to the nature of the content changing rather rapidly, i would like to set this up so the client can manage this them selfs.
    What would the best way to do this be?
    I'm thinking XML, an external XML sheet were by Captivate imports the text from this XML sheet and then displays it within the specific text fields contained within the captivate output.
    This way the client would just update the external XML document(cut and paste the text in) and then the text would be dynamically updated in the published Captivate document.
    any help would be amazing !
    Thanks in advance
    Nick

    Hi Lieve
    But isn't this thread more about an end user having an ability to change text after the Captivate has been published and delivered? I could see where that might be useful if making changes then publishing to create a new output. But I'm interpreting that the situation here is that a Captivate project has been published and delivered, and some mechanism is desired that allows the recipient to modify an external XML file to influence changes in the already compiled Captivate output.
    Cheers... Rick

  • How to get the co-ordinates of a dynamically created input field

    Hello Frn's
    i have created a dynamic text view . but this text view is not appearing at proper position . I want palce it infront of a dynamically created input field . how can i do this ?
    as i am thinking ...i should first of all  get info about the co-ordinates of   dynamaclly creatd input field . and with respect to these co-ordinates ...set the position of  text View .
    Please suggest  your thoughts .
    Thanks and Regards
    Priyank Dixit

    Hi,
    There is no provision in WD for getting screen coordinates and then placing the UI element.
    You to add the UI element to layout editor and based on the layout type it will add the UI element to respective position.
    I would advice not to create dynamic UI elements( instead you can create them statically and then play with visibility status through context binding ). This will be more effective way and less error prone. This is also recommended practice.
    still,For dynamic creation you can refer to following wiki:
    http://wiki.sdn.sap.com/wiki/display/WDABAP/CreatingUIElementsDynamicallyinAbapWebdynpro+Application
    regards
    Manas Dua

  • How to delete Dynamically created input field UI Element

    Hi all,
              I want to delete dynamically created input field and label.
    Is there any method please tell.
    Thanks in advance
    Hemalatha

    Hi,
    In the WDEVENT parameter of the action handler you can find the event id.
    ***Variables
      DATA:
        lv_selected  type string.          "Selected tab value
    ***Structure and internal table for the Events and messages
      DATA:
        lt_events type WDR_EVENT_PARAMETER_LIST,
        ls_events type WDR_EVENT_PARAMETER.
    ***Field symbols
      field-symbols: <fs_value> type any.   "Attribute value in events table
    ***Move the event table to lt_events
      lt_events = wdevent->parameters.
      read table  lt_events into ls_events with key name = 'SAVE'.  "Button Id
      if sy-subrc eq 0.
        assign ls_events-value->* to <fs_value>.
        if sy-subrc eq 0.
          lv_selected  = <fs_value>.
        endif.                 "IF sy-subrc eq 0.
      endif.                 "IF sy-subrc eq 0.
    Regards,
    Lekha.

  • Creating text fields

    When creating text fields, how do I get the cursor to print on the line instead of far above the line?

    I dodn't understand the question. Can you elaborate, and maybe include a screen shot of the problem you're seeing?

  • Creating Input Field inside Docking Container bar

    Hello.
    Does anyone know how I can put an input field inside a docking container object ? Just like it appears in SE80.
    I have created a docking container bar, and in one of those bars i want to put a text field.
    Anyone please ?
    Thank you
    EDIT----
    I found how to do this with cl_gui_container_bar_2 and with dynamic documents.
    Edited by: Ricardo Monteiro on Aug 25, 2010 1:30 PM

    Hi,
    Check Program SAPSIMPLE_TREE_CONTEXT_MEN_DEM and check event node_context_menu_request
    Hope this helps you.
    Thanks,
    Prashanth
    Edited by: Prashanth KR on Jun 2, 2009 7:50 AM

  • Using variables in input text fields nested in a movieclip

    Hi all,
    I am designing a roulette wheel type game. I am using a variable, "_global.myMoney = 0; " to keep track of the total money the player has. When I built the prototype, I used a dynamic text field on the stage with an instance name of "myMoney_text" and a variable of "_root.myMoney"
    Now, I need to move this text box into a movie clip with an instance name of "winnings_mc"
    When I test the movie, it looks like it showing the style sheet (font size, font, etc...) inside the dynamic text box. If I change the variable of the box to "_root.winnings_mc.myMoney" it seems to track initially, but now my updateMoney function in my main script does not work.
    The function is called like this:
    trace("updated money equals " + updateMoney(myMoney));
    This always traces zero now, the initial value.
    Any ideas?
    Thanks!

    if you want to use a global variable, when initializing and everytime you assign a new value, prefix the variable with _global:
    _global.myMoney.
    whenever you want to retrieve its value, use myMoney.
    you should not be using _root.myMoney.
    and as ned mentioned, you should stop using the variable associated with textfields and use the text property of your textfield to assign its text.

  • Is it possible to dynamically create form fields in PDF form?

    Hi all,
    I would like to dynamically create object like textbox, dropdown list from xml data. For example:
    When I receive following xml data:
    <field name="Check Box" type="selectbox"/>
    <field name="Text Field" type="textbox"/>
    I want to generate 2 form fields check box and text field with title "Check Box" and "Text Field" accordingly.
    Is it possible to do it in javascript for PDF form?
    Thank you and regards,
    Anh

    You cannot dynamically create objects on the fly like that but you can create interpret the XML and create an XDP file (which is the language of the template file) then bring that into Designer and create a PDF from that.
    Paul

  • Upgrade from CS4 to CS5: Dynamically created text isn´t shown anymore.

    Hello,
    since I have updated my Flash CS4 to CS5, textfields that have been dynamically created inside external classes aren´t filled with text anymore. At least they exist; the cursor appears, when I roll over the place, where it has been placed.
    This is how I place it:
    1. The font is embeded as Font-Symbol inside the library. Name: "BertholdWalbaumBook", Linkage: "BertholdWalbaumBook";
    2. Code:
              moreInfoButtonText = new TextField();
              moreInfoButtonText.text = "More Info";
                   //TEXTFORMAT
                var pre_Disco_RecordStandard_TextFormat:TextFormat = new TextFormat();
                pre_Disco_RecordStandard_TextFormat.align = TextFormatAlign.LEFT;
                pre_Disco_RecordStandard_TextFormat.color = "FFFFFF";
                pre_Disco_RecordStandard_TextFormat.font = "BertholdWalbaumBook";
                pre_Disco_RecordStandard_TextFormat.leading = 3;
                pre_Disco_RecordStandard_TextFormat.size = 14.62;
                pre_Disco_RecordStandard_TextFormat.letterSpacing = 0;
                //COORDINATES
                moreInfoButtonText.x = moreInfoButtonBG.x+5;
                moreInfoButtonText.y = moreInfoButtonBG.y-30;
              //TEXTFIELD
                moreInfoButtonText.embedFonts = true;
                moreInfoButtonText.setTextFormat(pre_Disco_RecordStandard_TextFormat);
                moreInfoButtonText.antiAliasType = AntiAliasType.ADVANCED;
                moreInfoButtonText.sharpness = -400;
                moreInfoButtonText.thickness = -200;
                moreInfoButtonText.autoSize = TextFieldAutoSize.RIGHT;
                moreInfoButtonText.wordWrap = true;
                moreInfoButtonText.multiline = false;
              //ADD CHILD
                addChild(moreInfoButtonText);
    When I set       moreInfoButtonText.embedFonts = false;    the text is shown with system font, so the problem must cohere with embedding.

    In case you haven't seen these
    http://www.dotstrosity.net/2010/05/10/flash-cs5-font-embedding-its-totally-different/
    http://kb2.adobe.com/cps/831/cpsid_83162.html

  • Dynamically creating/modifying fields

    Hi there,
    I'm having difficulty dynamically adding or modifying fields in a report using XML.
    My sample report selects all the fields in a table (select * from TableName;), where some of the fields are mandantory for the report. The other fields are optional and selected by a user at runtime.
    So, a user selects the optional fields and passes them in as parameters. I check the parameters in the "After Parameter Form" trigger and, if they're set, I try to add or modify a field in the report using some XML, such as:
    <report name="Test1" author="Mark Kennedy" DTDVersion="1.0">
    <layout>
    <section name="main">
    <field name="F_UDC1" source="LOCATION">
    </field>
    </section>
    </layout>
    </report>
    The above XML tries to dynamically set the source of the field to LOCATION, which is one of the fields in the database table.
    If F_UDC1 exists in the report, I get an error message: "REP-0002: Unable to retrieve a string from the Report Builder message file." If F_UDC1 doesn't exist, nothing happens. No new field is created or shows up in the report.
    Any ideas on what I'm doing wrong? Thanks!
    Mark Kennedy
    [email protected]

    Scott,
    You should be able to do this with a report. You can make columns in a report into text boxes. I'm not sure exactly what I would do, but if you do something like
    select null c1, null c2, null c3, null c4 from
    user_objects where rownum <= :P123_NUM_ROWS
    you should get for null columns. Now go edit each of those columns and make them text fields.
    You can then submit the page and use the htmldb api's to get the values of those text boxes.
    You might also use a collection . . . I'm just thinking as I type, but this should give you some ideas.
    Anton

  • How do I set the value of a dynamic row text field

    I have a repeated row form which contains a button and multiple text fields.  There is a text field (Input Data Field) further up with some information I want to place in the table and multiple buttons that I want to read the value of and set to the table.  I apologize there are multiple questions I have and I am using pseudocode to describe it.
    Top form looks like
    InputField
    | ButtonX1 | ButtonY1 | DescriptionX1 (read only Text Field)
    | ButtonXn | ButtonY1 | DescriptionXn
    OutputRow looks like
    | ButtonOutput | OutputField1 | OutputField2 | OutputField3 |
    So I would like it to do
    ButtonX1.click
    OutputTable.OutputRow.addInstance(true)  //this works - everything else I have questions on
    OutputTable.OutputRow.OutputField1.rawValue = DescriptionX1.rawValue
    Question 1
    How do I address the location in each table to set a value
    Question 2
    How do I get the value of the description field in the same table and row as the button
    I would like to say something to the effect of  OutputTable.OutputRow[??].OutputField1.rawValue = this.parent.DescriptionX
    OutputTable.OutputRow.OutputField2 = InputField.rawValue
      Same question as above - how do I specify a dynamic row - is this the proper syntax for getting the value from the input field?
    OutputTable.OutputRow.OutputField3 = this.ButtonLabel
    Question 3
      How can I get the value of the button's label to set in the field
      There should be very many of these buttons and buttons will be added - I would prefer to set the value based on the button's label to make the value easier - not requiring changing the code
    Question 4 - unrelated to those above.
    Is it possible to build the first table
    | ButtonX | ButtonY | Description |
    from an XML File.  I have seen examples of how to build if it is just data, but can the XML be pushed into a form with code to do the above actions?

    Each object in a form must have a unique name. I doing so it is not neccessarily the name but the path or SomExpression associated with that object that must be unique. In your case you have a Table.Row.object configuration. The Row is the part that is repeating so to give each object a unique name an instance number is placed on the repeating part. So objects in the 1st row woudl be Table.Row[0].object...objects in the second row woudl be Table.Row[1].object etc .....You can see this by adding a debug instruction on the Enter event of the description field. Put the code app.alert(this.somExpression) and when you enter the field you will see what the somExpression is. Do this for a few rows and you will see the pattern (don't forget to remove the debug code from the enter event). Now you know what you have to use to address the fields. If no instance is given it is assumed to be 0 ..that is why only the 1st row is being affected.
    So now to answer your questions:
    Question1: The square bracket notation is an issue for javascript (this is the notation for an array) so we have to use a different means of addressing the field to include the instance number. So to address the Description in the 3rd row we woudl use:
    xfa.resolveNode("Table.Row[2].Description").rawValue = "This is my new description";
    Note that the instance number is 2 for the 3rd row because the instance numbers are 0 based.
    Question2. The resolveNode notation allows you to pass a string so you can also concatinate expressions to make the string. If you are writing code on a button in the same row you can get the instance that you are on by using the expression this.parent.index. The "this" portion refers to the current object (the button) and the parent.index gets you th eindex of the Buttons parent. If the button is embedded deeper in a hierarchy then you can continue to add parent indicators until you get back to the node that you want. So rewriting your expression from Q1 it woudl be:
    xfa.resolveNode("Table.Row[" + this.parent.index + "].Description").rawValue = "This is my new description";
    Question3: The buttons caption can be retrieved by using ButtonName.caption.value.text.value
    Question4: When you say build from an XML file. What are you expecting to come from the XML file? The caption that goes on the button? Typically the XML file carries data (not to say that it cannot carry other things). Just need a bit of clarification on this one first.
    Hope that helps
    Paul

  • Dynamic Forms - text fields

    Hi, I am currently using LiveCycle Designer 8.0. I am having major problems getting my text field boxes to expand dynamically on the page and over to the next page to accommodate large amounts of text. I have employed the 'allow multiple lines' and 'expand box' but to no avail. I think it is a 'subform' related problem. Appreciate any help out there.
    Regards
    Barum55

    Hi,
    Have you saved the form as a "dynamic XML form" in LC Designer?
    While you can set the object to multiple lines etc., it won't work if the form is saved as "static".
    Good luck,
    Niall

Maybe you are looking for