[FONT=Arial][SIZE=3]I’ve just figured out the following Auto-Resizing and Centering tutorial. And it’s working better and simpler than what I had originally.[/SIZE][/FONT]
[FONT=Arial][SIZE=3]Tutorial link: [/SIZE][/FONT][SIZE=3][FONT=Arial][COLOR=#800080]http://www.kirupa.com/developer/as3/resizing_centering_as3.htm[/COLOR][/FONT][/SIZE]
[FONT=Arial][SIZE=3]But here is a problem.[/SIZE][/FONT]
[SIZE=3][FONT=Arial][SIZE=2]TypeError: Error #1009: Cannot access a property or method of a null object reference.[/SIZE][/FONT]
[FONT=Arial][SIZE=2]at main_120209_fla::MainTimeline/updateSize()[/SIZE][/FONT]
[FONT=Arial][SIZE=2]at flash.events::EventDispatcher/dispatchEventFunction()[/SIZE][/FONT]
[FONT=Arial][SIZE=2]at flash.events::EventDispatcher/dispatchEvent()[/SIZE][/FONT]
[FONT=Arial][SIZE=2]at flash.display::Stage/dispatchEvent()[/SIZE][/FONT]
[FONT=Arial][SIZE=2]at main_120209_fla::MainTimeline/init()[/SIZE][/FONT]
[FONT=Arial][SIZE=2]at main_120209_fla::MainTimeline/frame1()[/SIZE][/FONT]
[/SIZE]
[FONT=Arial][SIZE=3]Brief description of what I have.[/SIZE][/FONT]
[FONT=Arial][SIZE=3]2 frames in main timeline [/SIZE][/FONT]
[FONT=Arial][SIZE=3]2 frame names that match with 2 buttons (gotoStop)[/SIZE][/FONT]
[FONT=Arial][SIZE=3]2 MCs in each frame with different instance names (Line1, Line2)[/SIZE][/FONT]
[FONT=Arial][SIZE=3]3 layers named; action, line_01, line_02[/SIZE][/FONT]
[FONT=Arial][SIZE=3]line_02 layer has a blank frame in frame 1 [/SIZE][/FONT]
[FONT=Arial][SIZE=3]Code:[/SIZE][/FONT]
[FONT=Arial]function init() [/FONT]
[FONT=Arial]{ [/FONT]
[FONT=Arial]stage.align=StageAlign.TOP_LEFT; [/FONT]
[FONT=Arial]stage.scaleMode=StageScaleMode.NO_SCALE; [/FONT]
[FONT=Arial]stage.addEventListener(Event.RESIZE, updateSize); [/FONT]
[FONT=Arial]stage.dispatchEvent(new Event(Event.RESIZE)); [/FONT]
[FONT=Arial]} [/FONT]
[FONT=Arial]init();[/FONT]
[FONT=Arial]function updateSize(e:Event) [/FONT]
[FONT=Arial]{ [/FONT]
[FONT=Arial]//movie clip called Line1 at fram 1[/FONT]
[FONT=Arial]Line1.x = stage.stageWidth/2 – Line1.width/2;[/FONT]
[FONT=Arial]Line1.y = stage.stageHeight/2 – Line1.height/2;[/FONT]
[FONT=Arial]// movie clip called Line2 at frame 2[/FONT]
[FONT=Arial]Line2.x = stage.stageWidth/2 – Line2.width/2;[/FONT]
[FONT=Arial]Line2.y = stage.stageHeight/2 - Line2.height/2;[/FONT]
[FONT=Arial]}[/FONT]
[FONT=Arial][SIZE=3]It works with 1 single frame in main timeline but when I spread it into 2 frames, it doesn’t. Any help to make this work with multiple frames will be appreciated![/SIZE][/FONT]