Using variables in a text field

I am very rusty using lingo, and I cannot find how to do this
in any of my old projects (using director 7 if that helps you date
this)
I am trying to generate a random number, which becomes
visible in a text field on the stage after the user presses a
button.
The text field is called "hotseat"
on the button, I have a script which so far reads
on mouseUp
set grandom = random (50)
end
As you can see, I did not make it far. 8-)
In an earlier part of the project, I got around this issue by
evaluating the variable in an enormous if..then...else if
statement. I am trying to find a less tedious way to do it
Any help would be appreciated.
BobR
ps I am still using Director 7

on mouseUp me
set gRandom = random 50
member("fieldMemberName").text=string(gRandom)
end

Similar Messages

  • 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.

  • Need to use variable inside a text field.

    I have a field in my database called "introduction" that contains the following:
    "My name is #myname#"
    When I output #introduction# to the webpage, I would like #myname# to show the field value - i.e. "My name is Brett".    How do I let CF know to display the variable?    Right now, I'm gettting "My name is #myname#"
    thanks!
    B.

    This is a troublesom construct that will often devole into more trouble then it is worth, but almost everybody tries it at least once.
    Anyway you can use the evaluate() function to do what you wish.
    I.E.
    <cfoutput>#evaluate(introduction)#</cfoutput>

  • Inserting in-line variable into a text field

    Hello,
    I want to add a variable within a text field (dymanic value within a sentence). Basically, I want the form to display something like the following:
    "The person named <person name> is an employee of the company"
    The only way I could do this so far is by creating three elements on the form: the first is a text element that contains "The person named", the seond is a text field element with no label that contains the "<person name>" variable, and the third is another text element that contains "is an employee of the company."
    I don't really like this approach as if the name of the employee is too long, it might get cut off. If it was too short, there will be a lot of extra space between the name and the rest of the sentence.
    Another solution is to pass a string variable with the complete text (I'll have to build the string before calling the form). Similarly, I can pass an internal table with the text. I don't think either of these two solutions is ideal as LifeCycle designer should provide an easier way to do so (just like in SmartForms).

    Hi Abdullah Azzouni ,
    This is possible to add a dynamic text between the static text in Adobe form.
    For that suppose you have a Static Text field TEXT1 on your layout. Just right click over the text inside this field and on the pop-up choose "Floating Text". It will create a textfield in your subform. Now bind this newly created textfield to the field in the datasource say PERNR in your case.
    It will appear like: "The person named is an employee of the company"
    In this way you can add a dynamic text in between your static text in a text field.
    Regards,
    Vaibhav

  • Losing variables using loadMovie in input Text Field

    Hello! Im trying to load an swf into another swf that has a variable in the text input field. Im a designer and not a programmer but I am using this tutorial to get started in loading a form with a variables in it.
    http://www.kirupa.com/developer/actionscript/flash_php_email.htm
    What im doing is trying to duplicate is the text box so that when i want to load new_box.swf (with a variable name "company") into main.swf into a movieclip with an instant name "loader." using this:
    on (release) {
        loadMovie ("new_box.swf", "_root.form.loader");
    I can get the movie to load but it loses the variable "company" in the process and when i send the form it doesnt work. If i just keep it in the main timeline it works but not when i loadMovie. Any info would help. Thank you.

    when you load an swf into another, the _root will refer to the root of main swf.
    try add this code to first frame of your loaded swf.
    this._lockroot = true;

  • Using Group BY with text fields

    Hi,
    Is there any way around the problem of not being able to
    GROUP BY a text field???
    I have tried using the CAST (name AS VARCHAR(8000)) but it
    doesn't return the full value of the field...... I am getting about
    250 characters returned....
    Is there any way around this? ,

    I am assuming MS SQL Server. According to SQL Server Books
    Online:
    Note: Columns of type text, ntext, and image cannot be used in
    group_by_expression.
    For GROUP BY clauses that do not contain CUBE or ROLLUP, the
    number of group_by_expression items is limited by the GROUP BY
    column sizes, the aggregated columns, and the aggregate values
    involved in the query. This limit originates from the limit of
    8,060 bytes on the intermediate work table that is needed to
    hold intermediate query results. A maximum of 10 grouping
    expressions is permitted when CUBE or ROLLUP is specified.
    Phil

  • Using variable in accessing itab field

    Hi all!
    is it possible to access a field of an internal table using a variable.
    for example, please see my code below.
    DATA: BEGIN OF itab,
            field1 LIKE mara-matnr,
            field2 LIKE mara-matkl,
          END OF itab.
    data: v_fldname(5).
    **- itab is being populated here -**
    v_fldname = 'field1'.
    **- i want to access the first field of itab, field1-**
    ***- but instead of doing this code
    write itab-field1.
    ***- i want to do this...
    write itab-(v_fldname).
    but im getting an error message saying that <<The data object "IT_VAD" does not have a component called "">>
    please send me the correct way to deal with this.
    Thanks for your usual support.

    I dont have a SAP sytem now but This is a sample.
    Field-symbols f_field.
    Assin a value to the field symbol
    Assign f_field value "Field name"
    Now the value "Field name" is stored in F_Field. You can use the value as below
    v_somefield = <f_field>. " V_somefield will now have a value of "Field name"
    - Guru
    Reward points for helpful answers

  • Variable in Dynamic text field

    Hi,
    I'm trying to build a custom keyboard into flash to display text in the interface.  So far all that I have tried failed, can anyone point me toward a simple script or tutorial that would help me out.
    Thank you
    Yann

    ok here's a description of the project:
    I made a Movie clip containing all the buttons needed to make a QWERTY keyboard, plus some special character.  I would like text to appear in a dynamic field when the user click on the button, so they can write text in the field.
    So far, I've tried the following code, but it's not working :
    Frame 1 :
    stop();
    var myText:String;
    input_txt.text = output_txt.text;
    next_btn.addEventListener(MouseEvent.CLICK, nextClick);
    function nextClick(myNextEvent:MouseEvent):void {
        captureText();
        this.nextFrame();
    function captureText():void {
        myText = input_txt.text+"q";
    Frame 2 :
    output_txt.text = myText;
    back_btn.addEventListener(MouseEvent.CLICK, backClick);  
    function backClick(myBackEvent:MouseEvent):void {
        this.prevFrame();
    I'm pretty sure this isn't the most elegant way to do it, I've made it work once in a separate project, but I can't make it work in the new one.
    Does this help understand my problem?

  • Button Setting Variable - Text Field Not Updating

    Hi,
    I am working with Acrobat 9 Pro on Windows.
    I am unable to make the following work: When the user clicks a Button, a Text Field appears with the text associated with the Button clicked. I have tried accomplishing this with a variable declared in the Document JavaScripts, buttons setting the value of the variable, and a Text Field containing a Custom Calculation Script that returns the text associated with the value of the variable.
    Everything works - except the Text Field doesn't return the text associated with the value of the variable. I have an app.alert (for now) in the button scripts so I can see if the variable has the correct value - and it does - but when the Text Field appears - the text never changes.
    What I have observed: if I go back into the Custom Calculation Script of the Text Field and do nothing, go back out, go to Preview, and click on a Button, the text updates to the previous variable value (not the Button variable value I just clicked).
    So - I think - the Custom Calculation Script isn't seeing the new variable "on the fly". Even though the app.alerts are. I don't think this is a Field Calculation Order problem. But maybe it is. And this is where my brain power ends. Any suggestions would be greatly appreciated. Thank you.
    I have this in the Document JavaScripts:
    var ITrig = 1;
    I have three Buttons (want to have more) that will set the ITrig variable.
    Here is what I have in one Button:
    var Inpopup = this.getField("PartASectionIIInstructions")
    ITrig = 2;
    app.alert(ITrig);
    if (Inpopup.display == display.hidden) {
    Inpopup.display = display.visible
    Inpopup.setFocus();
    } else {
    Inpopup.display = display.hidden;
    I have this in the PartASectionIIInstructions Text Field in the Custom Calculation Script:
    if (ITrig == 2) {
    event.value = "#2";
    else if (ITrig == 3) {
    event.value = "#3";
    else if (ITrig == 4) {
    event.value = "#4";

    Thank you. I had tried something like that earlier - without success. That is why I went to the calculation script. So - I went back to the "Acrobat Forms - JavaScript Object Specification" looking for an answer. It finally sunk in I was guilty of this:
    var Inpopup = this.getField("PartASectionIIInstructions").value
    Inpopup = "#3"
    When I should have been doing this:
    var Inpopup = this.getField("PartASectionIIInstructions")
    Inpopup.value = "#3"

  • Report error when using combo box and one text field is empty

    I'm building an interactive pdf in adobe pro 9. My problem is the following: I have one text field where you can enter a numeric code and that is used to populate another text field when I choose an option on one combo box.For example: suppose I write the code 123 in the text field "A" and that the combo box has two options ("data" and "-"). When I select "-", another text field "B" is empty, while when I select "data" i populate the text field "B" using the code entered "A" with the text "data_123". In order to do this I use the standard javascript code in the Format>Custom tab of the combo-box.
    My questions are:
    - how can I prevent the pdf to proceed selecting an option in the combo box when the field "A" is empty?
    - how can I update the field "B" every time that I change the text in "A"? I found that the text is "B" is updated only when I press the selection in the combo box.

    You can set the combo box to read-only in the Validate event of the A field:
    // Validate script for text field
    getField("combo1").readonly = !event.value;
    To update the value of B when A changes, you can expand the script above to something like:
    // Validate script for text field
    var f1 = getField("combo1");
    var f2 = getField("B");
    // If there is an entry in the A field...
    if (event.value) {
        f1.readonly = false;  // Make sure the combo box is activated
        f2.value = f1.value === "-" ? "" : "fa.value + event.value;  // Update the value of field B
    } else {
        f1.readonly = true;  // Deactivate the combo box
        f2.value = f2.defaultValue;  // Reset field B
    You might also want to reset the combo box somewhere in there, but it's not clear to me when you would want to do that.

  • Remove text field from Array via for loop

    Hi,
    i have a problem to remove text fields added via for loop.
    That im doing is, via for loop im dynamically creating menu with 10 buttons.
    Each button contain, dynamically created, background (shape) and text field.
    And everything is fine.
    But when im try to remove text fields then i got this error:
    - Im using button to remove text fields - lang_btn.addEventListener(MouseEvent.CLICK, clickHandler);
    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
              at flash.display::DisplayObjectContainer/removeChild()
              at Loading_Img_fla::MainTimeline/xmlLoaded()
              at flash.events::EventDispatcher/dispatchEventFunction()
              at flash.events::EventDispatcher/dispatchEvent()
              at flash.net::URLLoader/onComplete()
    In the script bellow marked with red is what should remove text fields from an Array, instead giving me error.
    Here is my script
    // Create for loop
    for (var i:int = 0; i < 10; i++)
              for each (xml in listItems)
                        if (i == xml.attribute("Id"))
                                  // Add MovieClip to stage to hold the data
                                  addChild(lmHolder);
                                  lmHolder.x = 0;
                                  lmHolder.y = 0;
                                  // Create new MovieClip to hold buttons
                                  lmButtonsMCArray[i] = new MovieClip();
                                  lmButtonsMCArray[i].buttonMode = true;
                                  lmButtonsMCArray[i].mouseChildren = false;
                                  lmButtonsMCArray[i].x = 20;
                                  lmButtonsMCArray[i].y = 20 + btCount * buttonSpace;
                                  // Add each button MovieClip to lmHolder MovieClip
                                  lmHolder.addChild(lmButtonsMCArray[i]);
                                  // Create Background to buttons
                                  lmButtonsArray[i] = new Shape();
                                  lmButtonsArray[i].graphics.beginFill(lmBgColor0, 1);
                                  lmButtonsArray[i].graphics.drawRect(0, 0, 230, 85);
                                  lmButtonsArray[i].x = 0;
                                  lmButtonsArray[i].y = 0;
                                  // <<-- Add Background shape to the buttons MovieClips
                                  lmButtonsMCArray[i].addChild(lmButtonsArray[i]);
                                  // Create a new array to preserve data from XML List
                                  lmNameArrayEG = new Array();
                                  lmNameArrayUS = new Array();
                                  // Create local variable to hold
                                  var lmTxtFieldContentUS:String;
                                  var lmTxtFieldContentEG:String;
                                  var lmTxtContent:String;
                                  // If clicked button is EG then make array with Arabic text
                                  // If clicked button is US then make array with English text
                                  if (footer.lang_btn.langState == "EG")
                                            for each (var leftMenuName:XML in egLanguageList)
                                                      lmNameArrayEG.push(leftMenuName);
                                            lmTxtFieldContentEG = lmNameArrayEG[i];
                                            lmTxtContent = lmTxtFieldContentEG;
                                  else
                                            for each (var leftMenuNameUS:XML in usLanguageList)
                                                      lmNameArrayUS.push(leftMenuNameUS);
                                            lmTxtFieldContentUS = lmNameArrayUS[i];
                                            lmTxtContent = lmTxtFieldContentUS;
                                  // Setup new text field each time script is executed
                                  lmTxtFieldsArray[i] = new TextField();
                                  lmTxtFieldsArray[i].width = 110;
                                  lmTxtFieldsArray[i].border = false;
                                  lmTxtFieldsArray[i].wordWrap = true;
                                  lmTxtFieldsArray[i].multiline = true;
                                  lmTxtFieldsArray[i].selectable = false;
                                  lmTxtFieldsArray[i].embedFonts = true;
                                  lmTxtFieldsArray[i].antiAliasType = AntiAliasType.ADVANCED;
                                  lmTxtFieldsArray[i].autoSize = TextFieldAutoSize.CENTER;
                                  lmTxtFieldsArray[i].text = lmTxtContent.toUpperCase();
                                  lmTxtFieldsArray[i].x = 10;
                                  lmTxtFieldsArray[i].name = "lmTxtFieldName" + i;
                                  // <<-- Add Text fields to the Movie Clip
                                  lmButtonsMCArray[i].addChild(lmTxtFieldsArray[i]);
                                  // If clicked button is EG then set Arabic text format, and make array with Arabic text fields
                                  // If clicked button is US then set English text format, and make array with Egnlish text fields
                                  if (footer.lang_btn.langState == "EG")
                                            lmTxtFieldsArray[i].setTextFormat(txtFormat_lm_eg);
                                            // Make array from text fields;
                                            pushEgTFintoArray.push(lmTxtFieldsArray[i]);
                                  else
                                            lmTxtFieldsArray[i].setTextFormat(txtFormat_lm_us);
                                            // Make array from text fields;
                                            pushUsTFintoArray.push(lmTxtFieldsArray[i]);
                                  // If clicked button is EG then loop thrue the for loop and remove English text fields from array
                                  // If clicked button is EG then loop thrue the for loop and remove Arabic text fields from array
                                  if (footer.lang_btn.langState == "EG")
                                            for (var rNr_us:Number = 0; rNr_us < pushUsTFintoArray.length; rNr_us++)
                                                      //remove the text field array from the display
                                       removeChild(pushUsTFintoArray[rNr_us]);
                                            //clear the array
                                            pushUsTFintoArray = [];
                                  else
                                            for (var rNr_eg:Number = 0; rNr_eg < pushEgTFintoArray.length; rNr_eg++)
                                                      //remove the text field array from the display
                                       removeChild(pushEgTFintoArray[rNr_eg]);
                                            //clear the array
                                            pushEgTFintoArray = [];
              btCount++;

    it looks like those tf's are children of  lmButtonsMCArray[i], not the current scope.  use:
    if (footer.lang_btn.langState == "EG")
                                            for (var rNr_us:Number = 0; rNr_us < pushUsTFintoArray.length; rNr_us++)
                                                      //remove the text field array from the display
                                        lmButtonsMCArray[rNr_us].removeChild(pushUsTFintoArray[rNr_us]);
                                            //clear the array
                                            pushUsTFintoArray = [];
                                  else
                                            for (var rNr_eg:Number = 0; rNr_eg < pushEgTFintoArray.length; rNr_eg++)
                                                      //remove the text field array from the display
                                        lmButtonsMCArray[rNr_eg].removeChild(pushEgTFintoArray[rNr_eg]);
                                            //clear the array
                                            pushEgTFintoArray = [];

  • Sales order CARRIER TEXT field

    Hi,
    I am creating query through SQVI, I would like to use sales order carrier text field with the query.please advice which table and field should I use for query ?
    Thanks in advance

    Sorry, by mistake I posted the message again.
    Pls ignore it.
    Hi JK,
    Where are u entering the sales order carrier data. Is it Header Data or Item Data. Is it a long text?
    Please give more details.
    Regards,
    Vinod

  • Forms: How to set a maximum size in Text Fields with automatic size

    ¡Hi!
    When I set a text field on my forms and I use automatic size for te text that the user can write, if the user don't need more space than the field size, when the text appears, Adobe Acrobat Pro always set the text-size to 14 or higher. How can I set a maximum size for that text? For example... 12 or 10...
    Thank you very much,
    Best regards from Spain,
    David.

    Ok. If I use a single line text field, changing the height of the field seems to be a simple way to solve the problem, but... what should I do when the fields are multi-lineal?
    Thanx for your quick answer.

  • Professional 8 - Can't Get Rid of Tab Number In Text Field

    Hello,
      I hope someone can help me with this issue - when I create a text field on a PDF document and type text in the field, a "1" appears in the upper left hand corner (it's enclosed in a little black bordered box).  If it was only in the PDF file itself I could deal with it, but unfortunately it shows when I print the document too.  I've got some advice that it's the Tab function in Professional 8, but when I look for a way of turning it off or at least preventing it from showing up in the print, I can't find anything that works.  Adobe support has been no help, there still "looking into it".  I was hoping that perhaps someone has had a similar situation and could shed some light?.....
    Thanks!,

    Hello Bernd,
      I've attached an example of what's happening though I don't know if you'll be able to view the "1" in the upper left hand corner of the Text Field unless you have similar settings in Professional 8 (just a guessbecause Tech Support at Adobe couldn't see it so I sent a screen shot as well), so I've also attached a screen shot of the bottom of the document where the Text Field is showing the "1" in the corner.
    Things I've tried from suggestions made:
    1)  You have a tab order in your form turned ON. This is a standard feature of Adobe Acrobat. This is the only way Acrobat will display little numbers in the left-hand corner of the text field. However, tab order should not be visible during printing or entering data. These numbers are only displayed while editing form fields using "Form > Edit Fields in Acrobat...."  - (Which I didn't use to create the Text Field, I used "Tools", "Forms", "Text Field Tool")
    2)  "Print" dialog.  Select "Document" under "Comments and Forms" pull-down menu to avoid printing any markup or comments.
    I suspect that tab order might get printed for some reason you select anything else besides "Document".  - (I've tried everything is this menu)
    3)  1. Open your PDF form. 

  • Date  in text field

    Hi,
    I have a text field :P1_DATE . I want to enter date into it and date can be in any format like 01102012 means 01/10/2012 .if i enter date like 01102012 this should be enter like a date in table as date column accept.when i edit to the record date should be display like 01102012.
    Thanks & Regards
    Vedant

    Dear Friend,
    i have created two region.1st region have some item .using these item i have created invoice header.after creaing invoice header i have added no of line w.r.t invoice header.
    in 1st region i have take text item to enter invoice date it's data type is date type.
    in 2nd region which has created using tabular form here is i ma using one column invoice date.
    i want to display 1st region invoice date into tabular form invoice date column.so i have use item (application or page item) and pass :p1_invoice_date.
    i have use :p1_invoice_date as a text field but data type is date type date format is 'DDMMYY' and i am try to display it into tabular form invoice date column. it's also date type but i have display it as a text field and os i have put :p1_invoice_date into Tabular Form Element item default type (application or page item) .
    But it display me error
    report error:
    ORA-01790: expression must have same datatype as corresponding expressionHow to display 1st region invoice date into tabular form invoice date column.
    How can i do this.
    Thanks
    Edited by: Vedant on Oct 25, 2012 3:16 AM

Maybe you are looking for