-
Han Zikey
Replied:
(
2/17/2006
At
5:07 AM)
Great!I have used your Tile Transitions component.They are very nice!Thank you,Satori Canton!
-
alex b
Replied:
(
2/18/2006
At
8:33 PM)
that looks so f**kin amazing =D
-
Gabe Nicholson
Replied:
(
2/18/2006
At
9:04 PM)
I guess I know what I'm doing all weekend. Thanks Satori! Very cool stuff!
-
jaime cavazos
Replied:
(
2/23/2006
At
5:00 AM)
That's a great Class, thanks for taking the time to share. Is there any way to enable the text effects to use multiline layout? I noticed that it just builds the effects on a single line. Is there some way to tweak this?
Thanks,
Jaime
-
Satori Canton
Replied:
(
2/23/2006
At
12:43 PM)
The few methods that are included in the class only build on one line. Multi-line effects could be created with two different method calls. But the class is designed to be able to build just about any effect you can imagine. I'm just finishing up a follow up article that I'll be posting soon showing how to use this class to create custom text effects (which could include multi-line effects)
-
Tom Rowley
Replied:
(
3/13/2006
At
6:02 PM)
Great class Satori. I too needed the class to work on multiple lines, but couldnt work out how to do it through the custom text effects.
I did hack your code a little tho to achieve a decent result.
I extended the functions to include paraWidth and lineHeight so you would use it as follows:
m = TextScript.blurIn(this, phrase, xLoc, yLoc, myFormat, delay, paraWidth, lineHeight);
Then in the TextScript.as I did the following amendments:
changed the createEffect function:
--
public static function createEffect(scope:MovieClip, phrase:String, x:Number, y:Number, format:TextFormat, delay:Number, paraWidth:Number, lineHeight:Number, effect:Function):MovieClip {
var m:MovieClip = TextScript.createText(scope, phrase, x, y, format, paraWidth, lineHeight);
TextScript.configureEffect(m, effect, delay);
return(m);
}
--
Changed all the predefined create effect functions, of which this is one(There are 6 in total to edit):
--
public static function typewriter(scope:MovieClip, phrase:String, x:Number, y:Number, format:TextFormat, delay:Number, paraWidth:Number, lineHeight:Number):MovieClip {
return createEffect(scope, phrase, x, y, format, delay, paraWidth, lineHeight, TextScript.getInstance().typewriterTransition);
}
--
And lastly changed the createText function to the following:
--
private static function createText(scope:MovieClip, phrase:String, x:Number, y:Number, format:TextFormat, paraWidth:Number, lineHeight:Number):MovieClip {
var teText:MovieClip = scope.createEmptyMovieClip("ascTextPhrase" + scope.getNextHighestDepth(), scope.getNextHighestDepth());
teText.characterArray = new SatoriArray();
teText.remove = function(m:MovieClip):Void {
this.characterArray.removeItem(m);
m.removeMovieClip();
if(this.characterArray.length == 0) {
this.removeMovieClip();
}
}
var l:Number = phrase.length;
var originalx=x;
var originaly=y;
for(var i:Number = 0; i < l; i++) {
var m:MovieClip = TextScript.createCharacter(teText, phrase.substr(i, 1), format);
m.removeSelf = function() {
this._parent.remove(this);
}
m._x = x;
m._y = y;
m.characterLength = l;
teText.characterArray.push(m);
x += format.getTextExtent(m.field.text).width;
if(x>=paraWidth+originalx&&m.field.text==" "){
x=originalx;
y=y+lineHeight;
}
}
while (l--) {
teText.characterArray[l].characterArray = teText.characterArray.slice(0);
teText.characterArray[l].phraseHeight = teText._height;
teText.characterArray[l].phraseWidth = teText._width;
}
return(teText);
}
--
This checks each end of word to see whether its beyond the paraWidth size, and if it is, starts a new line using the lineHeight.
This isnt perfect, as I would prefer a proper word wrap solution, which would look ahead to see if the next word will extend past the paraWidth, and then start the next line if this is about to happen.
the upshot is a "pseudo" word wrap which works ok, but with the occasional long word sticking out further than it should.
-
Ryan M
Replied:
(
3/29/2006
At
2:35 PM)
Great class, very handy stuff - saved me a lot of time! Although, it would be nice if rather than specifying x and y coordinates for the text to be displayed, the text could be placed inside a Text box (made using the Text Tool) with a specific Instance Name. The reason I'd like to do this is sometimes I want the text to be on a slope - like when you make a Text box and rotate it slightly.
Is this at all possible?
-
Satori Canton
Replied:
(
3/29/2006
At
10:48 PM)
Hi Ryan,
The text is contained in a movie clip that is returned when a constructive method is called. You could rotate that movie clip.
I've also had some cool effects by applying filters to that movie clip as a whole. Like if I wanted all of the text to have the same drop-shadow, you can apply the drop-shadow to the resulting movieclip and it will cover the whole text effect.
-
Firdosh Tangri
Replied:
(
4/7/2006
At
8:18 PM)
hey all ,
I downloaded the new TextScript zip file and I cannot see anything on the stage even after I set the path to the classes.
thanks
cheers
firdosh
-
Satori Canton
Replied:
(
4/8/2006
At
2:37 AM)
Firdosh,
The most common cause of this kind of problem is that the Fonts are not correctly embedded in the FLA. If you want to send me your FLA, I'll have a look at it.
satori (at) actionscript (dot) com
-
Rajat Paharia
Replied:
(
4/16/2006
At
12:00 AM)
Tom -
Thanks for posting all that multi-line code. Very very useful.
best, - rajat
-
Nick Brown
Replied:
(
4/16/2006
At
7:51 PM)
Firdosh,
I think you need to restart flash once you've copied the files over. It didn't work for me first time, I restarted and now it's fine. Eclipse seemed to pick them up straight away..
Nice effects Satori :)
Cheers,
Nick
-
Rajat Paharia
Replied:
(
4/18/2006
At
2:32 AM)
Satori -
I just hit a showstopper. If I have any v2 components in my movie, TextScript no longer works. Any ideas?
Thanks, - rajat
-
Satori Canton
Replied:
(
4/18/2006
At
4:09 AM)
No way! The show must go on! As much as I'm a fan of v2 components (which I'm not) I can't believe they're jacking up TextScript. TextScript is cleanly encapsulated and protected from the evils of v2 components.
How do you mean it no longer works? Maybe a font embedding issue?
-
Rajat Paharia
Replied:
(
4/18/2006
At
4:21 AM)
Hey Satori -
I run the demo FLA that you included in the TextScript zip. It works fine. I drop a v2 Button on the stage and try to run it, and I no longer see anything. No TextScript magic, very sad. I remove the Button from the stage but leave it in the library, and the problem remains. It's not until I remove it from the library that TextScript starts working again.
I also experimented with the Flash MX UI Components, and there's no problems with those, it's only v2.
Maybe some naming collision with v2? I dunno. Let me know if you'd like me to send you any of my test files.
Eagerly awaiting a resolution :) - rajat
-
Satori Canton
Replied:
(
4/18/2006
At
4:42 PM)
I have been able to recreate the issue, but I'm not sure what's causing it. You're right, that if you have a v2 component (even just in the library) and you're trying to create a TextScript effect on the root timeline, it jacks up. But I'm not sure what's jacking it up.
If you take the code in my example FLA and paste it into an empty movieclip, it works fine (even with v2 components). This is just a work around. I need to research the cause further.
-
Rajat Paharia
Replied:
(
4/18/2006
At
11:12 PM)
Tom -
I adjusted your multi-line code to do word wrap with lookahead. Below is the new createText function. A couple of things to note:
- I was having problems using getTextExtent for letter placement on machines that didn't have my font installed (see http://chattyfig.figleaf.com/mailman/htdig/flashcoders/2003-June/078355.html). Letters were being crammed together and spaced funny. Switching to using textWidth solved that problem for me. Satori mentioned that this might cause problems with certain exotic fonts.
- How it works: any time we see a space, we grab the next word and put it in a new movieclip. We then add the new word clip's textWidth to our current x and if it's more than the original x + the paragraph width, we jump to the next line. If not, we continue as normal. And we delete the new word clip when we're done with it.
- rajat
private static function createText(scope:MovieClip, phrase:String, x:Number, y:Number, format:TextFormat, paraWidth:Number, lineHeight:Number):MovieClip {
var teText:MovieClip = scope.createEmptyMovieClip("ascTextPhrase" + scope.getNextHighestDepth(), scope.getNextHighestDepth());
teText.characterArray = new SatoriArray();
teText.remove = function(m:MovieClip):Void {
this.characterArray.removeItem(m);
m.removeMovieClip();
if(this.characterArray.length == 0) {
this.removeMovieClip();
}
}
var l:Number = phrase.length;
var originalx=x;
var originaly=y;
for(var i:Number = 0; i < l; i++) {
var m:MovieClip = TextScript.createCharacter(teText, phrase.substr(i, 1), format);
m.removeSelf = function() {
this._parent.remove(this);
}
m._x = x;
m._y = y;
m.characterLength = l;
teText.characterArray.push(m);
// -----------------------
// BEGIN new word wrap code
var nw:String;
var ns:Number;
if (phrase.substr(i, 1) == " ") {
// location of next space
ns = phrase.indexOf(" ", i+1);
if (ns == -1) {
// go to end of phrase
ns = phrase.length - 1;
}
// next word
nw = phrase.slice(i+1, ns);
var nc:MovieClip = TextScript.createCharacter(teText, nw, format);
// if adding this word is going to go over our boundaries, then
// reset to the next line.
if (x + nc.field.textWidth > paraWidth + originalx) {
x = originalx;
y = y + lineHeight;
}
else {
// word doesn't push us over boundary.
x += m.field.textWidth;
}
// remove the word clip
nc.removeMovieClip();
}
else {
// normal letter
x += m.field.textWidth;
}
// -----------------------
// END new word wrap code
}
while (l--) {
teText.characterArray[l].characterArray = teText.characterArray.slice(0);
teText.characterArray[l].phraseHeight = teText._height;
teText.characterArray[l].phraseWidth = teText._width;
}
return(teText);
}
-
jaime cavazos
Replied:
(
4/20/2006
At
1:24 AM)
Hey Rajat,
Do you have the revised .as file and a working .fla for your change that I could download? I think I'm doing something wrong when I tried to implement the code. Thanks if advance.
Jaime
-
Rajat Paharia
Replied:
(
4/21/2006
At
9:16 AM)
Jaime - You can get the revised class file and a test fla here: http://www.rootburn.com/files/textscript_multiline.zip
I left the class named TextScript but placed it in the com/actionscript/textMulti directory so I could still use the original if need be.
best, - rajat
-
Antonio Cortese
Replied:
(
4/23/2006
At
10:45 PM)
Thanks so much for this class, Satori! You rock, man!
One question: is there a way to trigger a function once the text has finished writing?
I need to trigger a second text line only after the first one has finished writing, but so far the only way I've found to do that is by using setInterval, which doesn't always work properly.
-
Chris Brown
Replied:
(
5/26/2006
At
12:13 PM)
This is incredible class Satori. Have you started a website for this where people can make their contributions?!? If someone else hasn't already, I'll be happy to host it on my site. This is exactly what i've been looking for since I began using flash. Here's my first attempt at a pretty cool effect using the blur filter...
blurUp = function() {
if(this.frameCount++ > this.delay) {
this._visible = true;
//Tween vars
this.pos = this._y;
this._y = this._height;
//blur vars
import flash.filters.BlurFilter;
var blurAmount:Number = 30;
var blurX:Number = blurAmount;
var blurY:Number = blurAmount;
var quality:Number = 1;
var filter:BlurFilter = new BlurFilter(blurX, blurY, quality);
var filterArray:Array = new Array();
filterArray.push(filter);
this.filters = filterArray;
this.onEnterFrame=function() {
//position loop
this._y = this._y + (this.pos - this._y) / 2;
//blur loop
var blurX:Number = blurAmount --;
var blurY:Number = blurAmount --;
var filter:BlurFilter = new BlurFilter(blurX, blurY, quality);
var filterArray:Array = new Array();
filterArray.push(filter);
this.filters = filterArray;
}
}
}
If anyone can optimize this script, that would be cool. I'm still a actionscript noobie, and i'm sure there is a better way to write this out. (actually i'm an all-around script noobie).
-
preet max
Replied:
(
6/7/2006
At
4:26 PM)
hi, can we insert the text dynamically from text file or XML insted of text mentioned here itself
-
Satori Canton
Replied:
(
6/8/2006
At
12:05 AM)
The class itself is very open. Any string (regardless of the source (XML, external data, etc.)) can be passed into it.
-
Behring Bautista
Replied:
(
6/9/2006
At
7:18 PM)
Hi everybody,
This could be out of the theme, but I tryed to export
your sample file to MOV
and I'm getting and error message
regarding the plublishing settings (quicktime does not soport versions above Flash 5).
I tryed also AVI but I'm getting an empty (white) movie.
So here is the question: How can I export this
text effects to a movie file?
Thank you very much for your time.
Behring
PS
I tryed third party sofware converting SWF to avi
without any result.
-
Satori Canton
Replied:
(
6/10/2006
At
12:59 PM)
You're probably not going to be able to export to a working movie from Flash. When you export to a movie format from Flash, it renders all actual frames (visually what it looks like) without executing code. In the case of the sample files, the actual frames are only one single blank frame on the root timeline. If no code executes, that's all it's ever going to look like.
The best way that I know (actually the only way that I know) to render a code driven animation into a movie file is to take the Flash movie into Director and render the move from Director. That way, Director allows Flash to execute code and animate, and then Director effectively screen captures the frames and creates a movie file.
-
Satish Joon
Replied:
(
6/23/2006
At
3:42 AM)
This is good experience with u.
-
Butum Alexandru
Replied:
(
7/14/2006
At
2:29 PM)
yea ... no need to fear about that ... just a good text script class
-
George Windsor
Replied:
(
7/25/2006
At
1:36 PM)
Satori. I am running Flash MX Pro 2004, on XP. On downloading your file, i cannot get it to open, and it expresses an unknown file format error. any idea what this may be caused by? Additionally, if someone could confirm my classpaths that would be great.
$(LocalData)/Classes
.
../preload/
my swf is in the preload directory, and i unzipped the text class with set directory structure into the preload directory. I can view the actionscript file, but not the fla. any help would be appreciated.
-
Satori Canton
Replied:
(
7/26/2006
At
11:52 AM)
The sample files are in Flash 8 format. MX 2004 won't recognize them as valid files.
-
Bill Abel
Replied:
(
7/31/2006
At
5:36 PM)
I'm trying to use TextScript to write a phrase, remove it, and then write another. I'm storing the phrases in an array and want to loop through them. I can't seem to get this to work.
I keep getting all the phrases drawn at once.
Any suggestions?
var xLoc = 0;
var yLoc = 0;
var delay = 1;
phrase = ["selling lemonade by a shady sidewalk", "riding your bike to baseball practice", "walking your child to school"];
function clean() {
TextScript.removeBlurIn(this, delay);
}
function write(i) {
TextScript.randomFadeIn(this, phrase[i], xLoc, yLoc, myFormat, delay);
}
for (i = 0; i < phrase.length; i++) {
setInterval(write(i), 3000);
}
-
Edwin Rios
Replied:
(
8/2/2006
At
2:57 PM)
HI Satory did you read my request in the forum under
Open Source File I am eddyperu and I posted today...Could you help me to reslove my problem please
eddy
-
Chris Charlton
Replied:
(
8/9/2006
At
2:01 AM)
I see the value in this, maybe a component would be best overall for designers and even team members.
-
Taras Kravchuk
Replied:
(
8/28/2006
At
8:32 AM)
It's e really great component! Althoug i am having real problems getting to load an external txt into the phrase. What is the code supposed to be? Please help
-
sam jarry
Replied:
(
9/14/2006
At
8:42 AM)
Very useful component.
I just have a small problem using it.
When you use a specific font, the file don't exacltly look the same if this font is not activated on your computer. (mostly, there's a gap inbetween each letter's theorical position and its actual position)
I have the same problem on both mac and pc.
I guess anyone has this problem.
Any idea ?...
-
adrian pan
Replied:
(
10/12/2006
At
6:31 PM)
im hoping Satori will figure out the external img load.It would make this great component simply incredible. Im not a hard-core programmer, i use Flash for video/dynamic signage purposes, but i can tell its not an easy task for Flash to dynamically render these effects, especially with advanced bitmap smoothing which is used here.I cant see this happening even in robust video apps in real time.
You did mention the preload img trick and then use them,...i ve mucked around with it, (using common sense not my AS skills lol) and it works...up to a point of course. You can't use heavy shit (tiles under 100px). There is a 1 sec delay on my P4 which is what the CPU needs to render it.
here's the link...it loads 5 external jpegs
http://www.firmchannel.com/temp/test_1.html
-
vinay sharma
Replied:
(
12/29/2006
At
4:32 AM)
Really wonderful class..
The enhansments may include
->Effect and Support
-> for All fonts
-> for international characters
otherwise.. great work
-
Bill Art
Replied:
(
1/18/2007
At
5:18 PM)
Hi, I'm Bill
Fantastic stuff:)
Can you direct me to some code that will make a flying carpet effect? Or, otherwwise, some sort of rippling fabric, flag, drapes effect?
Thank you
-
Edgar Mata
Replied:
(
1/27/2007
At
10:35 AM)
Hello, from Mexico. I have used your Text effect class and is great. I was trying to save time using software like Kool moves for text effects but now I don't need anymore! Thank's a lot. Its really useful! Congratulations!
-
Ilya Pavlichenko
Replied:
(
2/15/2007
At
3:28 AM)
Can I use this class in commercial purposes?
-
evan richards
Replied:
(
3/1/2007
At
7:58 AM)
hi Rajat,
i'm having trouble incorporating your multi-line code used for this textScript. Nothing seems to display at all when i test my movie. I have embedded the font properties but still nothing. How do i link your textScript actionscipt file to the document? I have done it using publish settings but still nothing.
I would appreciate any feedback as i am desparate to get this working.
Great lesson satori!! Its an awsome script!
-
Dan Carter
Replied:
(
5/19/2007
At
7:39 AM)
Hi all,
Satori, your script is awesome and very flexible, thank you!
Has anyone worked out a way to transition whole words instead of each letter?
If so, please can you let me know how?
Many thanks,
Dan
-
cliffster red
Replied:
(
6/3/2007
At
10:01 PM)
You're script is SPECTACULAR!!!
I even got it to work to loop once and then end and continu with my flash banner.
However can somebody pleace tell me how to decrease the time between each effect... So how to decrease the time between 1 word with text effect to the other word with text effect. I'm having trouble with this, since I can;t get it to work with the delay..or am i looking in the wrong direction here?
-
spacecataz25
Replied:
(
6/21/2007
At
4:41 PM)
Hey Satori,
The class looks good, but I have a noob question for you. Seems it works for everyone but myself! ;_; I've gone through your instructions multiple times, examining class paths, font embedding, code...nothing shows up when I preview the movie. Would you happen to have any suggestions?
I'm not too strong in the scripting department (designer at heart) so any advice is uber appreciated. If it helps I'm using Flash MX 2004 pro.
Thanks for your time.
-
Mary Seay
Replied:
(
6/22/2007
At
10:12 AM)
Hey Satori,
The script looks great, but seems to work for everyone but me! ;_; I'm kind of a noob when it comes to scripting - just getting started and don't pick it up that easily - but I've gone through what could be wrong and I just can't figure it out. I've checked the class paths in my preferences and publish settings, embedded the fonts, copy & pasted your script, reread the tutorial, but nothing shows up in my "test movie" swf. Could I be missing something simple but vital? Any and all help is appreciated.
Thanks!
-
Kivanc KARANIS
Replied:
(
7/12/2007
At
4:25 PM)
Hey Satori,
Great Job, great Class... Thanks for sharing...
Currently I`m preparing a flash presentation with nothing in the library, just an empty frame and some code in just the first frame, everything is loaded via XML and imported text, images, swfs, flvs etc. . Everything works fine but I was asked text fields to be animated. Thanks to Satori, this class worked perfect, even more stable and powerful than swishmax dynamic text anims.
I think, most problems with embedded fonts (dynamic fonts) can be solved with a simple trick:
-get the font(s) to the library (Library/New Font) and name it something (like replacing spaces with underscores)
-from Linkage, check "Export for Actionscript" and "Export in first frame"
-in your code, call the font with new identifier name (the font name you`ve given in linkage)
works great. Just a few KBs/font is increased in the final swf, which is very acceptible today I think. And if you are concerned of file size increase, choose a font with a smaller set defined.
Thanks Satori...
-
Heidi Hillenbrand
Replied:
(
8/29/2007
At
11:09 AM)
Great job on the code, Satori.
I have just one question:
I tried to move the animating text over as it blurred out with:
speed=5;
myScript._x += speed;
and the script isn't having any effect on it... and when I placed it inside an empty movie clip it wouldn't let me move it over manually eiether.
Is it possible for me to move the text to the right as it blurs out?
Thanks very much!
-Heidi
-
Lior G
Replied:
(
11/18/2007
At
3:00 AM)
Hi, Looks really cool!
Check out the little technique I posted for rotating text without embedding fonts. You can elevate the concept in your library:
http://liorgonnen.blogspot.com/2007/11/rotating-text-in-actionscript-3-without.html
The main idea is that a text rendering component internally renders itself as a bitmap, and draws this bitmap on its graphics region. The bitmap can be drawn in any angle.