i’ve been all over the web looking for a fix but somereason cannot fix it
check it out
i am doing this with out oop, the first code is my main, the next is my Rose class.
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.utils.Timer;
import flash.events.TimerEvent;
var flowersInGame:uint;
var flowerMaker:Timer;
var container_mc:MovieClip;
var cursor:MovieClip;
function initializeGame():void
{
flowersInGame = 10;
flowerMaker = new Timer(1000, flowersInGame);
container_mc = new MovieClip();
addChild(container_mc);
flowerMaker.addEventListener(TimerEvent.TIMER, bloomFlower);
flowerMaker.start();
cursor = new Cursor();
addChild(cursor);
cursor.enabled = false;
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE, dragCursor);
}
function dragCursor(event:MouseEvent):void
{
cursor.x = this.mouseX;
cursor.y = this.mouseY;
}
function bloomFlower(event:TimerEvent):void
{
var flower:MovieClip;
flower = new RoseBud();
flower.x = Math.random() * stage.stageWidth;
flower.y = Math.random() * stage.stageWidth;
container_mc.addChild(flower);
}
initializeGame();
Now it says the error is at 1:22 and 1:12 of the rose class
idk what it is exactly, or why its calling the object null
i tried almost every fix i could find and the only thing thats worked, is as follows
Remove ENTER_FRAME listener from code aswell as checkloaded,
but then when the mc gets to the end of its timeline it restarts, i want it to remove child,
thanks for all and any help
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.MovieClip;
this.addEventListener(MouseEvent.CLICK, cutRose);
this.addEventListener(Event.ENTER_FRAME,checkLoaded)
function checkLoaded(e:Event){
if(this.enabled && this.currentFrame == 100){
this.removeEventListener(Event.ENTER_FRAME,checkLoaded);
removeRose();
}
}
function removeRose():void
{
this.removeEventListener(MouseEvent.CLICK, cutRose);
this.parent.removeChild(this);
}
function cutRose(event:MouseEvent):void
{
if (this.currentFrame > 34 && this.currentFrame < 85)
{
removeRose();
}
}