-
...and the law won
Here's a Puzzle for someone...
How would you define setInterval so that depending on which content is loaded into your movieclip, the delayed would be longer or shorter.
For example I have a movie clip with 3 text fields. Each text field loads text from a txt file. This movie clip has an animation (10 frames) and on frame 9 I have the setInterval command that acts as a pause so content can be displayed.
What I am looking to accomplish is using setinterval to, depending on what frame of my movie clip is displayed (some text fields are 2 lines of text others 1)display for a longer or shorter period of time.
I am using this code on frame 9
//
_root.animate = setInterval(_root.playMovieClip, 5000, this);
and I imagine I would just incorporate if then statements
Any takers?
-
Senior Member
If I understand you, you are wanting to use setInterval to pause for an amount of time relative to the length of a text field, giving the reader time to read the text.
You could base this on either the number of lines in the text field,or the number of characters in the text.
If the text field is mytext, then the number of characters is
nc = mytext.text.length;
and the number of lines is:
nl = mytext.text.split("\r").length;
Let's say you want to delay 3 seconds (3000 milliseconds) per line.
Code:
nl = mytext.text.split("\r").length;
delay = 3000*nl;
function myUnpause()
{
clearInterval(_root.setH);
play();
}
function myPause(length)
{
stop();
_root.setH = setInterval(myUnpause, length);
}
myPause(delay);
As an aside, did you ever watch an old silent movie? Seems like the caption screens take FOREVER... I wonder if the assumption was that the audience for those movies couldn't read very well...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|