import caurina.transitions.Tweener; function typeEffect ( txt:TextField, words:String, tweenerObject:Object ):Object { var o = { words:words, per:0, txt:txt }
var to = tweenerObject != undefined ? tweenerObject : {} to.per = 1; to.onUpdate = function() { var inx = Math.round( this.per * this.words.length ); this.txt.text = (inx == this.words.length ) ? this.words : this.words.substr ( 0, inx ) + '_'; }; Tweener.addTween ( o, to ); return o; } var tweenerObject:Object = {time:4, transition:'easeOutCubic'}; var effectObject:Object = typeEffect( myText, "This is a Basic Tweener Typewriter", tweenerObject ); _____________________________ Jesse Graupmann www.jessegraupmann.com www.justgooddesign.com/blog/ _____________________________ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Omar Fouad Sent: Tuesday, September 04, 2007 1:48 PM To: Flashcoders mailing list Subject: [Flashcoders] Applying easing effect to type effect Hi, i got the following code: effect = function (txt) { string = txt; total = string.length; var ta:Array =[] for (i=0;i<total;i++) { ta.push(string.substr(0, i+1)) } i=0; onEnterFrame = function () { if(i<total-1) { i++ text.text = ta[i] +"_"; }else{ text.text = txt; delete this.onEnterFrame; }; }; }; effect("blah blah blah blah"); This writes in a dynamic text field a string with a "typewriter" effect.... I saw, by the way, in some websites, that the typewrite effect is performed with an "easeOut" effect and i guess it can be achieved by using the tweener class by Zeh, but I have no idea about how to implement in my code. Any help??? Hasta... -- Omar M. Fouad _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com