A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Scripted Alpha Fade on Text

  1. #1
    Senior Member bluephoenix's Avatar
    Join Date
    Nov 2002
    Location
    Upstate/Central New York
    Posts
    144

    Scripted Alpha Fade on Text

    I'm having a problem scripting an alpha fade and I've been working on this for the past few hours. I'm ready to pull my hair out!

    Here is my code:

    Code:
    function ExposeText(textMC) {
    
        if (textMC._alpha < 100) {
            textMC._alpha += 5;
    
        } else {
            clearInterval(textMC.interval);
        }
    
        updateAfterEvent( )
    }
    
    var speed = 30;
    
    var T = this.createEmptyMovieClip("T", this.getNextHighestDepth());
    
    T.createTextField("textField", 0, 0, 0, 600, 100);
    
    T.textField.text = "We appreciate you sharing this special day with us!";
    
    T._alpha = 0;
    
    T.interval = setInterval(ExposeText, speed, T);
    I did some tracing and found that the _alpha value does indeed change... just not reflected in the display of the text.

    If I add a line to the movie clip with code that resembles the following:

    Code:
    T.lineStyle(50, 0x000, 100);
    T.moveTo(0,0);
    T.lineTo(100,100);
    ... the line fades in but the text does not.

    I saw that there is an _alpha property listed for text fields, so I even tried adding within the function:

    Code:
    textMC.textField._alpha = textMC._alpha;
    That didn't work either.

    Can anyone shead some insight on this for me?

    Thanks profusely in advance!!

    -Tim
    Timothy Boronczyk
    -http://home.twcny.rr.com/organman20/bluephoenix

  2. #2
    The Ancient
    Join Date
    Mar 2000
    Location
    Michigan, USA
    Posts
    213
    I don't believe text fields have an alpha setting. So, Flash is just interpreting it as another variable.

    You need to put the textfield in an MC, and then alpha the mc.
    jahasloth

  3. #3
    Senior Member bluephoenix's Avatar
    Join Date
    Nov 2002
    Location
    Upstate/Central New York
    Posts
    144
    Thanks jahasloth. That's what I'm trying to do with my code, but it's not successful.

    Code:
    var T = this.createEmptyMovieClip("T", this.getNextHighestDepth());
    
    T.createTextField("textField", 0, 0, 0, 600, 100);
    
    T.textField.text = "We appreciate you sharing this special day with us!";
    
    T._alpha = 0;
    -Tim
    Timothy Boronczyk
    -http://home.twcny.rr.com/organman20/bluephoenix

  4. #4
    The Ancient
    Join Date
    Mar 2000
    Location
    Michigan, USA
    Posts
    213
    Put T in a movie clip.
    Then change your alpha with
    code:
    T._parent._alpha = 0

    jahasloth

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