Link to home
Start Free TrialLog in
Avatar of Brian Lin
Brian LinFlag for United States of America

asked on

A text effect question with onEnterFrame

Hi, experts:

I got this text fly in effects and I try to change from onClipevent to onEnterFrame = function()...move script from movie clip to time frame.... then it is totally not working.... I am not sure what to do next....please any tips are welcome...thanks

link to file = http://www.brianlinstudio.com/10textanimation.fla.zip
ASKER CERTIFIED SOLUTION
Avatar of CyanBlue
CyanBlue
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brian Lin

ASKER

hi, i have a question.... when the text coming in.... the last few characters do not have same space between them...how to fix them ?? thanks
Well...  I don't know how to tackle that one when the letterSpacing is set to a constant(16)...
and there isn't any good way to check the width of the character...

You could probably try this line and see if that works...  If not, I have no clue...  :(

Find this line...
this._parent["letter"+letterNum]._x = startX + letterNum*letterSpacing;

Add this line before that line...
letterSpacing = this._parent["letter"+letterNum]._width;
// or
letterSpacing = this._parent["letter"+letterNum].letterText._width;

CyanBlue
i think it is because some letters are fatter then others.... like O is wider then I and O does not have space around but I has a lot empty space...so, maybe that is why it looks a little strange....
Yup...  That's what I meant...  :)

CyanBlue
I put these script together.... feel a bit strange... do you see any error in the script ? i combine the text effect and a mouse trailer. thanks

////////////////////////////////
///////// Text effects /////////
////////////////////////////////
MC_point.onLoad = function() {
      // constants
      text = "CONGRADULATIONS!";
      letterSpacing = 14;
      // how far apart the letters are
      startX = 90;
      // horizontal position of leftmost letter
      startY = 20;
      // vertical position of letters
      startScale = 600;
      // how big the letters start
      scaleStep = 50;
      // how much the letters shrink per frame
      startRate = 3;
      // how often new letters appear
      // create all movie clips
      for (i=0; i<text.length; i++) {
            MC_point._parent.attachMovie("Letter", "Letter"+i, i);
            // fill with letter
            MC_point._parent["letter"+i].letterText = text.charAt(i);
            // start in correct position
            MC_point._parent["letter"+i]._x = startX+i*letterSpacing;
            MC_point._parent["letter"+i]._y = startY;
            // start at largest size
            MC_point._parent["letter"+i]._xscale = startScale;
            MC_point._parent["letter"+i]._yscale = startScale;
            // make invisible until needed
            MC_point._parent["letter"+i]._visible = false;
      }
      // start with first letter
      lastLetter = 0;
      MC_point._parent["letter0"]._visible = true;
      frame = 0;
};
MC_point.onEnterFrame = function() {
      // change all letters until last visible one
      for (i=0; i<=lastLetter; i++) {
            if (MC_point._parent["letter"+i]._xscale>100) {
                  MC_point._parent["letter"+i]._xscale -= scaleStep;
                  MC_point._parent["letter"+i]._yscale -= scaleStep;
            }
      }
      // make one more letter visible, when enough frames have passed
      frame++;
      if (frame>=startRate) {
            frame = 0;
            lastLetter++;
            MC_point._parent["letter"+lastLetter]._visible = true;
      }
};

////////////////////////
//////Mouse trailer/////
////////////////////////
var mouseListener:Object = new Object();
see._visible = 1;
_level0.i = 1;
star_Parent._x = starParent._y = -100;

mouseListener.onMouseMove = function() {
     _level0.i++;
     star_Parent.duplicateMovieClip("star"+ _level0.i, _level0.i + 10);
     star_Parent._parent["star"+i]._x = _level0._xmouse;
     star_Parent._parent["star"+i]._y = _level0._ymouse;
     star_Parent._parent["star"+i].onEnterFrame = function()
      {
           if (see == "0")
           {
                 this._visible = 0;
           }
           else
           {
                 this._alpha -= 5;
                 this._rotation += 2;
                 this._xscale -= 5;
                 this._yscale -= 5;
                 if (this._alpha<=10)
                 {
                       this.removeMovieClip();
                 }
           }
     };
};
Mouse.addListener(mouseListener);
I don't know what I am looking for...
Can you tell me what is not working and how it should be working???

CyanBlue
ok, the problem is.... the text does not always show fully after I add the Mouse trailer script.....sometimes one letter does not show ( ex, ! or O or N ) ..... maybe there is something in Mouse trailer script causes these problems
The only thing I can think of the duplicate depth...

 star_Parent.duplicateMovieClip("star"+ _level0.i, _level0.i + 10);

Change that to this...

 star_Parent.duplicateMovieClip("star"+ _level0.i, _level0.i + 10 + 1000);

CyanBlue
yes, the script is prefect now.... thanks a lot !!!