A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Here's a Puzzle for someone...

  1. #1
    ...and the law won TheSheriff's Avatar
    Join Date
    Feb 2004

    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. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Los Angeles
    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.

    nl = mytext.text.split("\r").length;
    delay = 3000*nl;
    function myUnpause()
    function myPause(length)
      _root.setH = setInterval(myUnpause, length);
    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

Click Here to Expand Forum to Full Width

HTML5 Development Center