Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-10-2011, 02:16 AM   #1
JDWasabi
Registered User
 
Join Date: Sep 2011
Location: UK
Posts: 3
Question [AS2] Scripted Typewriter Effect Visual Discrepancy Between Static and Dynamic text

Hi all,

this is my time posting here so apologies if I've posted it in the wrong place or something, please let me know!

I'm a student working on a game project similar to Japanese visual novel games, Phoenix Wright and Hotel Dusk on the Nintendo DS. Basically it's very visual and text heavy with not a lot of animation and heavy duty programming (which is great because I'm not a programmer haha).

I've use a tutorial which I've modified it so that the button would jump to the next frame instead of going back and replaying the animation.

I couldn't work out how to make the animation of the 1st text box stop before the second load of text appears so I changed the 1st textbox from dynamic to static text when the playhead jumps to the next frame because of its reliance on the timeline. This change then creates the visual discrepancy which is what I'm trying to get rid of, which results in several questions:

1. Is there a code to stop the animation and make it static while the playhead jumps to the next frame? If so, could someone kindly explain it to me please?

2. Is there an easier method to implement text just by typing into a fixed area of the textbox instead of working out where I need the next line by typing '\n'?

3. Lastly, since this current method is dependent on the timeline, is there possibly another way to get this animation effect without it being on the timeline (would it work if it's in its own movie clip symbol)?
I'll keep testing it out because I'll be implementing sound/audio into it. As the playhead keeps going back to a certain frame to check when the animation has finished it also messes up the audio.

I have a .zip file containing the .fla (CS5) with its audio files but I think it's slightly too big to attach ... I'll do my best to attach the code I've used in that case.

Script on Frame1
Code:
q = 1;
text = "Dialogue babble for textbox1";
stop();

nextpage1_btn.onRelease = function(){
	gotoAndPlay(1);
}
Script on Frame2:
Code:
if (q < text.length) {
        textbox = text.substring(0, q);
        q++
} else {
        textbox = text;
        gotoAndStop(10);
}
Script on Frame3:
Code:
gotoAndPlay(2);
When all the text has appeared, the playhead will jump to frame10, if not the playhead will keep replaying back to make sure all the text has been written out which somehow affects the animation/coding used for the next lot of text as well as messing up the audio that I've put on the main timeline. Basically, is there a way to keep the text from textbox1 static as the textbox2 is being typed out?

Thank you for reading, hope to have replies soon!

-Wasabi

(it seems that I can't post links unless my post count is 50 or greater, sorry I couldn't make this post easier for viewing :/)
JDWasabi is offline   Reply With Quote
Old 09-12-2011, 11:27 AM   #2
dialectric
Senior Member
 
dialectric's Avatar
 
Join Date: May 2006
Location: USA
Posts: 614
Default

Hi,

Are you creating the typewriter effect manually by adding a frame for each letter? If so, instead write (or find) a function that does the typewriter effect from code, drawing the letters from a string and adding them to the dynamic textfield. Use a setInterval to time the keypresses. Searching for setInterval on these forums will get you started.

- dialectric
dialectric is offline   Reply With Quote
Old 09-14-2011, 01:18 PM   #3
JDWasabi
Registered User
 
Join Date: Sep 2011
Location: UK
Posts: 3
Default

hi dialectric!

I'm not quite sure if it does add a letter frame by frame as once it reaches a certain frame, it'll keep jumping back to the previous to make sure all the text has appeared. Once it has it'll jump pass that frame to the next.

I'll try my best to understand what you've written and play around with a different scripted typewriter effect method.

Thank you! I'll keep this thread updated

-Wasabi
JDWasabi is offline   Reply With Quote
Old 09-18-2011, 04:30 PM   #4
dialectric
Senior Member
 
dialectric's Avatar
 
Join Date: May 2006
Location: USA
Posts: 614
Default

Hi,

To clarify, the approach I suggest is an alternative to using frames. You only have 1 frame, and changes to the textfield are made with setinterval code instead of frame advances.

- dialectric
dialectric is offline   Reply With Quote
Old 09-23-2011, 10:27 PM   #5
JDWasabi
Registered User
 
Join Date: Sep 2011
Location: UK
Posts: 3
Default

Hi!

Thank you for the reply! I'm currently working on other elements of my project so I've yet to try out your suggestion. I shall keep this thread updated when I do ...

Thanks dialectric!!
JDWasabi is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:57 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.