|
|
|
#1 |
|
...and the law won
Join Date: Feb 2004
Location: Philly
Posts: 235
|
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? |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
|
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);
|
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|