ho acquistato un testo di script vari per flash ( Flash, trucchi e segreti; Sham Bhangal. O'Reilly).
Sul sito dell'editore http://www.oreilly.com/
consentono di scaricare una parte degli script pubblicati sul testo.
Quello che interessa a me per l'appunto è uno con che riproduce l'effettto macchina da scrivere.
Lo script funziona bene, ma non consente di andare a capo. Anche se al testo dinamico applico l'opzione multiriga.
E' possibile secondo voi, partendo da questo script aggiungere questa possibilità?
Se sì, come fare?![]()
Agiungo. E' possibile regolare la spaziatura fra le lettere? Ci ho provato ma non ci sono riuscito.
Ecco lo script in questione:
in rosso c'è il contenuto del testo
function typewriter(target:MovieClip, delay:Number):Void {
target.interval = function() {
target._visible = true;
keyHit.start(0, 1);
clearInterval(target.intervalID);
};
target.intervalID = setInterval(target, "interval", delay);
target._visible = false;
}
function placeText(target:MovieClip, x:Number, y:Number, banner:String, tFormat:TextFormat):Void {
// For each character...
for (var i = 0; i<banner.length; i++) {
// Create a clip and place the current
// character of the text field inside it.
var char:MovieClip = target.attachMovie("letter", "char"+i, target.getNextHighestDepth());
char.field.text = banner.substr(i, 1);
char._x = x;
char._y = y;
// Add the width of the current text character to the
// next letter's x position.
x += tFormat.getTextExtent(char.field.text).width;
//
// Here is the effect call.
var timer = i*200+Math.round(Math.random()*200);
typewriter(char, timer);
}
}
var keyHit = new Sound(this);
keyHit.attachSound("typeClick");
var format:TextFormat = new TextFormat();
format.font = "Arial";
format.size = 24;
placeText(this,100,100,"This is a text effect .",format);
ciao![]()

Rispondi quotando