Hello, I write this code to manage my primary scene of my project,
but I get this error when I try to resize the browser:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at main_fla::MainTimeline/sizeListener()
my code is:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
/*
content.x = stage.stageWidth / 2;
content.y = stage.stageHeight / 2;
*/
mc_top.x = 0;
mc_top.y = 0;
var tween_main_1 = new Tween(my_cont,"x",Regular.easeInOut,my_cont.x,stage.stageWidth / 2,0.7,true);
var tween_main_2 = new Tween(my_cont,"y",Regular.easeInOut,my_cont.y,stage.stageHeight / 2,0.7,true);
var tween_main_3 = new Tween(bg,"x",Regular.easeInOut,bg.x,stage.stageWidth / 2,0.7,true);
var tween_main_4 = new Tween(bg,"y",Regular.easeInOut,bg.y,stage.stageHeight / 2,0.7,true);
bottom.x = 0;
bottom.y = stage.stageHeight;
function sizeListener_main(e:Event):void {
mc_top.x = 0;
mc_top.y = 0;
var tween_main_1 = new Tween(my_cont,"x",Regular.easeInOut,my_cont.x,stage.stageWidth / 2,0.7,true);
var tween_main_2 = new Tween(my_cont,"y",Regular.easeInOut,my_cont.y,stage.stageHeight / 2,0.7,true);
var tween_main_3 = new Tween(bg,"x",Regular.easeInOut,bg.x,stage.stageWidth / 2,0.7,true);
var tween_main_4 = new Tween(bg,"y",Regular.easeInOut,bg.y,stage.stageHeight / 2,0.7,true);
bottom.x = 0;
bottom.y = stage.stageHeight;
}
stage.addEventListener(Event.RESIZE, sizeListener_main);
stop();
why I get this error? where is the null? i just don’t understand this…
please give me a hand to fix it,
thank you