Textfield to Text

I have set up a form to take in user names via a text field. Then later on in the document I want to add the contents of the text field to a pre-formated paragraph of which would contain the users name.
For example:
user enters their name in (text field 1)
user enters another name in (text field 2)
later on in the form (text field 1) and (text field 2) are inserted into a pre-formated paragraph:
I (text field 1) and (textfield 2) promise to do so forth so on, this and that.
As to where (text field 1) and (text field 2) are inserted and the paragraph above and then the paragraph adjusts to the amount of characters typed for each (text field) so the document flows.
is this possible?
Currently I have setup linked text fields but it leaves void space and leaves my document looking "un-professional". Any Ideas could help!
Also what would be a good read on this program beings I am diving in head first with my eyes closed...

After a few hours of search I have finally found myself an answer! What you have to do to get this working is very simple indeed.
I found my answer in the Adobe Designer help files here is the contents I have found:
Floating fields in a dynamic form
You can insert a floating field into a text object to display different types of information.
Floating fields are text field objects that support the merging of text, numeric values, run-time properties, and scripting within a text object when the form is rendered. You can insert floating fields into text objects only.
Because floating fields are text field objects, you can bind floating fields to a data source to display specific text or numeric values. For example, you can insert a floating field (Dear Mr./Ms. {TextField}), to render individual customer names in the introductory greeting of a form letter.
Note: Floating fields are text field objects by default, but you can change the object type using the Type list in the Field tab of the Object palette, to suit your needs.
Keep in mind that you must set the properties of the floating field object independently of setting the properties of the text object. By default, floating field objects are set to Hidden (Exclude from layout) in the Presence list.
To insert a floating text field into a text object:
Click inside the text object in which you want to place the floating text field object.
Place your cursor on the line where you want Designer to insert the floating text field object.
Select Insert > Floating Field.
To set the properties of the floating field, click the floating field marker inside the text object, and then select options as needed. It is good practice to rename the floating text field object and specify the necessary binding.

