Particles: help!

Hi

I’m really new to this actionscript game and even newer to actionscript 3, but i desperately need some help with something my brain just doesn’t want to grasp. I am trying to change some open source code for a particle effect that makes some really nice snow. The source code uses a coded circle to generate the snowey effect, however i want to have a customised snowflake so i want to change the code so that it uses a movieclip to generate the snow.

Here is the .as code as i have changed it (i commented out the original):

package
{
import flash.display.*;
import flash.geom.Rectangle;
import flash.filters.BlurFilter;

public class SnowFlake extends Sprite
{
    // the x and y velocity of the snowflake
    public var xVel:Number; 
    public var yVel:Number; 
    
    // the size of the snowflake
    public var size:Number ;
    
    // and the limits of the screen
    public var screenArea:Rectangle; 
    
    //adds displayobject for particle
    //public var clip:DisplayObject;
    
    
    
    public function SnowFlake(screenarea:Rectangle, spriteclass : Class/*, targetclip : DisplayObjectContainer*/)
    {
        // instantiate a new particle graphic
        screenArea = new spriteclass(); 
    
        // and add it to the stage
        //targetclip.addChild(clip); 

        // FIRST THINGS FIRST! 
        // let's draw a little dot.
        //graphics.lineStyle(3,0xffffff); 
        //graphics.moveTo(0,0); 
        //graphics.lineTo(0.2,0.2); 
        //graphics.beginFill(0xffffff,1); 
        //graphics.drawCircle(0,0,1.5); 
        //graphics.endFill(); 

And here is the .fla stuff:

import flash.events.Event;
import flash.geom.Rectangle;

// first make an array to put all our snowflakes in
var snowFlakes : Array = new Array();

// and decide the maxium number of flakes we want
var numFlakes : uint = 200;

// and define a rectangle to store the screen dimensions in.
var screenArea:Rectangle = new Rectangle(0,0,900,675);

// start listening for an ENTER_FRAME event (the equivalent
// of the AS2 onEnterFrame function)
addEventListener(Event.ENTER_FRAME, frameLoop);

// and define the function that is called on an ENTER_FRAME event

function frameLoop(e:Event)
{

var snowflake : SnowFlake; 

// if we don't have the maximum number of flakes... 
if(snowFlakes.length<numFlakes)
{
    // then make a new one!
    snowflake = new SnowFlake(screenArea, spark); 
    
    // add it to the array of snowflakes
    snowFlakes.push(snowflake); 
    
    // and add it to the stage
    //addChild(snowflake); 
    
}

I keep getting the error “TypeError: Error #1034: Type Coercion failed: cannot convert spark@1cd66179 to flash.geom.Rectangle.
at SnowFlake$iinit()
at SnowStorm_fla::MainTimeline/frameLoop()”

…and i have no idea what this means…

Please can someone help me??


import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;


import fl.motion.*

//Function with two tweens
var arr_mc:Array = new Array();
var tween_rain:Array = new Array();
var j:Number=0;
var pcs:Number=100;
var ID:Number=0;

function rain_creator():void {
	j++;
	if (j==pcs || j<=0) {
		clearInterval(ID);
	}
	arr_mc[j] =new rain();
	addChild(arr_mc[j]);
	arr_mc[j].x=Math.random()*500;
	arr_mc[j].scaleX=arr_mc[j].scaleY=0.01+Math.random()*0.1;
	
	arr_mc[j].tm=13-(arr_mc[j].scaleX*110)
	  
            arr_mc[j].rotation+=Math.random()*360;

	tween_rain[j]=new Tween(arr_mc[j],"y",Regular.easeInOut,-20, 400,arr_mc[j].tm,true);
	tween_rain[j].looping = true;
}
ID=setInterval(rain_creator,200);


http://kind-armadillo.pochta.ru/FlaAC3/rain_ac3.swf
http://kind-armadillo.pochta.ru/FlaAC3/rain_ac3.rar

http://kind-armadillo.pochta.ru/FlaAC3/Mod_rain_ac3.swf
http://kind-armadillo.pochta.ru/FlaAC3/mod_rain_ac3.rar

http://kind-armadillo.pochta.ru/fla/deciduous.rar
http://kind-armadillo.pochta.ru/fla/deciduous.swf