5 Replies Latest reply on May 9, 2008 3:21 PM by clbeech

    Dynamic text field not rendering HTML

    claudiaanselmo
      Hi

      I have a dynamic textfield which is populated with php and mysql and I am having a hard time figuring out why it won't render the text in HTML. Any ideas?

      Thanks
        • 1. Re: Dynamic text field not rendering HTML
          clbeech Level 3
          do you have the field's html property set to true? and are you assigning the text to the field using: .htmlText rather that .text? additionally, have you embedded the font in the field?
          • 2. Re: Dynamic text field not rendering HTML
            claudiaanselmo Level 1
            HTML property = true
            Font = embedded

            This is how I assign text to the field:

            (entries = the dynamic textfield)

            function loadEntries(act, increment) {
            // Define NumLow as a Number
            num = new Number(_parent.NumLow);
            // Act accordingly
            if(act == "Next") {
            // Add increment
            _parent.NumLow = num + increment;
            } else if(act == "Previous") {
            _parent.NumLow = num - increment;
            } else {
            // Load default - i.e. 0
            _parent.NumLow = 0;
            }
            // Update Statistics
            _parent.read.low.text = _parent.NumLow;
            _parent.read.high.text = Number(_parent.NumLow) + 10;
            // Show Please wait text
            _parent.read.entries.text = "Loading entries... Please wait...";
            // Begin Loading
            myEntries = new LoadVars();
            myEntries.ref = this;
            myEntries.load("GuestBook.php?action=read&r="+random(999)+"&NumLow="+_parent.NumLow);
            myEntries.onLoad = function(success){
            if(success){
            // Assign output to components and objects
            entries.text = this.entries;
            totalEntries.text = this.totalEntries;
            //Update values to calculate prev/next button visibility
            num = Number(_parent.NumLow)
            var totalEntries = Number(this.totalEntries);
            var total = num+increment
            //Hide/show next button
            if(total<totalEntries) this.ref.next_button._visible = true;
            else this.ref.next_button._visible = false;
            //Hide/show previous button
            if(num==0) prev_button._visible = false;
            else prev_button._visible = true;
            //Hide/show next button
            if(total<totalEntries) this.ref.nxt._visible = true;
            else this.ref.nxt._visible = false;
            //Hide/show previous button
            if(num==0) pre._visible = false;
            else pre._visible = true;

            }
            }
            }
            // Load Default
            _parent.read.loadEntries("Default", 10);
            stop();
            //Button Functions
            btn_teken.onRollOver = over;
            btn_teken.onRollOut = out;
            next_button.onRollOver = over;
            next_button.onRollOut = out;
            prev_button.onRollOver = over;
            prev_button.onRollOut = out;

            function over()
            {
            this.gotoAndPlay(2);
            }

            function out()
            {
            this.gotoAndPlay(11);
            }

            btn_teken.onRelease = function(){
            fadein.gotoAndPlay(2);
            }
            next_button.onPress = function(){
            loadEntries("Next", 10);
            }
            prev_button.onPress = function(){
            loadEntries("Previous", 10);
            }
            //Setting txtfield Alpha
            entries.depthChild0._alpha = 0

            Maybe I'm doing something completely wrong but I didn't write the original code. I actually bought it online but have had a few problems with it and the guy I bought it from isn't replying my emails and I need to fix it myself now. there is a separate .php file. Maybe I should include the HTML code within the php file? Sounds messy though...

            Any help appreciated.

            Thanks!
            • 3. Re: Dynamic text field not rendering HTML
              clbeech Level 3
              well it appears that whoever wrote this code did not expect a return from the php in the form of an html string - I'm wondering why you think that necessary? you've said "render the text in HTML" what do you mean by that? do you mean your not getting anything when the page is online?

              this may be more of a 'path' issue than a field issue.
              is the GuestBook.php file in the same directory as your swf file?
              does the php file include the proper 'login string' to access your MySQL db?
              • 4. Re: Dynamic text field not rendering HTML
                claudiaanselmo Level 1
                Here's just a couple of lines of the php file:

                print '<b>Name: </b>' . $name . '<br><b>Message: </b>' . $comments . '<br><i>Date: ' . $time . '</i><br>----------------------------------------------------------<br>';
                $i++;

                This is the output in the text field:

                <b>Name: </b>John <br><b>Message: </b>good work!<br><i>Date: 2008-05-06 23:12:13</i><br>

                The html code is showing. How do I get rid of it without ruining the format?
                Maybe it's a really simple thing but because I'm not really into flash I'm a bit at a loss.

                Thanks for the help


                • 5. Re: Dynamic text field not rendering HTML
                  clbeech Level 3
                  yep looks like it's outputting html - so then the line:

                  entries.text = this.entries;

                  should be:

                  entries.htmlText = this.entries;

                  try that and see what happens.