Brian Lin
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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"+lett erNum]._x = startX + letterNum*letterSpacing;
Add this line before that line...
letterSpacing = this._parent["letter"+lett erNum]._wi dth;
// or
letterSpacing = this._parent["letter"+lett erNum].let terText._w idth;
CyanBlue
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"+lett
Add this line before that line...
letterSpacing = this._parent["letter"+lett
// or
letterSpacing = this._parent["letter"+lett
CyanBlue
ASKER
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
CyanBlue
ASKER
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.attachMov ie("Letter ", "Letter"+i, i);
// fill with letter
MC_point._parent["letter"+ i].letterT ext = 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]._visibl e = 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]._xscal e>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.duplicateMovie Clip("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].onEnte rFrame = 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(mouseLis tener);
//////////////////////////
///////// 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.attachMov
// fill with letter
MC_point._parent["letter"+
// start in correct position
MC_point._parent["letter"+
MC_point._parent["letter"+
// start at largest size
MC_point._parent["letter"+
MC_point._parent["letter"+
// make invisible until needed
MC_point._parent["letter"+
}
// start with first letter
lastLetter = 0;
MC_point._parent["letter0"
frame = 0;
};
MC_point.onEnterFrame = function() {
// change all letters until last visible one
for (i=0; i<=lastLetter; i++) {
if (MC_point._parent["letter"
MC_point._parent["letter"+
MC_point._parent["letter"+
}
}
// make one more letter visible, when enough frames have passed
frame++;
if (frame>=startRate) {
frame = 0;
lastLetter++;
MC_point._parent["letter"+
}
};
////////////////////////
//////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.duplicateMovie
star_Parent._parent["star"
star_Parent._parent["star"
star_Parent._parent["star"
{
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(mouseLis
I don't know what I am looking for...
Can you tell me what is not working and how it should be working???
CyanBlue
Can you tell me what is not working and how it should be working???
CyanBlue
ASKER
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.duplicateMovie Clip("star "+ _level0.i, _level0.i + 10);
Change that to this...
star_Parent.duplicateMovie Clip("star "+ _level0.i, _level0.i + 10 + 1000);
CyanBlue
star_Parent.duplicateMovie
Change that to this...
star_Parent.duplicateMovie
CyanBlue
ASKER
yes, the script is prefect now.... thanks a lot !!!
ASKER