Falling objects in Flash

I am attempting to make a Flash game with Actionscript. My game premise is that I have 4 different kinds of flowers falling from the sky (3 being flowers, 1 being a weed). There is a basket on the bottom of it catching them. I am having a lot of trouble with the falling objects part. I originally hard-coded in each flower falling one at a time and realized that wasn’t a good idea. So I decided to make an array to have a random item from the array generated and used.

I copied what I have down here – I am a beginner in flash to I am sorry if something looks funny :slight_smile: I am attempting to learn actionscript since I am a web designer, and it would be a huge help if I could have some pointers here!

//Declare basket variable
var basket_mc:Basket;
basket_mc = new Basket();
//Set basket at a set y value
basket_mc.y = 550;
//Add the basket to the stage
addChild(basket_mc);
//Set the even listener for basket
stage.addEventListener(“mouseMove”, moveBasket);
//Make the basket invisible in the beginning before the mouse is moved onto the screen
basket_mc.visible = false;
//Initialize the function to hide the mouse and use the cursor to control the movement of the mouse on the x axis
function moveBasket(e:MouseEvent):void {
Mouse.hide();
basket_mc.visible = true;
basket_mc.x = mouseX;
}
function newPlant(e:Event) {
var flowerList:Array = [“blue_mc”,“pink_mc”,“purple_mc”];
var weedList:Array = [“dandelion_mc”];
if (Math.random() < .5) {
var j:int = Math.floor(Math.random()*flowerList.length);
var classRef:Class = getDefinitionByName(flowerList[j]) as Class;
var newPlant:MovieClip = new classRef();
newPlant.typestr = “good”;
} else {
j = Math.floor(Math.random()*weedList.length);
classRef = getDefinitionByName(weedList[j]) as Class;
newPlant = new classRef();
newPlant.typestr = “bad”;
}
newPlant.x = Math.random()*500;
addChild(newPlant);
plantList.push(newPlant);
setNextObject();
}

const speed:Number = 7.0;

function dropFlower(e:Event) {
for(var i:int=plantList.length-1;i>=0;i–) {
plantList[i].y += speed;
if (plantList[i].y > 600) {
removeChild(plantList[i]);
plantList.splice(i,1);
}
if (plantList[i].hitTestObject(basket_mc)) {
if (plantList[i].typestr == “good”) {
score += 5;
} else {
score -= 1;
}
if (score < 0) score = 0;
flowersCaught_txt.text = " "+score;
removeChild(plantList[i]);
plantList.splice(i,1);
}
}
}