hi i have been trying to fix this by searching the net for hours and have had no luck so all help is appreciated (it happened when i put the snow in) Thanks in Advance
Here's my code:
Quit.addEventListener(MouseEvent.CLICK, func22);
function func22(event:MouseEvent):void
{
gotoAndStop(2);
myTimer3.stop(); myTimer3.removeEventListener(TimerEvent.TIMER, timerListener3);
myTimer4.stop(); myTimer4.removeEventListener(TimerEvent.TIMER, timerListener4);
}
Help.addEventListener(MouseEvent.CLICK, func33);
function func33(event:MouseEvent):void
{
gotoAndStop(23);
myTimer3.stop(); myTimer3.removeEventListener(TimerEvent.TIMER, timerListener3);
myTimer4.stop(); myTimer4.removeEventListener(TimerEvent.TIMER, timerListener4);
}
var myTimer3:Timer = new Timer(2000,0);
myTimer3.addEventListener(TimerEvent.TIMER, timerListener3);
function timerListener3(e:TimerEvent):void {
Hungry_bar.scaleX-=0.05;
if(Hungry_bar.scaleX<=0.05){
gotoAndStop(12)
myTimer3.stop(); myTimer3.removeEventListener(TimerEvent.TIMER, timerListener);
myTimer4.stop(); myTimer4.removeEventListener(TimerEvent.TIMER, timerListener);
}
}
myTimer3.start();
var myTimer4:Timer = new Timer(3000,0);
myTimer4.addEventListener(TimerEvent.TIMER, timerListener4);
function timerListener4(e:TimerEvent):void {
Fun_bar.scaleX-=0.05;
if(Fun_bar.scaleX<=0.05){
gotoAndStop(13)
myTimer3.stop(); myTimer3.removeEventListener(TimerEvent.TIMER, timerListener3);
myTimer4.stop(); myTimer4.removeEventListener(TimerEvent.TIMER, timerListener4);
}
}
myTimer4.start();
Feed.addEventListener(MouseEvent.CLICK,feed2)
function feed2(e:MouseEvent){
Hungry_bar.scaleX+=0.05
if(Hungry_bar.scaleX>=1.5){
gotoAndStop(14)
myTimer3.stop(); myTimer3.removeEventListener(TimerEvent.TIMER, timerListener3);
myTimer4.stop(); myTimer4.removeEventListener(TimerEvent.TIMER, timerListener4);
}
}
Fun.addEventListener(MouseEvent.CLICK,happy2)
function happy2(e:MouseEvent){
Fun_bar.scaleX+=0.05
if(Fun_bar.scaleX>=1.5){
gotoAndStop(15)
myTimer3.stop(); myTimer3.removeEventListener(TimerEvent.TIMER, timerListener);
myTimer4.stop(); myTimer4.removeEventListener(TimerEvent.TIMER, timerListener);
}
}
//snow
var snowflakes:Array = new Array();
var snowflakeProps:Dictionary= new Dictionary(true);
var max_snowsize:Number = .04;
// pixels
var snowflakesCnt:Number = 150;
var oheight:Number;
var owidth:Number;
init();
function init():void {
owidth = width;
oheight = height;
// quantity
for (var i:int=0; i<snowflakesCnt; i++) {
var t:MovieClip = new SnowFlake();//
t.name = "snowflake"+i;
t.alpha = .2+Math.random()*.6;
t.x = -(owidth/2)+Math.random()*(1.5*owidth);
t.y = -(oheight/2)+Math.random()*(1.5*oheight);
t.scaleX = t.scaleY=.5+Math.random()*(max_snowsize*10);
var o:Object = new Object();
o.k = 1+Math.random()*2;
o.wind = -1.5+Math.random()*(1.4*3);
snowflakeProps[t] = o;
addChild(t);
snowflakes.push(t);
}
addEventListener(Event.ENTER_FRAME, snowFlakeMover);
}
function shakeUp():void{
for (var i:int=0; i<snowflakes.length; i++) {
var t:MovieClip = snowflakes[i] as MovieClip;
t.x = -(owidth/2)+Math.random()*(1.5*owidth);
t.y = -(oheight/2)+Math.random()*(1.5*oheight);
}
}
function snowFlakeMover(evt:Event):void {
var dO:MovieClip;
var o :Object;
if(visible && parent.visible){
for (var i:int = 0; i < snowflakes.length; i++) {
dO = snowflakes[i] as MovieClip;
o = snowflakeProps[dO];
dO.y += o.k;
dO.x += o.wind;
if (dO.y>oheight+10) {
dO.y = -20;
}
if (dO.x>owidth+20) {
dO.x = -(owidth/2)+Math.random()*(1.5*owidth);
dO.y = -20;
} else if (dO.x<-20) {
dO.x= -(owidth/2)+Math.random()*(1.5*owidth);
dO.y = -20;
}
}
}
}
and here is the error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at petgamewithweather_fla::MainTimeline/frame2()[petgamewithweather_fla.MainTimeline::frame2:9]
at flash.display::MovieClip/gotoAndStop()
at petgamewithweather_fla::MainTimeline/func22()[petgamewithweather_fla.MainTimeline::frame16:5]