List Info

Thread: RE: Using actionscript to go to a frame




RE: Using actionscript to go to a frame
country flaguser name
United States
2007-09-05 09:54:19
Hi Dave, 
 
Looks like your questions have already been answered. Quite
right. I just
want to make a point about clearInterval: 
 
You want to avoid creating 'orphaned' interval ids. 
 
An interval will continue to run endlessly until it is
cleared. 
 
Each time you assign a variable like 'id' to a setInterval
Flash will give
it a numeric value like 1 then 2 then 3 and so on. If you
call setInterval
repeatedly, and assign it to the same id variable, then id
will be
overwritten with the latest value, but if the previous id
values have not
been cleared they will continue to run! 
 
Therefore:  
 
It is considered best practice to call clearInterval(id) on
any id just
before assigning it with a setinterval call. 
 
Regards, 

-Keith 
http://keithrei
nfeld.home.comcast.net
 

> -----Original Message-----
> From: flashnewbie-bounceschattyfig.figleaf.com
[mailto:flashnewbie-
> bounceschattyfig.figleaf.com] On Behalf Of Dave Williams
> Sent: Wednesday, September 05, 2007 8:03 AM
> To: Flashnewbie Mailing List
> Subject: RE: [Flashnewbie] Using actionscript to go to
a frame
> 
> Thanks Willem, Keith and Rob
> 
> Your help and kindness is very much appreciated.  This
listserv is a
> super way to learn
> 
> thx... dave
> 
> At 8:21 AM -0400 9/5/07, Hairy Dog Digital wrote:
> >Hi Dave,
> >
> >I know your question was directed at Keith, but I
was just checking
> messages
> >and thought I'd reply.
> >
> >>  1) when you type 100 as an argument, does
that mean the function
> >>  is continually called for 100 ms or rather is
it called every 100 ms?
> >
> >The value represents the interval. So the interval
"id" will call the
> >function "functionName" every 100
milliseconds (every 10th of a second).
> >
> >>  2) what is the purpose of the clearInterval
command?
> >
> >The clearInterval removes the interval
"id" so that it stops triggering
> the
> >functionName.
> >
> >>  3) what does !isNaN(pct) mean?
> >
> >isNan(pct) checks whether the variable pct is not a
number. By negating
> the
> >expression -- using "!" in front of it --
you are checking for the
> opposite
> >condition, that it is a number. So the if statement
checks that the
> variable
> >pct is a number, that it is greater-than or equal
to 100, and that the
> movie
> >clip has a width.
> >
> >That last bit is important, because having a width
value indicates that
> the
> >movie clip is initialized and ready to run.
> >
> >...Rob
> >
> >
> >
> >-----Original Message-----
> >From: Dave Williams [mailto:daveconferencevillage.com]
> >Sent: Tuesday, September 04, 2007 11:33 AM
> >To: Flashnewbie Mailing List
> >Subject: RE: [Flashnewbie] Using actionscript to go
to a frame
> >
> >Hi Keith... hope you enjoyed a great Labour Day
weekend.
> >
> >Thanks for the code... it works perfectly for me. 
I spent some time in
> the
> >docs and I think I understand the setInterval
command but I have three
> >questions that perhaps you might be able to
answer.
> >
> >1) when you type 100 as an argument, does that mean
the function is
> >continually called for 100 ms or rather is it
called every 100 ms?
> >
> >
> >3) what does !isNaN(pct) mean?
> >
> >thanks... dave
> >
> >>At 2:44 PM -0500 9/1/07, Keith Reinfeld wrote:
> >>Hi Dave,
> >>
> >>Try this:
> >>
> >>loadMovie("webinar2.swf", phone);
> >>
> >>clearInterval(id);
> >>id = setInterval(functionName, 100, phone);
> >>
> >>function functionName(mc){
> >>	trace("functionName() called");
> >>	pct =
mc.getBytesLoaded()/mc.getBytesTotal()*100;
> >>	if(!isNaN(pct) && pct>=100
&& mc._width>0){
> >>		clearInterval(id);
> >>		mc.stop();
> >>		mc.gotoAndStop(5);
> >>	}
> >>}
> >>
> >>Regards,
> >>
> >>-Keith
> >  >http://keithrei
nfeld.home.comcast.net
> >>
> 
> --
> _______________________________________________
> Flashnewbiechattyfig.figleaf.com
> To change your subscription options or search the
archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.c
om

_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )