I'm working on a little project that's like a text-based adventure, but played on a tumblr, so the readers submit their siggestions for actions.
I'm looking to create animations for each post, so that it looks like the reader is typing in the text on the "game."
I have the text-generation effect down using this code:
var myString:String = "text data goes here.";
var myArray:Array = myString.split("");
if(myArray.length > 0)
//code sporked from Adam Khoury's Flash Typing Text Effect Tutorial video
So that runs okay, but after that is done, I want there to be a final > prompt followed by a flashing cursor,as if asking for input.
If anyone has a suggestion, that would be much appreciated.
Thanks in advance!
Okay, but what about the cursor? In the final product, I would like for there to be a | that blinks, as if asking for input. Is this possible, given that this al happens on one frame? I'm still new to this, so sorry if this sounds dumb.
Having the blinking cursor is possible, but is also often a bit of a hair puller to do so with AS3 code. For myself, it seldom works, while others have no problem. Here is the solution most commonly offered (relative to what you are doing)...
stage.focus = tf;
You should find that if you don't see the cursor, if you start typoing it will begin filling in after the ">". You might try testing in the final intended interface (browser, etc) instead of just the player in Flash... sometimes it works in one but not the other.
Thanks, but that's not really what I'm trying to do. I just want it to look like it's waiting for input. I probably should have done this form the start, but here's an example of a past post I did using GIMP
What I want to do is make it all text and have it scroll out as if it's being typed, then stop so it looks like the picture (except in all text). That last bit is where I'm having the problem.
EDIT: It seems you need to click on the image to get it to animate. Shrug.
There's not much need to show anymore. I already provided the code you can try to get a blinking cursor, but also said how it is iffy as far as it actually working.
The only difference I would offer for the code I provided earlier based on the image you show would be to add a new line before the ">", as in...
stage.focus = tf;
tf.setSelection(tf.text.length,tf.text.length); // in an ideal world this line, in league with the focus line preceding it will add the cursor... it just doesn't always work as advertised... especially for me
Europe, Middle East and Africa