I am curently learning as3, and am trying to do a tutorial from the adobe site. Unfortunately the sample file on the site doesn’t seem to be the right one. and I keep getting three errors when I run it.
1180: Call to a possibly undefined method addFrameScript.
1180: Call to a possibly undefined method addChild.
5000: The class ‘Snowflake’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.
What the tutorial is supposed to make is a snow effect. I am boggled by the 5000 error because I am not linking to any library symbols. There is nothing in the fla except a small line of code on frame 1 of the timeline.
snow.fla:
for(var i:uint; i<800; i++) {
var SNOWFLAKE:Snowflake = new Snowflake();
addChild(SNOWFLAKE);
}
I have the Document Class set as Snowflake in the properties bar.
Snowflake.as looks like this:
package {
import flash.display.Shape;
import flash.events.Event;
import flash.filters.BlurFilter;
public class Snowflake extends Shape {
private var stageWidth:int = 550;
private var stageHeight:int = 450;
private var highestDropSpeed:uint = 16;
private var dropSpeed:int = Math.round(Math.random() * Math.random() * highestDropSpeed);
private var incrementer:int = Math.round(Math.random() * 100);
private var shades:Array = [ 0xFFFFFF, 0xCCCCCC, 0x999999, 0x666666 ];
private var windSpeed:int = 2;
public function Snowflake() {
graphics.beginFill(shades[ Math.ceil(Math.random() * shades.length) ]);
graphics.drawCircle(0,0,4);
graphics.endFill();
filters = [ new BlurFilter(1,dropSpeed,1) ];
addEventListener(Event.ENTER_FRAME,update);
reset();
}
private function reset():void {
y = Math.random() * stageHeight * -1;
x = Math.random() * stageWidth - (windSpeed*100);
scaleX = scaleY = 0.25 + (Math.random() * Math.random() * 0.75);
}
private function update(e:Event):void {
y += dropSpeed;
x += windSpeed + Math.sin(incrementer/10) * (1/(dropSpeed/3));
if (y > stageHeight) {
reset();
}
incrementer++;
}
}
}
Any help would be great!