Codice PHP:
prew._visible = false; //hide visible text (textWriter:)
kontrol.gotoAndStop(15); //setting the moving point for effect
//*****************************************************************************
//tweening function ***********************************************************
import mx.transitions.*;
import mx.transitions.easing.*;
function hare(mc, propertY, neWValue, olDValue, speed) {
new Tween(mc, propertY, Strong.easeInOut, olDValue, neWValue, speed, true);
}
//end tweening function *******************************************************
//*****************************************************************************
var a:Number=1; //create movie order
var firstHand:MovieClip; //current effect temporary movie for effect1
var secondHand:MovieClip; //current effect temporary movie for effect2
var thirdHand:MovieClip; //current effect temporary movie for effect3
function effect1(spEed:Number, textFielD:TextField, inpuTText:String):Void {
delete firstHand.onEnterFrame; //delete the previous effect.
firstHand.removeMovieClip(); //remove the old temporary movie clip.
var mc = this.createEmptyMovieClip("aa"+a, a); //create a new temporary movie clip
firstHand = mc //adding the current temporary movie clip
a++; //movie order increase
var temporaryMc:MovieClip = mc;
var cOunter:Number = 1; //counter for animate
var temporaryText:String; //create a temporary string object
var animatedText:String = textFielD.text; //create a string object for slicing text
var temporaryAnimatedText:String; //create a temporary animated string object
var tmp:String = "";
var outpuTText:String = ""; //finally text.
var stringLength:Number = 50;
if (inpuTText.length>animatedText.length) { //setting counter according to old or new text length.
stringLength = inpuTText.length; //if new text length bigger then old text length, the length set new text length
} else {
stringLength = animatedText.length; //if old text length bigger then new text length, the length set old text lenght
}
temporaryMc.onEnterFrame = function():Void {
temporaryText = substring(inpuTText, cOunter, spEed); //cutting current text
temporaryAnimatedText = animatedText.slice(cOunter, animatedText.length); //setting the animated text
tmp += temporaryText; //while animation, wrting the current text
cOunter += spEed; //sub, speed and counter
textFielD.htmlText = outpuTText.concat(tmp, temporaryAnimatedText); //last process, text is added to text field
if (cOunter>(stringLength+spEed)) { //finishing the animation.
delete temporaryMc.onEnterFrame;
temporaryMc.removeMovieClip();
}
};
}
function effect2(spEed:Number, textFielD1:TextField, textFielD2:TextField, inpuTText:String):Void {
delete secondHand.onEnterFrame; //delete the previous effect.
secondHand.removeMovieClip(); //remove the old temporary movie clip.
var mc = this.createEmptyMovieClip("aa"+a, a); //create a new temporary movie clip
secondHand = mc //adding the current temporary movie clip
a++; //movie order increase
var temporaryMc:MovieClip = mc;
var cOunter:Number = 1; //counter for animate
var temporaryText:String; //create a temporary string object
var animatedText:String = textFielD1.text; //create a string object for slicing text
var temporaryAnimatedText:String; //create a temporary animated string object
var tmp:String = "";
var outpuTText:String = ""; //finally text.
var stringLength:Number = 50;
textFielD2.text = animatedText;
if (inpuTText.length>animatedText.length) { //setting counter according to old or new text length.
stringLength = inpuTText.length; //if new text length bigger then old text length, the length set new text length
} else {
stringLength = animatedText.length; //if old text length bigger then new text length, the length set old text lenght
}
temporaryMc.onEnterFrame = function():Void {
temporaryText = substring(inpuTText, cOunter, spEed);//cutting current text
temporaryAnimatedText = animatedText.slice(cOunter, animatedText.length); //setting the animated text
tmp += temporaryText; //while animation, wrting the current text
cOunter += spEed; //sub, speed and counter
textFielD1.htmlText = tmp;
textFielD2.htmlText = outpuTText.concat(tmp, temporaryAnimatedText); //last process, text is added to text field
if (cOunter>(stringLength+spEed)) { //finishing the animation.
delete temporaryMc.onEnterFrame;
temporaryMc.removeMovieClip();
}
};
}
function effect3(spEed:Number, textFielD1:TextField, inpuTText:String):Void {
delete thirdHand.onEnterFrame; //delete the previous effect.
thirdHand.removeMovieClip(); //remove the old temporary movie clip.
var mc = this.createEmptyMovieClip("aa"+a, a); //create a new temporary movie clip
thirdHand = mc //adding the current temporary movie clip
a++; //movie order increase
var temporaryMc:MovieClip = mc;
var cOunter:Number = 1; //counter for animate
var temporaryText:String; //create a temporary string object
var animatedText:String = textFielD1.text; //create a string object for slicing text
var temporaryAnimatedText:String; //create a temporary animated string object
var tmp:String = "";
var outpuTText:String = ""; //finally text.
var stringLength:Number = 50;
textFielD1.autoSize = true;
if (stringLength<inpuTText.length) { //setting counter according to old or new text length.
if (inpuTText.length<animatedText.length) {
stringLength = animatedText.length; //if new text length bigger then old text length, the length set new text length
} else {
stringLength = inpuTText.length; //if old text length bigger then new text length, the length set old text lenght
}
}
kontrol.tekst = textFielD1; //setting, up down moving text box
kontrol.play(); //animate start.
temporaryMc.onEnterFrame = function():Void {
temporaryText = substring(inpuTText, cOunter, spEed); //cutting current text
temporaryAnimatedText = animatedText.slice(cOunter, animatedText.length); //setting the animated text
tmp += temporaryText; //while animation, wrting the current text
cOunter += spEed; //sub, speed and counter
textFielD1.htmlText = outpuTText.concat(tmp, temporaryAnimatedText);//last process, text is added to text field
if (cOunter>(stringLength+spEed)) {
delete temporaryMc.onEnterFrame;
temporaryMc.removeMovieClip();
kontrol.gotoAndStop(15);
}
};
}