To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 03-04-2004, 10:21 AM   #1
TheSheriff
...and the law won
 
TheSheriff's Avatar
 
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?
TheSheriff is offline   Reply With Quote
Old 03-04-2004, 12:48 PM   #2
jbum
Senior Member
 
jbum's Avatar
 
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);
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...
__________________
jbum is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 -4. The time now is 07:58 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.