Similar Messages

  • AS3 - TextField - HTML Text

    Hi,
    I would like to find a nice solution to the following
    problem:
    I have a large HTML text containing text and images
    (<img>) inside a source TextField. I need to split this
    content into several TextField's of a fix width and height so that
    no scrolling is required.
    I tried to use all the new goodies that AS3 provides
    (getLineText(), bottomScrollV, etc). They are very helpful and if I
    had normal text (no HTML tags) to deal with, I could split the
    content without a problem. My problem is to do this on a HTML
    content. It is very difficult to find the HTML version of a
    splitted content.
    Does anybody have an idea I could do this job?
    Any help is greatly appreciated.

    no, your small textfields can be assigned text until they
    their maxScrollV property exceeds one. then remove text from the
    end of the small textfield's text property until its maxScrollV
    property decreases to one AND you have a logical place to break the
    text at which point you start assigning text to the next small
    textfield.

  • How to preserve special characters in dynamic textfield for text comparison?

    The problem is as follows:
    Since I mostly develop for multiple languages I am forced to have dynamic textfields in my buttons which contain three lines (to account for the differnt text.lengths in different languages).
    I then populate the textfields with strings out of an array or xml and use the textfields contents later in my button class to execute different code depending on the textfields content.
    This works fine as long as I don`t use any special characters, like for example "\n".
    var labels:Array = ["\nLABEL1","LABEL\n\n2"];
    switch (e.currentTarget.txt.text)
                    case labels[0]:
                        doSomething();
                        break;
                    case labels[1]:
                        doSomethingElse();
                        break;
    shows the right thing in the button label (breaks the text were I want it)
    but stops to work
    (with htmlText &  <br> its the same)
    my workaround for the moment is to use filler spaces,
    var labels:Array = ["                   LABEL1","LABEL                                                                        2"];
    but that`s obviously ugly to setUp and requires a lot of trial/error to get it right for all languages.
    Any ideas how to bypass that?

    Bad habits die hard ;-)
    Weird enough spelling the problem out and getting this response from you cleared my head and  I finally got an easy solution.
    I simply attach a dynamic property to the movieclip, copy the array contents into them and instead of using the text-property for comparison I compare the MovieClips fresh created spectext property.
    Voila: Now I can be lazy without too much of a bad conscience.

  • Spacing between textfield and text

    Anyone know how to set spacing between the text and border of a textfield?
    The docs say to use
    textfield.setMargin(new Insets(top, left, bottom, right));
    but that doesn't do anything.
    Thanks a lot for suggestions.

    The problem is that your border isn't going to use the margin of the text field (since it's not specialised for text fields). You've got a number of options:
    1) use the default border
    2) use a compound border with the default border inside
    3) write your own border that incorporates the text field's margin
    4) don't bother setting the margin and simply add a corresponding EmptyBorder into your compound border instead
    Option 4 is probably the quickest for you:
    textField.setBorder(new CompoundBorder(SOLID_BORDER, new EmptyBorder(10, 10, 10, 10)));Hope this helps.

  • Autosize TextField to text width

    Hi,
    I want to have my TextField automatically resize to be the width of the text in it. Currently it seems to be fixed width (when added to a FlowLayout) and the text inside scrolls (pans out to the left) when the max size is reached.
    I have worked out a nasty hack that manually tries to set the preferred width:
    inputField = new TextField();
    inputField.textProperty().addListener(new ChangeListener<String>()
        public void changed(ObservableValue<? extends String> observableValue, String s, String s1)
            int cols = s1 != null ? Math.max(2, s1.length() + 1) : 2;
            inputField.setPrefWidth(cols * 8);
    });This is nasty code, but also it doesn't adjust the size to the font used by the TextField (and there is no getFont that I can see?).
    Does anyone know if there is either another (nicer) way to do this or, at least a way to determine the width of a string on the TextField?
    Note, I have tried setPrefColumnCount but this seems to have no affect after the field has been created. I have also tried the 'autosize' method on TextField but it doesn't seem to do anything in this context either.
    Cheers,
    zonski

    After a few hours of search I have finally found myself an answer! What you have to do to get this working is very simple indeed.
    I found my answer in the Adobe Designer help files here is the contents I have found:
    Floating fields in a dynamic form
    You can insert a floating field into a text object to display different types of information.
    Floating fields are text field objects that support the merging of text, numeric values, run-time properties, and scripting within a text object when the form is rendered. You can insert floating fields into text objects only.
    Because floating fields are text field objects, you can bind floating fields to a data source to display specific text or numeric values. For example, you can insert a floating field (Dear Mr./Ms. {TextField}), to render individual customer names in the introductory greeting of a form letter.
    Note: Floating fields are text field objects by default, but you can change the object type using the Type list in the Field tab of the Object palette, to suit your needs.
    Keep in mind that you must set the properties of the floating field object independently of setting the properties of the text object. By default, floating field objects are set to Hidden (Exclude from layout) in the Presence list.
    To insert a floating text field into a text object:
    Click inside the text object in which you want to place the floating text field object.
    Place your cursor on the line where you want Designer to insert the floating text field object.
    Select Insert > Floating Field.
    To set the properties of the floating field, click the floating field marker inside the text object, and then select options as needed. It is good practice to rename the floating text field object and specify the necessary binding.

  • Load HTML into TextField or Text Components!

    Hi all!
    I'm trying to load 4 HTML documents into 4 different TextArea
    components (infoTxt1, infoTxt2, infoTx....). In the attached code I
    use/load the same HTML document to populate the components just to
    simplify the testing.
    This loop will not work. Can anyone tell me why or if there
    is a better way to load several HTML into components dynamically?
    It works IF it only loop once.
    Thanks

    YEAH!
    TRULY AMAZING, KGLAD :)
    Sorry for shouting out, but I just love to get this kind of
    help. I would never have figured this one out by my self and the
    good thing is I actually understand what's going on in your code
    and can use that in other cases.
    You came through as you you always do, and a million thanks
    for taking the time.
    Have a wonderful day :)
    Answer:
    To load several "html" documents into several textarea
    components on stage you can use kglads code:
    var dataNum:Number;
    loadDataF(1);
    function loadDataF(n:Number) {
    dataNum = n;
    this["tabData"+n] = new LoadVars();
    this["tabData"+n].onData = function(theText:String):Void {
    if (theText != undefined) {
    _root["infoTxt"+dataNum].text = theText;
    trace(_root["infoTxt"+dataNum]);
    if(dataNum<4){
    dataNum++
    loadDataF(dataNum);
    this["tabData"+n].load("artist"+n+".html");

  • How to set textfield.text on frame after goto

    This seems a little ridiculous to be asking this question coz
    it seems like it should be so simple but here goes anyway.
    STEPS TO RECREATE:
    Step 1 - create a class called simpleButt(see attached)
    Step 2 - create a MovieClip with two frame labels on
    different keyframes- ROLLOVER and ROLLOUT. on these different
    keyframes place a dynamic textfield with instance name -
    'buttonTitle'. give it different styling attributes on the ROLLOVER
    frame such as text colour, bold or even a glow filter.
    Step 3 - In the movie clip's linkage properties, give it the
    'simpleButt' class.
    Step 4 - With nothing on the stage, add the following two
    lines to frame actions:
    var newButt:simpleButt=new simpleButt("hello");
    this.addChild(newButt);
    Step 5 - compile!
    this should add a simple button to the stage and set the
    button's textfield's text property.
    However, after going to another frame on rollover, we lose
    the dynamic text - i assume because we have another instance of the
    textfield on a different keyframe because it has new styling
    properties on rollover. but if i try to set the text after going to
    the new frame, it doesn't seem to recognise the textfield yet.
    (uncomment lines in simpleButt to see what i mean)
    through trial and error i've found that if i wait two
    ENTERFRAMEs, the textfield object becomes available, but by this
    time the textfield flickers. is there an event i'm missing or
    function i could override where i could set the properties of an
    object on a frame after a gotoAndStop before it is rendered?
    cheers
    Craig

    STEP 2(where the textfield was created) is all done manually
    within the authoring environment - no actionscript. This is usually
    done by the design team here so to save time i'm trying to avoid
    replicating every style change they've made in code.

  • Flash AS2: Setting text of textfield through code causes some characters to be deleted

    I have the following line of code to set the text of a Dynamic textfield:
    boxCopy.text = 'Coming soon: 30th January 2014';
    but when I compile the file, it shows as: 'Coming soon: 0th January 201'
    I have no idea why this is. The font character set contains all the numeric characters, so it should display it.
    Anyone got any ideas?
    Thanks, Stefan

    Normally whenever there is an issue with characters not displaying the solution is to embed the font in the textfield.

  • TextField text changed during parent's container gets reset

    I'm having an aggravating issue which I think might be an inherent problem with Flash, but maybe I'm missing something. I'm finding that if I write a class file for a MovieClip in my library that contains a TextField, and try to change the TextField text in the constructor, it gets reset or doesn't set or something. I'm thinking maybe Flash runs the code to create the library version of the MovieClip after your custom constructor?
    So for example right now, I've got a MovieClip in my library called "MenuBar". MenuBar has a background bitmap and a TextField with instance name lblTitle, which has the text "Title" within the library.
    I've written a class file for MenuBar which has this function:
              /**The title of the menu displayed in the center of the menu bar
                        public final function set title(text:String):void {
                                       trace(lblTitle);
                                       if (lblTitle != null) {
                                                      trace(text);
                                                      lblTitle.text = title;
                                                 trace(lblTitle.text);
    Then I've got a MovieClip in the library called "MenuScreen". It has an instance of MenuBar called menuBar. MenuScreen also has its own class file which starts like this:
    public function MenuScreen(titleText:String)
                        super();
                        menuBarTop = MenuBar(this.getChildByName("menuBar"));
                        trace(titleText);
                        trace("Old Title:" + menuBarTop.title);
                        menuBarTop.title = titleText;
                        trace("New Title:" + menuBarTop.title);
    Now say I run this code:
    var menu:MenuScreen = new MenuScreen("New Title");
    The debug output comes out like this:
    New Title
    Old Title:Title
    TextField: [object TextField]
    Incoming Text: New Title
    New text: Title
    New Title:Title
    It's running the code to change the text in the TextField, and doesn't throw an error, but it doesn't change the text. What am I missing?

    I usually do not try to do constructor injection on View Classes (but then again, I usually allow the Flash Player/timeline to handle the instantiation and population of all my instances). I find that when the Flash player creates timeline instances, all of their children (that are present on frame 1, of course) are accessible from within the constructor, simply by referencing the instance name.  So if you did something more like this:
    public var menuBarTop:MenuBar;
    protected var _title:String='default title';
    public function MenuScreen() {
      if (menuBarTop) {
        menuBarTop.title= 'default title';//this should work fine
    public function get title():String {
       return _title;
    public function set title(value:String) {
      if (value != _title) {
        _title = value;
        if (menuBarTop) {
          menuBarTop.title = _title;
    For tighter control, you can use a getter/setter for menuBarTop as well.
    So, you're probably wondering how you are going to "get hold" of MenuScreen in order to populate it if you allow Flash to instantiate it? If you're not sure, check out http://www.developria.com/2010/04/combining-the-timeline-with-oo.html or http://www.meetup.com/atlflex/files/ (the files there all relate to this discussion)

  • Displaying the result of a calculation in a dynamic text box

    Hi folks,
    I'm having a very minor issue here (operator error, I'm sure ). With the help of some folks here, I've created a series of calculations, and I've got that part down. Now, I just need it to show up in the movie.
    I've created the dynamic text box in Flash (CS3), but when I hit test, it won't show up.
    After all the calculations, I should have a figure that I call totalmoney. My dynamic text box is called total. The user doesn't need to hit anything for it to appear. It just appears as part of the movie.
    Here's my code:
    stop();
    var startDate:Date = new Date(2010,0,12);  // use your  startyear, startmonth, startdate in the new Date() parameters.
    var  currentDate:Date = new Date();  // assuming user's clock is correct and in your  timezone.  else use server date/time.
    var numberOfSeconds:Number =  (currentDate.getTime()-startDate.getTime())/1000;
    var interest:Number =  (numberOfSeconds*0.74356);
    var totalmoney:Number =  (interest+15,000,000);
    function displaytotal(evt:TextEvent):void {
         total.text = "totalmoney";
    Any thoughts?
    Thanks!
    Napo

    You didn't have to bury any of the calculations in the function--leaving it as you had it is better.  They could remain where they a=werew, and you'll probably find you want them outside it if you have other plans for using them.  If left inside, they only have scope inside.  In the programming world, it's good to think of functions as things that do one thing and one thing only (though it isn't often practiced that way)--it's called modular design.
    When you place an event as an argument for a function, it typically means that there is an event listener that initiates the call to the function.  If you work with buttons you'll see what I mean.  But if the plan is to create your own call to a function when you desire it as such, not have it driven by an event listener, then you don't need to pass any event to it, though you may pass some other type of variable to it if need be.
    For instance, what you have now will call the function without an argument because the function has the value built into its code....
    displaytotal();
    But you could also make the function a little more generic and set it up to recieve the value instead as an argument...
    function displaytotal(amt:Number):void {
         total.text = String(amt); // an earlier error of mine
    displaytotal(totalmoney);
    That would make your function a little more useful.  Now it could be used to display other Number variables as well.
    // my earlier error was that a textfield displays text, so you need to convert the Number value to s String.
    Hope I'm not confusing you.

  • Trying to convert a int back to a textfield - help

    Okay this is what I want. I want to type a number in a TextField and double it.... So lets say I type in 10, it will output 20.. But I cant seem to get it to work. The integer won't change it back to a textfield usable text thing .. any help? And yes, i'll admit, its for school, not really for marks, but just to learn.. Theres like 10 of them. And I've been trying to get it to work for awhile, and I ain't asking for coding, or cheating. I'm just asking for help :)
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Myname extends Applet implements ActionListener
         Button pressMe = new Button("Enter a number");
         TextField answer = new TextField(10);
         Font bigfont = new Font("TimesRoman", Font.ITALIC,24);
         public void init()
              add(pressMe);
              add(answer);
              answer.requestFocus();
              pressMe.addActionListener(this);
         public void actionPerformed(ActionEvent thisEvent)
              int doubleamount = (new Integer(answer.getText())).intValue();
              int doubleamount2 = doubleamount + doubleamount;
              answer.setText(doubleamonut2);
              invalidate();
              validate();
    Thats what I have

    You need a String.valueOf (doubleamount2)to convert your int to a String, and you don't need
    the revalidate ().
    Kind regards,
    LeviYeah, Levi is correct. :-)

  • Is it possible to export interactive textfields with data?

    Hey guys,
    I have following problem. I´m creating our variable price list for our customers. "variable" means an interactive pdf for our customers where they can edit the prices, product discription etc.
    I can paginate our catalogue with "Easy Catalogue" including all interactive textfields. It looks like this:
    https://www.dropbox.com/s/kn81v9db69dx0a7/screenshot_pagination_incl_interactive_textfield s.png?dl=0
    The problem now is, when I export it as an interactive pdf, the data of the textfields will not be exported -> Dropbox - screenshot_exported_interactive_form.png
    it`s just blank
    Does anybody have a solution for this problem. I need the fields to be preset with the data!
    Is it generally possible to export interactive textfields with data?
    Any idea is appreciated!
    cheers from Austria,
    Chris

    I´m using Easy Catalog http://www.65bit.com/software/easycatalog/
    But I think it has something to do with indesign interactive pdf export properties.
    What I also tried:
    Converted an ordinary textfield with text into an interactive textfield -> then exported as an interactive pdf -> also blank editable field!

  • Voting poll using PHP & MySQL TypeError: Error #2007: Parameter text must be non-null.

    I am getting this back:
    TypeError: Error #2007: Parameter text must be non-null.
    at flash.text::TextField/set text()
    at AS3_Flash_Poll_PHP_MySQL_fla::WholePoll_1/completeHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()
    PHP code:
    <?php
    // ---------------------------------------- Section 1 -----------------------------------------------
    //  IMPORTANT!!!! Connect to MySQL database here(put your connection data here)
    mysql_connect("ginaty05.fatcowmysql.com","fall2010","@regina") or die (mysql_error());
    mysql_select_db("poll_2010") or die (mysql_error());
    // When Flash requests the totals initially we run this code
    if ($_POST['myRequest'] == "load_numbers") {
    // Query the totals from the database
        $sql1 = mysql_query("SELECT id FROM votingPoll WHERE choice='1'");
        $choice1Count = mysql_num_rows($sql1);
        $sql2 = mysql_query("SELECT id FROM votingPoll WHERE choice='2'");
        $choice2Count = mysql_num_rows($sql2);
        $sql3 = mysql_query("SELECT id FROM votingPoll WHERE choice='3'");
        $choice3Count = mysql_num_rows($sql3);
        echo "choice1Count=$choice1Count";
        echo "&choice2Count=$choice2Count";
        echo "&choice3Count=$choice3Count";
    // ---------------------------------------- Section 2 -----------------------------------------------
    // IF POSTING A USER'S CHOICE
    if ($_POST['myRequest'] == "store_choice") {
        //Obtain user IP address
        $ip = $_SERVER['REMOTE_ADDR'];
        // Create local variable from the Flash ActionScript posted variable
        $userChoice = $_POST['userChoice'];
        $sql = mysql_query("SELECT id FROM votingPoll WHERE ipaddress='$ip'");
        $rowCount = mysql_num_rows($sql);
        if ($rowCount == 1) {
    $my_msg = "You have already voted in this poll.";
    print "return_msg=$my_msg";
        } else {
    $sql_insert = mysql_query("INSERT INTO votingPoll (choice, ipaddress) VALUES('$userChoice','$ip')")  or die (mysql_error());
    $sql1 = mysql_query("SELECT * FROM votingPoll WHERE choice='1'");
    $choice1Count = mysql_num_rows($sql1);
    $sql2 = mysql_query("SELECT * FROM votingPoll WHERE choice='2'");
    $choice2Count = mysql_num_rows($sql2);
    $sql3 = mysql_query("SELECT * FROM votingPoll WHERE choice='3'");
    $choice3Count = mysql_num_rows($sql3);
    $my_msg = "Thanks for voting!";
            echo "return_msg=$my_msg";
            echo "&choice1Count=$choice1Count";
    echo "&choice2Count=$choice2Count";
    echo "&choice3Count=$choice3Count";
    ?>
    AS3 code:
    stop(); // Stop the timeline since it does not need to travel for this to run
    // Assign a variable name for our URLVariables object
    var variables1:URLVariables = new URLVariables();
    //  Build the varSend variable
    var varSend1:URLRequest = new URLRequest("parse_my_poll.php");
    varSend1.method = URLRequestMethod.POST;
    varSend1.data = variables1;
    // Build the varLoader variable
    var varLoader1:URLLoader = new URLLoader;
    varLoader1.dataFormat = URLLoaderDataFormat.VARIABLES;
    varLoader1.addEventListener(Event.COMPLETE, completeHandler1);
    // Set variable to send to PHP here for the varloader below
    variables1.myRequest = "load_numbers";  
    // Send data to php file now, and wait for response using the COMPLETE event
    varLoader1.load(varSend1);
    function completeHandler1(event:Event):void{
        count1_txt.text = "" + event.target.data.choice1Count;
        count2_txt.text = "" + event.target.data.choice2Count;
        count3_txt.text = "" + event.target.data.choice3Count;
    // hide the little processing movieclip
    processing_mc.visible = false;
    // Initialize the choiceNum variable that we will use below
    var choiceNum:Number = 0;
    // Set text formatting colors for errors and success messages
    var errorsFormat:TextFormat = new TextFormat();
    errorsFormat.color = 0xFF0000; // bright red
    var successFormat:TextFormat = new TextFormat();
    successFormat.color = 0x00FF00; // bright green
    // Button Click Functions
    function btn1Click(event:MouseEvent):void{
        choiceNum = 1;
        choice_txt.text = choice1_txt.text;
    function btn2Click(event:MouseEvent):void{
        choiceNum = 2;
        choice_txt.text = choice2_txt.text;
    function btn3Click(event:MouseEvent):void{
        choiceNum = 3;
        choice_txt.text = choice3_txt.text;
    // Button Click Listeners
    btn1.addEventListener(MouseEvent.CLICK, btn1Click);
    btn2.addEventListener(MouseEvent.CLICK, btn2Click);
    btn3.addEventListener(MouseEvent.CLICK, btn3Click);
    // Assign a variable name for our URLVariables object
    var variables:URLVariables = new URLVariables();
    //  Build the varSend variable
    var varSend:URLRequest = new URLRequest("parse_my_poll.php");
    varSend.method = URLRequestMethod.POST;
    varSend.data = variables;
    // Build the varLoader variable
    var varLoader:URLLoader = new URLLoader;
    varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    varLoader.addEventListener(Event.COMPLETE, completeHandler);
    // Handler for PHP script completion and return
    function completeHandler(event:Event):void{
        // remove processing movieclip
        processing_mc.visible = false;
        // Clear the form fields
        choice_txt.text = "";
        choiceNum = 0;
        // Load the response from the PHP file
        status_txt.text = event.target.data.return_msg;
        status_txt.setTextFormat(errorsFormat);
        if (event.target.data.return_msg == "Thanks for voting!") {
            // Reload new values into the count texts only if we get a proper response and new values
            status_txt.setTextFormat(successFormat);
            count1_txt.text = "" + event.target.data.choice1Count;
            count2_txt.text = "" + event.target.data.choice2Count;
            count3_txt.text = "" + event.target.data.choice3Count;
    // Add an event listener for the submit button and what function to run
    vote_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
    // Validate form fields and send the variables when submit button is clicked
    function ValidateAndSend(event:MouseEvent):void {
        //validate form fields
        if(!choice_txt.length) {  
            // if they forgot to choose before pressing the vote button
            status_txt.text = "Please choose before you press vote.";  
            status_txt.setTextFormat(errorsFormat);
        } else {
            status_txt.text = "Sending...";
            processing_mc.visible = true;
            // Ready the variables for sending
            variables.userChoice = choiceNum;
            variables.myRequest = "store_choice";  
            // Send the data to the php file
            varLoader.load(varSend);
        } // close else after form validation
    } // Close ValidateAndSend function ////////////////////////

    This error means that you are trying to set the text field but there is no data in the variable. As a first step, try to identify where this is happening, eg Is it the first call, or once you have submitted your data or only if you try to submit data second time?
    Trace out the data that is returned for both completeHandlers to see if there is a missing var. Try this for "load_numbers" and "store_choice". Do it twice for "store_choice". Do you get back what you expected?
    You could also try altering the php to return some fixed dummy variables, eg  choice1Count=11&choice2Count=22&choice3Count=33, etc. If this works then you know that the error is in the PHP.
    It looks to me like the issue is when you submit the data a second time and just get back the return_msg - the handler then tries to assign the choice1Count etc but doesn't have any count data back from the poll.php.
    Test that there is data before assigning it, eg
        if(event.target.data.choice1Count){
            count1_txt.text =  event.target.data.choice1Count;
            count2_txt.text =  event.target.data.choice2Count;
            count3_txt.text =  event.target.data.choice3Count;

  • ActionScript 3 + PHP: TypeError: Error #2007: Parameter text must be non-null.

    Hi - Still new to flash as3 and php -
    it is a contact form page - user puts in information - i am to receive it in an email address their information
    as well the variables get sent back from the php to the .swf file.
    I am receiving these errors and not knowing how to fix them.
    any help would be much appreciated. thank you in advance really.
    below are the errors in flash - as3 code - and php code setup.
    errors:
    ActionScript 3 + PHP: TypeError: Error #2007: Parameter text must be non-null:
      at flash.text::TextField/set text()
              at kwangjaekim_fla::wholeform_16/completeHandler()
              at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
              at flash.events::EventDispatcher/dispatchEvent()
              at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    my as3 code is the following:
    // build variable name for the URL Variables loader
    var variables:URLVariables = new URLVariables();
    //Build the varSend variable
    var varSend:URLRequest = new URLRequest("contact_parse.php");
    varSend.method = URLRequestMethod.POST;
    varSend.data = variables;
    //Build the varLoader variable
    var varLoader:URLLoader = new URLLoader;
    varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    varLoader.addEventListener(Event.COMPLETE, completeHandler);
    //handler for the PHP  script completion and return of status
    function completeHandler(event:Event):void{
              //value is cleared at ""
              name_txt.text = "";
              contact_txt.text = "";
              msg_txt.text = "";
              //Load the response PHP here
              status_txt.text = event.target.data.return_msg;
    //Add event listener for submit button click
    submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
    //function ValidateAndSend
    function ValidateAndSend(event:MouseEvent):void{
              //validate fields
              if(!name_txt.length){
                        status_txt.text = "Please Enter Your Name";
              }else if(!contact_txt.length){
                        status_txt.text = "Please Enter Your Contact Detail";
              }else if(!msg_txt.length){
                        status_txt.text = "Please Enter Your Message";
              }else {
              // ready the variables in form for sending
      variables.userName = name_txt.text;
              variables.userContact = contact_txt.text;
              variables.userMsg = msg_txt.text;
              // Send the data to PHP now
    varLoader.load(varSend);
    submit_btn.addEventListener(MouseEvent.CLICK, function(){MovieClip(parent).gotoAndPlay(151)});
              } // Close else condition for error handling
    } // Close validate and send function
    my php code is the following:
    <?php
    // Create local PHP variables from the info the user gave in the Flash form
    $senderName   = $_POST['userName'];
    $senderEmail     = $_POST['userContact'];
    $senderMessage = $_POST['userMsg'];
    // Strip slashes on the Local variables
    $senderName   = stripslashes($senderName);
    $senderContact     = stripslashes($senderContact);
    $senderMessage   = stripslashes($senderMessage);
    //!!!!!!!!!!!!!!!!!!!!!!!!!     change this to my email address     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                              $to = "put iny me email address";
         // Place sender Email address here
        $from = "$senderContact ";
        $subject = "Contact from your site";
        //Begin HTML Email Message
        $message = <<<EOF
    <html>
      <body bgcolor="#FFFFFF">
    <b>Name</b> = $senderName<br /><br />
    <b>Contact</b> = <a href="mailto:$senderContact">$senderEmail</a><br /><br />
    <b>Message</b> = $senderMessage<br />
      </body>
    </html>
    EOF;
       //end of message
        $headers  = "From: $from\r\n";
        $headers .= "Content-type: text/html\r\n";
        $to = "$to";
        mail($to, $subject, $message, $headers);
    exit();
    ?>
    thank you once again
    jay

    thank you Ned -
    i put in the trace line as you mentioned -
    and this is what i received -
    returns: undefined
    TypeError: Error #2007: Parameter text must be non-null
              at flash.text::TextField/set text()
              at kwangjaekim_fla::wholeform_16/completeHandler()
              at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
              at flash.events::EventDispatcher/dispatchEvent()
              at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    what does this mean exactly?
    thank you for the help really

  • As3 TypeError:#2007 Parameter text must be non-null can't fix.

    I have comment box project. As3+php based project.And have #2007 Error.Try to fix but can't do anything.If can help it would be very helpful.Error part like this:
    TypeError: Error #2007: Parameter text must be non-null. at flash.text::TextField/set text() at comment2_fla::mc_1/completeHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete()
    First Part of Code:
    var variables_re:URLVariables = new URLVariables();
    var varSend_re:URLRequest = new URLRequest("guestbookParse.php");
    varSend_re.method = URLRequestMethod.POST;
    varSend_re.data = variables_re;
    var varLoader_re:URLLoader = new URLLoader;
    varLoader_re.dataFormat = URLLoaderDataFormat.VARIABLES;
    varLoader_re.addEventListener(Event.COMPLETE,completeHandler_re);
    function completeHandler_re(event:Event):void{
              if(event.target.data.returnBody==""){
                 gbOutput_txt.text = "no data";
                 } else {
                           gbOutput_txt.condenseWhite = true;
                           gbOutput_txt.htmlText = "" + event.target.data.returnBody;
    variables_re.comType = "requestEntries";
    varLoader_re.load(varSend_re);
    Second Part of Code:
    msg_txt.restrict = "ığüşöç A-Za-z 0-9";
    name_txt.restrict = "ığüşöç A-Za-z 0-9";
    var errorsFormat:TextFormat = new TextFormat();
    errorsFormat.color = 0XFF0000;
    processing_mc.visible = false;
    var variables:URLVariables = new URLVariables();
    var varSend:URLRequest = new URLRequest("guestbookParse.php");
    varSend.method = URLRequestMethod.POST;
    varSend.data = variables;
    var varLoader:URLLoader = new URLLoader;
    varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    varLoader.addEventListener(Event.COMPLETE,completeHandler);
    function completeHandler(event:Event):void{
              processing_mc.visible = false;
              name_txt.text = "";
              msg_txt.text = "";
              status_txt.text = event.target.data.return_msg;
              gbOutput_txt.condenseWhite = true;
              gbOutput_txt.htmlText=""+event.target.data.returnBody;
    submit_btn.addEventListener(MouseEvent.CLICK,ValidateAndSend);
    function ValidateAndSend(event:MouseEvent):void{
              if(!name_txt.length){
                        status_txt.text = "İsminizi Girin";
                        status_txt.setTextFormat(errorsFormat);
              } else if (!msg_txt.length){
                        status_txt.text = "Yorum Girin";
                        status_txt.setTextFormat(errorsFormat);
              }else{
                        processing_mc.visible = true;
                        variables.comType = "parseComment";
                        variables.userName = name_txt.text;
                        variables.userMsg = msg_txt.text;
                        varLoader.load(varSend);
                        status_txt.text = "Yorumunuz Eklendi...";
    Php Part:
    <?php
    mysql_connect("localhost","root","") or die (mysql_error());
    mysql_select_db("yorum") or die (mysql_error());
    if ($_POST['comType'] == "parseComment") {
        $name = $_POST['userName'];
              $location = $_POST['userLocation'];
        $comment = $_POST['userMsg'];
        $sql = mysql_query("INSERT INTO guestbook (name, post_date, comment, location)
            VALUES('$name', now(),'$comment','$location')") 
            or die (mysql_error());
              $body = "";
        $sql = mysql_query("SELECT * FROM guestbook ORDER BY post_date DESC");
        while($row = mysql_fetch_array($sql)) {
                        $id = $row["id"];
                        $name = $row["name"];
                        $post_date = $row["post_date"];
                        $comment = $row["comment"];
                        $location = $row["location"];
                        $comment = stripslashes($comment);
                        $name = eregi_replace("&#39;", "'",  $name);
                        $location = eregi_replace("&#39;", "'",  $location);
                        $comment = eregi_replace("&#39;", "'", $comment);
                        $post_date = strftime("%b %d, %y", strtotime($post_date));
                        $body .= '<u><b><font color="#790000">' . $name . '</font>    |    <font color="#9B9B9B">' . $location . '</font>      |      <font color="#9B9B9B">' . $post_date . '</font></b></u>
                        <br />
                        '.$comment.'
                        <br />
                        <br />
        mysql_free_result($sql);
        mysql_close();
         echo "return_msg=Entry has been added successfully $name, thanks!&returnBody=$body";
         exit();
    if ($_POST['comType'] == "requestEntries") {
        $body = "";
        $sql = mysql_query("SELECT * FROM guestbook ORDER BY post_date DESC");
        while($row = mysql_fetch_array($sql)) {
                        $id = $row["id"];
                        $name = $row["name"];
                        $post_date = $row["post_date"];
                        $comment = $row["comment"];
                        $location = $row["location"];
                        $comment = stripslashes($comment);
                        $post_date = strftime("%b %d, %y", strtotime($post_date));
                        $body .= '<u><b><font color="#790000">' . $name . '</font>    |    <font color="#9B9B9B">' . $location . '</font>      |      <font color="#9B9B9B">' . $post_date . '</font></b></u>
                        <br />
                        '.$comment.'
                        <br />
                        <br />
        mysql_free_result($sql);
        mysql_close();
        echo "returnBody=$body";
        exit();
    ?>

    use the trace function to debug:
    function completeHandler(event:Event):void{
              processing_mc.visible = false;
              name_txt.text = "";
              msg_txt.text = "";
              status_txt.text = event.target.data.return_msg;
              gbOutput_txt.condenseWhite = true;
    trace("::"+event.target.data.returnBody+"::");
              gbOutput_txt.htmlText=""+event.target.data.returnBody;
    // and then initialize $body outside those if-statements or ensure you're sending an appropriate comType variable and value. 
    // right now it doesn't look like you're even sending comType with varSend.
    // ie, you must assign the urlrequest data property AFTER urlvariable variables/values are assigned.

Maybe you are looking for