# AS3 - loader and gotoAndPlay help

**URL:** <https://forum.kirupa.com/t/as3-loader-and-gotoandplay-help/272944>\
**Category:** flash\
**Created:** [October 9, 2008, 3:40pm UTC](https://forum.kirupa.com/t/as3-loader-and-gotoandplay-help/272944 "2008-10-09T15:40:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skew](https://avatars.discourse-cdn.com/v4/letter/s/dbc845/32.png) [@skew](https://forum.kirupa.com/u/skew)\
**Post date:** [October 9, 2008, 3:40pm UTC](https://forum.kirupa.com/t/as3-loader-and-gotoandplay-help/272944/1 "2008-10-09T15:40:26Z")

</div>

Back story: I have a presentation, done in Flash, that has about 12 screens. Each screen is fairly text heavy and most have some sort of interaction on them. So, needless to say it runs a bit slow on some computers. I would like to break all of these “screen” out into their own swf and load and unload them (as well as interact with them when they are active).  
I think this is done using the loader tag, right? And since they are animated, I would like to use the gotoAndPlay(“XX”) tag also.

After a few days of searching, reading, and failing, I have this -

red.addEventListener(MouseEvent.MOUSE\_DOWN, reddown, false, 0, true);  
function reddown(evt:MouseEvent):void {  
var request:URLRequest = new URLRequest(“black.swf”);  
var loader:Loader = new Loader();  
loader.load(request);  
addChild(loader);  
var movie:\*=loader.content;  
var clip:MovieClip=movie;  
clip.gotoAndPlay(“away”);  
}

I am also needing to add a gotoAndPlay(“YY”) on another button to make the animation do something else when a button is clicked.

The error I am getting is - TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at loadTryOutsMain\_fla::MainTimeline/reddown()

It also does not play at the right frame.

I am totally lost here.
