Flash Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignFlash Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 18th, 2005, 11:02 AM
grenouille grenouille is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 34 grenouille User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 3 m 48 sec
Reputation Power: 5
Post how to make a 'for'-loop wait ??

hi there,

i wrote an AS function to draw a circle. the function offers the opportunity to choose in how many parts it is drawn.
it only works for an even number of parts starting at 8. but that's not my concern; i'm working on that.
the problem is the following : i used a 'for' loop to draw the different parts of the circle. what i want is that the routine waits when it has done a loop before continuing to the next (i hope i make myself clear; i'm not native english speaking).

here's the code :

Code:
MovieClip.prototype.drawCircle = function(r, x, y, parts) {
this.moveTo(x+r, y);
a = Math.tan(((360/2)/parts) * Math.PI/180);
for (var angle = 360/parts; angle<=360; angle += 360/parts) {
var endx = r*Math.cos(angle*Math.PI/180);
var endy = r*Math.sin(angle*Math.PI/180);
var cx =endx + r*a*Math.cos((angle-90)*Math.PI/180);
var cy =endy + r*a*Math.sin((angle-90)*Math.PI/180);
this.lineStyle(1, 0x000000, 100);
this.curveTo(cx+x, cy+y, endx+x, endy+y);
//here i want the loop to wait for a while 
}
}
var c80 = this.createEmptyMovieClip("c", 1);
c80.drawCircle(100, 200, 200, 40); 


i suspect it's very easy but i don't know how to do it. something with setInterval? but how?

thnx in advance,

grenouille.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignFlash Development > how to make a 'for'-loop wait ??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT