Note that there are some explanatory texts on larger screens.

plurals
  1. POdynamically draw circle preloader error 1061 when in document class
    text
    copied!<p>I found a tutorial on how to make a dynamic unfilled and filled circle. that will take input from a slider to dertermine how much of the circle is drawn. I wanted to use this for a preloader. Unlike the author I would like to use it inside of a document class. I am getting <code>1061: Call to a possibly undefined method createEmptyMovieClip through a reference with static type document.</code> and <code>1120: Access of undefined property circ1.</code> The second is caused from the first. How would I get this to work in my document class? Thanks in advance!<br /></p> <pre><code>//original code // x: circles center x, y: circles center y // a1: first angle, a2: angle to draw to, r: radius // dir: direction; 1 for clockwise -1 for counter clockwise MovieClip.prototype.CircleSegmentTo = function(x, y, a1, a2, r, dir) { var diff = Math.abs(a2-a1); var divs = Math.floor(diff/(Math.PI/4))+1; var span = dir * diff/(2*divs); var rc = r/Math.cos(span); this.moveTo(x+Math.cos(a1)*r, y+Math.sin(a1)*r); for (var i=0; i&lt;divs; ++i) { a2 = a1+span; a1 = a2+span; this.curveTo( x+Math.cos(a2)*rc, y+Math.sin(a2)*rc, x+Math.cos(a1)*r, y+Math.sin(a1)*r ); }; return this; }; // empty this.createEmptyMovieClip("circ1",1); circ1._x = 100; circ1._y = 150; circ1.radius = 35; circ1.onEnterFrame = function(){ this.clear(); var endAngle = 2*Math.PI*percentLoaded; var startAngle = 0; if (endAngle != startAngle){ this.lineStyle(2,0,100); this.CircleSegmentTo(0, 0, startAngle, endAngle, this.radius, -1); } } //filled this.createEmptyMovieClip("circ2",2); circ2._x = 220; circ2._y = 150; circ2.radius = 35; /* code in tutorial i left out since its for a second filled in circle circ2.onEnterFrame = function(){ this.clear(); var endAngle = 2*Math.PI*slider.value/100; var startAngle = 0; if (endAngle != startAngle){ this.lineStyle(2,0,100); this.beginFill(0xFF9999,100); this.lineTo(this.radius,0); this.CircleSegmentTo(0, 0, startAngle, endAngle, this.radius, -1); this.lineTo(0,0); this.endFill(); } } */ </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload