A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: AS2: Hard - Type effect in a dynamic textfield in whose html = true

  1. #1
    Senior Member
    Join Date
    Aug 2001
    Location
    Philippines
    Posts
    515

    AS2: Hard - Type effect in a dynamic textfield in whose html = true

    I only found on the boards how to make it on normal dynamic textfields. But I wanted to use it in dynamic textfields that renders text in html format.

    I started 4 hours ago.. and I think I'm gonna stop first. It's a bit tiring and it looks like it's going to be very tough to do this using if else's.

    I wanna know if any one here has attempted to do such a thing?

    How I pictured the program to go through a given text, such as:
    <P ALIGN="CENTER"> HELLO<MAN<What's your name </P>

    First, it will write the tags on a new string:

    <P ALIGN="CENTER"></P>

    But, it will remember where the non-tag portion is (location 18 to 46), then what it does is sets the textfeild.htmlText to <P ALIGN="CENTER"></P>

    Second, it will slowly write in the non-tags, probably through an interval.

    a: <P ALIGN="CENTER"> </P>
    b: <P ALIGN="CENTER"> H</P>
    c: <P ALIGN="CENTER"> HE</P>
    etc..

    it should work, and it allows the person to use html tags.

    But... hehe it's a lot of work for such a simple effect.
    Ramon Miguel M. Tayag

  2. #2
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    This is it using onEnterFrame, you easily convert it to an interval if necessary
    code:

    mytextbox.html = true;
    mystring = "HELLO THERE";
    ind = 0;
    this.onEnterFrame = function() {
    ind++;
    mytextbox.htmlText = "<P ALIGN=\"CENTER\">" + mystring.slice(0, ind) + "</P>";
    //if you want to repeat
    if(ind == mystring.length) {
    ind = 0;
    }
    }


  3. #3
    Senior Member
    Join Date
    Aug 2001
    Location
    Philippines
    Posts
    515
    yup, that I got But thank you anyway!

    What I mean is.. given any html tag, it will automatically know what the html tags are and just type in the normal text.

    So that means it has to go through the given string first - find out what the html tags are, and write them on a new string, while remembering where the non tags are. So, when it starts typing, it inserts the strings in the respective areas.
    Ramon Miguel M. Tayag

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center