Flash CS6 / Flex Error #1009: Cannot access a property or method of a null object reference

Posted in Error, Error, errors, Flash, Flash 10, Flex at 10:06 pm by Curtis J. Morley

TypeError: Error #1009: Cannot access a property or method of a null object reference

ActionScript 3 Error #1009 is an AS3 that you can get for many anecdotal reasons. This error basically means that you are trying to reference something that isn't there yet. That something can be a variable, data from the server, or even a movieClip or other display instance. So if you try and make a call to something and are getting this error simply look at what you are trying to reference and ask yourself is it there yet.
Don't bang your head against the wall any longer. Here I explain one of the most un-obvious ways to get this error.

One reason that you will get AS3 Error #1009 is because you are trying to access a movieClip that isn't instantiated yet. For example you try and reference a movieClip named loader_mc that is inside another movieClip. you are referencing it from a class that you created. Each time you run the test the movie you get the Run-Time Error #1009. You look inside your movieClip and see that the loader_mc is right where you want it. It is on frame 10 inside your animated moveiClip. That is when it dawns on you that the call to loader_mc happens when it is instantiated. Simply, put loader_mc on frame 1 and change it's alpha to 0 and then the movieClip will be instantiated when the call from your custom class is made.

Another reason for this error is simply incorrect targeting. If you target parent.bob and the correct reference is parent.parent.bob then you will get this error as well.

Fix 1 :

Make sure the the reference is instantiated before it is called.  This means that the script is run after the object is loaded or the frame in the animation has been reached etc...

Fix 2 :

Check your targeting

Thanks and Happy Flashing


  1. Nate said,

    August 24, 2007 at 2:13 pm

    I’m new to Flash, and I can’t quite figure out why I would be getting this 1009 error. Do you have any ideas why I might be getting the error with the following code?…

    import flash.events.EventDispatcher;
    import fl.video.*;

    thePlayer.source = “splash.flv”;

    var theCuePoint:Object = new Object();
    theCuePoint.time = 0.001;
    theCuePoint.name = “main_video”;

    function splashCuePoint(evt:MetadataEvent):void {

    thePlayer.addEventListener(MetadataEvent.CUE_POINT, splashCuePoint);

    function buttonClick(evt:MouseEvent):void {

    theButton.addEventListener(MouseEvent.CLICK, buttonClick);

    function loadVideo():void {
    thePlayer.source = “main_video.flv”;
    theButton.enabled = false;
    theButton.visible = false;

  2. Curtis J. Morley said,

    August 27, 2007 at 5:32 pm


    According to your code you haven’t yet instantiated ‘thePlayer’ or ‘theButton’., unless these are on your stage. If you comment out any of the lines that start with thePlayer. you will see that the error goes away. This may be the reason for the error.

    Tell me how you have your Flash file set up so that I can help you debug a little better.

    Curtis J. Morley

  3. Nate said,

    August 27, 2007 at 7:32 pm

    I am using an invisible button to keep my main video from downloading, found here…


    My goal is to make a video player that acts much like the one that YouTube uses. If you click on the image, the video will load, and if you click on the play button, the video will load.

    I have an FLVPlayback component on the stage on the bottom layer, and an invisible rectangle button on the layer above, over the image portion of the FLVPlayback. The FLVPlayback is named “thePlayer”, and the invisible button is named “theButton”. The actions layer is above the other two, and each layer just has one frame.

    To get the play button to work as I want it to, I have the FLVPlayback component first load the “splash.flv” file, which is just a still image. I then used ActionScript to add a cue point 0.001 seconds into the video. When the cue point hits, it then loads the actual video.

  4. Nate said,

    September 4, 2007 at 7:31 pm

    A fix has been found right here…


  5. scottizzl said,

    September 17, 2007 at 10:54 pm

    thank you! =)

  6. Josh said,

    December 24, 2007 at 8:06 am

    Error 1009 is probably the worst trash error EVER! It doesn’t tell you where the error is. It just says 1009 bla bla bla. I can take like the whole day to fix it. And it’s not because I did not know what I was doing, one moment there is no error, the next, it is there. And I never touched the code of the function that initiated the error. I was working on another part. I tried to block some codes in that function to narrow down where the error was and guess what, the error still appeared no matter what. My head is now bleeding and the wall is demolished and the error is still there.

  7. CK said,

    January 12, 2008 at 1:29 pm

    If you use the mxml argument -verbose-stacktraces=true the error will also output the line number where the null pointer exception was thrown. Seems to be a huge time saver for me while developing.

  8. Bojan said,

    March 13, 2008 at 8:54 pm

    i’m getting this error, because I try to access stage like this “stage.addEventListener(MouseEvent.MOUSE_MOVE, MouseListener);”, but I dont think this is right way to do, but cannot find answer anywhere. Can you help me?..

  9. Curtis J. Morley said,

    March 14, 2008 at 7:21 am


    Great tip. Thanks for the comment.


    Sorry about the head trauma man. Often times commenting out code will give this error because it actually makes the value null. Be careful when commenting out code that you are not removing a value that is needed later in the code.


    The syntax stage.addEventListener(MouseEvent.MOUSE_MOVE, MouseListener); is proper and will work by itself and the function MouseListener. It seems that the error is not on this line but rather somewhere else in the code. If you can give me more code I would be happy to help you out with it.

    Curtis J. Morley

  10. james said,

    March 16, 2008 at 10:47 pm

    I am getting this error and can’t figure it out. If anyone can help me it would be appreciated.

    TypeError: Error #1009: Cannot access a property or method of a null object reference. at siter_fla::MainTimeline/siter_fla::frame1()

    this error pops up when I enter code. I tested the code by itself in a different flash file and it works fine, but as soon as I add it to my website that has other code in it it stops working and I get this error.

    here is the code I added

    var myloader:Loader = new Loader();

    fe1_btn.addEventListener(MouseEvent.CLICK, image1);
    function image1(event:MouseEvent):void {
    var request:URLRequest = new URLRequest(“1.gif”);


    fe2_btn.addEventListener(MouseEvent.CLICK, image2);
    function image2(event:MouseEvent):void {
    var request:URLRequest = new URLRequest(“2.gif”);


  11. Matthew said,

    March 20, 2008 at 2:04 pm

    Hi, I’m new to flash and new to action scripting. I have managed in the past to get a graphic as a button go to a url when pressed. BUt now I have decided to try and use Actionscript 3.0. This was mistake number 1 as it has removed the onPress value from the code, after about half an hour I have come up with the code which seems to work once then comes up with the 1009 error.

    My code is as follows. I have also checked it for errors and it says there is none. I have also made sure that each handler has a different tag as to not get confused.

    Just for you to know each of my images/buttons are labeled as section1 and so on up to 4.

    this.section1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
    function mouseDownHandler1(event:MouseEvent):void {
    navigateToURL(new URLRequest(“http://www.mysite.com/”));

  12. Matthew said,

    March 20, 2008 at 2:18 pm

    Update: the error I get exactly is:

    Error #1009: Cannot access a property or method of a null object reference.
    at banner_250x240_fla::MainTimeline/banner_250x240_fla::frame27()

  13. kreish said,

    March 26, 2008 at 8:29 am

    help pls

    at frame 1 i put these lines:


    function(evt:MouseEvent):void {



    what if btnTest is on Frame5?
    what will i do to put all AScodes in single frame but then can access symbols or instance names that will load at later frames?

    I do not want to put AS codes where and exaclty the btn will appear.

    thank u

  14. Ramesh Sakibanda said,

    March 28, 2008 at 4:11 am

    Hi Matthew,

    the reason is, you might not have assigned a variable name to section1

    i.e if you included above script in a frame and that frame *should have* an Object with instance name section1


  15. Bojan said,

    April 12, 2008 at 1:28 pm

    Hi again,

    i’m trying in timeline to create new object witch will stop scene playing until I get mouse event(that is just for lerarning, easiest way for me I think).. Here is the code from timeline..

    import vrnjci.uvod.*;

    var zaDugme = new UlaznaKlasa();

    Now, my way that I’m trying to do in constructor is to stop playing the scene, and listener for event like this..

    package com.vrnjci.uvod {
    import flash.display.*;
    import flash.display.Stage;
    import flash.events.*;

    public class UlaznaKlasa extends MovieClip{
    public function UlaznaKlasa(){

    addEventListener(MouseEvent.MOUSE_MOVE, MouseListener);

    public function Zavrsi():void{
    stage.removeEventListener(MouseEvent.MOUSE_MOVE, MouseListener);

    private function MouseListener(e:Event):void{

    public function Main():void{


    I haven’t found much useful examples or books online, so any help would be largely appreciated :)..

  16. Mady said,

    May 5, 2008 at 7:01 pm

    Hi guys,

    I’m new to Flash & actionScript 3.0 I keep getting the same error as everyone
    TypeError: Error #1009: Cannot access a property or method of a null object reference.at bhbHome_fla::MainTimeline/frame1()
    I’m building a simple website and trying to control movies with “label frames”

    the first code works fine the button “beer_btn” works fine but when I click on the lightH_btn” it doen’t work, I deleted this last button code and the error went away, which means that that’s where the problem is 🙁
    If anyone can help me, it will greatly appreciated



    here is my code:


    function playBeers(event:MouseEvent):void

    function playLight(event:MouseEvent):void

    arrowUM.beer_btn.addEventListener(MouseEvent.CLICK, playBeers);

    lightH_btn.addEventListener(MouseEvent.CLICK, playLight);

  17. Cam said,

    May 8, 2008 at 9:28 am

    Hi there Curtis… I am a huge fan of your site and I use it all the time, although this is my first comment. Most of the time I come to your site and I find it very helpful, usually reading your detailed descriptions of errors helps me figure out what is going on with my AS3 code… but Finally I have run into an issue which has completely stumped me! This is why I am posting on your site.

    I have been working on an AS3 version of objects in 3d space, and I have based this on Paul Ortichanian’s version of the code ( http://reflektions.com/miniml/template_permalink.asp?id=459 ) which he developed in the main timeline of an FLA. I have ported the code over to a class, but for some reason I keep getting this error, #1009, which has pretty much become my arch nemesis! Is there any way I could get you to take a quick look at my code to see if you can spot whats wrong?…it would be greatly appreciated!
    feel free to send me an email and I can send over the FLA etc.

    Thanks so much for your help and great work with the site!… you are helping build the AS3 community through your generosity!

  18. Flex Community Blog » Blog Archive » Flex/Flash TypeError: Error #1009: Cannot access a property or method of a null object reference said,

    June 1, 2008 at 10:27 pm

    […] http://curtismorley.com/2007/08/15/flash-cs3-flex-error-1009-cannot-access-a-property-or-method-of-a… addthis_url = ‘http%3A%2F%2Fblog.flexcommunity.net%2F%3Fp%3D36’; addthis_title = ‘Flex%2FFlash+TypeError%3A+Error+%231009%3A+Cannot+access+a+property+or+method+of+a+null+object+reference’; addthis_pub = ”; […]

  19. curtismorley.com » Search Engine Optimization Example said,

    June 2, 2008 at 5:51 pm

    […] Flex Error 1009 – #4 hit on Google […]

  20. Common ActionScript 3 Errors and Explanations | Jake Rutter - Designer and XHTML/CSS/ActionScript 3 Developer said,

    June 11, 2008 at 10:58 am

    […] also come up with another great explanation as to what this actually means, you can read about it here. Share and Enjoy: These icons link to social bookmarking sites where readers can share and […]

  21. Denice said,

    June 13, 2008 at 7:48 am

    I’m getting this error only when I use this script:
    this.introfilmcontainer.skipknap_mc.buttonMode = true;
    introfilmcontainer.skipknap_mc.addEventListener(MouseEvent.CLICK, skipknap);
    function skipknap(e:MouseEvent):void {
    Its only when I actually USE it. When I don’t use the button everything’s fine…
    What could be my problem?

  22. Curtis J. Morley said,

    June 13, 2008 at 7:55 am


    There are a couple of places that you can get this error. Which line of code is this error on?


    Curtis J. Morley

  23. Chris Brown said,

    June 18, 2008 at 9:33 am

    Working with external text in flash CS3 to create a website using external txt.

    I am using menu buttons in the main stage to change text the main external text box. Everything works fine. I added a two buttons on the sections stage to change the the text in the external text box. and i get this error:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at TAQA_fla::MainTimeline/frame1()

    I have the buttons codes as:



    function b8Listener(event:MouseEvent):void {

    function b9Listener(event:MouseEvent):void{

    Do you need to see the whole code. What do i need to get my buttons to work with out having them on the main stage.

  24. Peter Kahuria said,

    June 21, 2008 at 8:17 pm

    Man, thanks alot! I have been scratching my head over this error and I was even considering going back to using AS 2.0.

    I had movie clips inside another movie clip and your explanation really hit home.

    Thank you again!

  25. Curtis J. Morley said,

    June 21, 2008 at 8:58 pm


    I am glad that this helps. It is worth the extra effort to get the benefits of AS3. Hopefully I will be of more help for you in te future.

    Curtis J. Morley

  26. Gianluca Bruno said,

    July 8, 2008 at 4:11 pm

    I am getting the 1009 error doing something a little differently from others. I have posted my question on the adobe forums, but haven’t able to get a response. I have a button click action:

    The logon function

    private function logon():void
    userSession.userId = userId.text;
    userSession.password = password.text;
    var token:AsyncToken = UserSessionAssembler.createItem(userSession);
    token.operation = “CREATE”;

    The userSession object is being created in the init method, and that is being called on creationComplete

    private function init():void
    userSession = new UserSession();

    The UserSession class is an actionscript class which I created and is mapped to a java class.

    package assets.actionscript
    public class UserSession
    public var userId:String;
    public var password:String;
    public var status:String;

    public function UserSession()

    public function getStatus():String {
    return this.status;

    public function setStatus(status:String):void {
    this.status = status;

    public function getUserId():String
    return this.userId;

    public function setUserId(userId:String):void
    this.userId = userId;

    public function getPassword(password:String):String
    return this.password;

    public function setPassword(password:String):void
    this.password = password;

    If I call the create method directly in the click function I can pass the object to the java class fine and it works, but for some reason when the object userSession is passed to the create method it throws the 1009 error. I have been stuck on this for a few days and has been very frusturating trying to resolve this.

  27. Gianluca Bruno said,

    July 8, 2008 at 4:12 pm

    Sorry for some reason some of my code from the previous post did not submit


  28. robert said,

    July 10, 2008 at 4:42 am

    I’m getting the 1009 error whie accessing the button instance. everything looks fine, and i can’t figure it out. here’s the code:

    apps.addEventListener(MouseEvent.CLICK, clickapps);
    function clickapps(event:Event):void{
    entrees.addEventListener(MouseEvent.CLICK, clickentrees);
    function clickentrees(event:Event):void{

    this is the full error message:

    TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@1ec786a1 to flash.display.SimpleButton.

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at barcelona_fla::MainTimeline/barcelona_fla::frame10()

    thanks for your help.

  29. Curtis J. Morley said,

    July 10, 2008 at 6:43 am


    I tried your code with 2 movieClips on the stage in all frames. With your code the example works fine for me. Because of this I would assume (without being able to see your whole file) that a movieClip is not on the stage or something similar.

    Actually, the second error may disappear if you resolve the first. It sounds like a movieClip is trying to be turned into a button.


    Curtis J. Morley

  30. eduardo said,

    July 22, 2008 at 1:00 pm

    can you tell me how do i aquire success on this function:

    tryin to parse the tweener target dynamically

    import caurina.transitions.*;
    var countNumber;
    var tgt:String;
    function go():void {
    for (count = 1; count < 10; count++) {
    tgt = ‘e’ + conta;
    Tweener.addTween(tgt, { ……. });

  31. Scott said,

    August 12, 2008 at 7:35 pm

    Can anyone help me? I am very green at this and am just trying to do a simple, simple, simple flash site but I cannot get around this 1009 bug. It’s awful and stopping me from getting anywhere.

    Basically how do you get the program to recognize the button as not null. I guess I mean how do you get it to read the button then apply the Action script in the proper order or vice versa whcih ever is correct. I can’t believe Adobe designed this flaw into the program. Horrible! And when i say simple I mean I don’t understand hardly any of the code above. I’m really depressed over this- ruining my efforts t get a site up- i’d made such good progress til now. Any help would be sooooo appreciated.
    The code I am using is below:


    FsAs.addEventListener(MouseEvent.CLICK, FestsAwards);
    function FestsAwards(event:MouseEvent):void {

    CsBs.addEventListener(MouseEvent.CLICK, ContsBios);
    function ContsBios(event:MouseEvent):void {

    Imgs.addEventListener(MouseEvent.CLICK, Images);
    function Images(event:MouseEvent):void {

    CstCrw.addEventListener(MouseEvent.CLICK, CastCrew);
    function CastCrew(event:MouseEvent):void {

    BlgNws.addEventListener(MouseEvent.CLICK, BlogNews);
    function BlogNews(event:MouseEvent):void {
    navigateToURL(new URLRequest(“http://www.shores.blogspot.com/”));

  32. David said,

    August 28, 2008 at 7:19 am

    There are times where I’ve set up listeners in the Class Constructor for objects that live directly on the stage which works fine, but have to slightly rework the Class to add them dynamically, as the listener in the Constructor is simply beating the object to the stage – therefore returning a null. I add an init() function and place my original listeners there, and add a listener to the constructor that fires when the object is actually available:


    YClass extends Whatever{

    public function YClass():void{
    addEventListener(Event.ADDED_TO_STAGE, init);

    private function init():void{
    someObject.addEventListener(MouseEvent.MOUSE_DOWN, someFunction);
    Hopes this helps some of you – it sure helped me.

  33. Jeff said,

    September 19, 2008 at 7:56 am

    I like your site. It is my first stop for understanding actionscript errors.
    Regarding error 1009, I found that when loading external movie clips there is a problem with the timing of items being instantiated. A movie clip that worked fine on its own gave me this error when I loaded it into another swf.
    My solution was to start a timer and run the offending function after a second or so… not that elegant but it works.

    Here is an example of the timer:

    public function addListenersTimer():void
    var myTimer:Timer = new Timer(1000, 1);
    myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, addListeners);

    private function addListeners(e:TimerEvent):void
    _dragger.addEventListener(MouseEvent.MOUSE_DOWN, onDraggerPress, false, 0, true);
    _dragger.addEventListener(MouseEvent.MOUSE_UP, onDraggerUp, true, 0, true);
    _dragger.stage.addEventListener(MouseEvent.MOUSE_UP, onDraggerUp, false, 0, true);

    Thanks again,


  34. Curtis J. Morley said,

    September 19, 2008 at 10:32 pm


    Thanks for this great suggestion. One other thing that you can do is to listen for the COMPLETE event to fire and then assign the appropriate actions. Thanks for the compliments also. It is people like you that make writing like this worthwhile.

    Thanks and Happy Flashing,
    Curtis J. Morley

  35. Jason said,

    September 27, 2008 at 8:36 pm

    Hello Mr. Morley,

    I have a problem with the dreaded TypeError: Error #1009: Cannot access a property or method of a null object reference. I’m creating a flash website and I have the design layout already in flash. My movieclip buttons are not taking the playhead to the specified frame label. Here is the actionscript 3.0 code for just the portfolio movieclip button:

    main_PORTFOLIO_button.buttonMode = true;

    main_PORTFOLIO_button.addEventListener(MouseEvent.ROLL_OVER, portfolioOver);
    main_PORTFOLIO_button.addEventListener(MouseEvent.ROLL_OUT, portfolioOut);
    main_PORTFOLIO_button.addEventListener(MouseEvent.CLICK, portfolioClick);

    function portfolioOver(event:MouseEvent):void
    function portfolioOut(event:MouseEvent):void
    function portfolioClick(event:MouseEvent):void

    The frame label “portfolio” is on the main timeline. I want this movieclip button to go to the frame label “portfolio.” The problem comes about when I click the portfolio button to go the “portfolio” frame label. It goes to the specified frame label and outputs this error message:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Main3_fla::MainTimeline/portfolioOut()

    If you can take a look at this I would really appreciate it.


  36. Valerie Tucker said,

    October 11, 2008 at 10:33 am

    I keep on getting Error #1009 when I am on Facebook and playing Scrabble.
    I press Dismiss all and the games disappear, so I press Continue and the same thing happens! Help!

  37. Ashvin Menon said,

    October 13, 2008 at 10:32 pm

    i’m just curious, it’s an unrelated problem actually, but

    i have a button that is actionscripted to play a movieclip. the thing is, the first frame of that movieclip has a stop(); command in it.

    so my question is, will it play? which script takes higher priority? and if not, is there any way around this?

  38. MELS said,

    October 28, 2008 at 7:46 am

    I came across Error #1009 in a big FLA:
    I testet accesssing nested MovieClips and tell them something (e.g. gotoAndPlay). It’s no problem in my little test FLA. But in my project with long timelines, sounds and graphics, it just won’t work!!!
    The FLA is is here:
    If you run it, you will see the rror and it will bring you to the code I’m talking about.
    I have tried sooo many things, just nothing seems to work. Any suggestions?

  39. elksie2500 said,

    October 30, 2008 at 11:28 am

    I came across Error #1009

    while trying to build a remembrance flash package.

    Essentially, I’m trying to recreate something I’ve seen on the MediaStorm website http://mediastorm.org/0024.htm a scrolling banner of images, each of which acts like a button to click through to a video player that I’ve managed to find.

    But I’ve hit a problem with the error which is driving me mad.

    The URL for the package is:

  40. Curtis J. Morley said,

    October 31, 2008 at 6:26 am


    There are 2 things happening here that are giving you the error. The first is that you have a MOUSE_DOWN event that does a gotoAndStop(“Name”); and you also have a MOUSE_OUT event that changes the alpha. The MOUSE_DOWN happens while the object is still there. The MOUSE_OUT happens because you are no longer in the frame with that button.

    So the MOUSE_OUT is trying to happen on an object that is no longer accessible to Flash because it is no longer on the timeline.

    To fix this you can either just set a variable and then when you come back to the frame you can reset the alpha based off of that variable or you can change the event from a MOUSE_OUT to a MOUSE_UP like so

    profilesMC.fence.kenBettany.addEventListener(MouseEvent.MOUSE_UP, mouseUpkenBettany);

    Hope this helps and happy Flashing.
    Curtis J. Morley

  41. Vince said,

    October 31, 2008 at 2:56 pm

    Hello all! So, I’ve got an Error #1009 issue and would love a little guidance. On the first frame of my timeline, I have preloader animation that tracks the progress of the download. On the last frame of my timeline, I have a movie clip called INTRO_anim that loads after all of the content for my website. What I would like to be able to do is skip to the next frame of the timeline (which is where all the content is) once it’s ready and forget about playing the intro if I choose to do so. When I launch my swf and click on SKIP_btn, a bunch of 1009’s pop up along with some 1010’s. Here’s my code:



    SKIP_btn.buttonMode = true;
    START_btn.buttonMode = true;

    this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
    this.loaderInfo.addEventListener(Event.COMPLETE, onComplete);

    function onProgress (event:ProgressEvent): void {
    var loaded:Number = event.target.bytesLoaded;
    var total:Number = event.target.bytesTotal;
    var pct:Number = loaded/total;
    loaded_txt.text = “Loading Site… ” + (Math.round(pct*100)) + “%”;
    if(framesLoaded >= 22) {
    SKIP_btn.addEventListener(MouseEvent.MOUSE_DOWN, SKIP_early_down);
    SKIP_btn.addEventListener(MouseEvent.MOUSE_OVER, SKIP_early_over);
    SKIP_btn.addEventListener(MouseEvent.MOUSE_OUT, SKIP_early_out);
    loaded_txt.text = “Loading Intro…” + + (Math.round(pct*100)) + “%”;
    function SKIP_early_down (event:MouseEvent): void {
    this.loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
    function SKIP_early_over (event:MouseEvent): void {
    function SKIP_early_out (event:MouseEvent): void {

    if(pct == 1) {
    loaded_txt.text = “”;
    function onComplete (event:Event): void {
    SKIP_btn.addEventListener(MouseEvent.MOUSE_DOWN, SKIP_down);
    SKIP_btn.addEventListener(MouseEvent.MOUSE_OVER, SKIP_over);
    SKIP_btn.addEventListener(MouseEvent.MOUSE_OUT, SKIP_out);

    function SKIP_down (event:MouseEvent): void {
    function SKIP_over (event:MouseEvent): void {
    function SKIP_out (event:MouseEvent): void {

    Any ideas? Thanks a lot for any help.

  42. jabrat said,

    November 3, 2008 at 9:27 am

    var list:XML;
    var items:XMLList;
    var listPos:Number = 0;
    var url:URLRequest = new URLRequest( “http://www.ccchuntersville.com/new/includes/getBannerAds.php” );
    var loader:URLLoader = new URLLoader();
    loader.addEventListener( Event.COMPLETE, onLoadComplete );
    loader.load( url );

    function onLoadComplete( event:Event ):void {
    if( loader.data ) {
    list = XML( loader.data );
    items = list.item;

    trace( list );

    trace( list );

    The first trace works fine, but the second does not. As soon as the function is exited it seems to reset list, why? Is there some scope problem I’m just not seeing. On the next frame I’m trying to access items but I get the 1009 error.

  43. Curtis J. Morley said,

    November 3, 2008 at 3:48 pm


    I see what you mean. The second trace comes back as null. This has an easy explanation for it. If you notice the second trace is output before the first trace. This is because the second trace executes before the Event.COMPLETE triggers.

    So it is not resetting. The function is waiting for “loader” to get data where the trace that is not inside the function doesn’t wait and therefore you get the trace output before the data has arrived.

    The data is there and it is accessible in frame 2 also as long as you have waited for the “loader” to get the data first. If this the only code in frame 1 and you try and access the “items” in frame 2 then it will not have been received yet and therefore Error 1009.

    Try replacing your function with this code:

    function onLoadComplete( event:Event ):void
    if ( loader.data )
    list = XML( loader.data );
    items = list.item;
    trace( list );


  44. Marlin Lopez said,

    November 3, 2008 at 8:01 pm

    I am getting the same error: Error #1009: Cannot access a property or method of a null object reference. at FtScrollBar/checkSize() at FtScrollBar/LwJIyBI91212G2rSD7M351()

    I am using a scrollbar component downloaded from Flashden.net
    the weird thing is at first when movie is tested, button is clicked to access scene 3 which where I am having the problem it works perfect when sub buttons are selected, but if i go back after clicking other buttons to the previous then is when I get the error and scroll bar does not work.

    Here is my actions script for all my buttons:
    sinopsis_btn1.addEventListener(MouseEvent.MOUSE_DOWN, sinopsis_2Handler);
    function sinopsis_2Handler(event:MouseEvent):void {

    gotoAndPlay(1, “Scene 1”);


    elenco_btn.addEventListener(MouseEvent.MOUSE_DOWN, elenco_2Handler);
    function elenco_2Handler(event:MouseEvent):void {

    gotoAndPlay(1, “Scene 2”);


    edmundo_btn.addEventListener(MouseEvent.MOUSE_DOWN, edmundo_1Handler);
    function edmundo_1Handler(event:MouseEvent):void {

    gotoAndPlay(3, “Scene 3”);


    luis_btn.addEventListener(MouseEvent.MOUSE_DOWN, luis_1Handler);
    function luis_1Handler(event:MouseEvent):void {

    gotoAndPlay(1, “Scene 3”);

    mayra_btn.addEventListener(MouseEvent.MOUSE_DOWN, mayra_1Handler);
    function mayra_1Handler(event:MouseEvent):void {

    gotoAndPlay(4, “Scene 3”);


    eric_btn.addEventListener(MouseEvent.MOUSE_DOWN, eric_1Handler);
    function eric_1Handler(event:MouseEvent):void {

    gotoAndPlay(5, “Scene 3”);


    ivan_btn.addEventListener(MouseEvent.MOUSE_DOWN, ivan_1Handler);
    function ivan_1Handler(event:MouseEvent):void {

    gotoAndPlay(6, “Scene 3”);


    jadit_btn.addEventListener(MouseEvent.MOUSE_DOWN, jadit_1Handler);
    function jadit_1Handler(event:MouseEvent):void {

    gotoAndPlay(7, “Scene 3”);


    agustin_btn.addEventListener(MouseEvent.MOUSE_DOWN, agustin_1Handler);
    function agustin_1Handler(event:MouseEvent):void {

    gotoAndPlay(8, “Scene 3”);


    sophie_btn.addEventListener(MouseEvent.MOUSE_DOWN, sophie_1Handler);
    function sophie_1Handler(event:MouseEvent):void {

    gotoAndPlay(9, “Scene 3”);


    carola_btn.addEventListener(MouseEvent.MOUSE_DOWN, carola_1Handler);
    function carola_1Handler(event:MouseEvent):void {

    gotoAndPlay(10, “Scene 3”);


  45. Saravana said,

    November 5, 2008 at 4:00 am

    Hi am getting the following error :

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at fl.video::CuePointManager/dispatchASCuePoints()
    at fl.video::FLVPlayback/http://www.adobe.com/2007/flash/flvplayback/internal::handleVideoEvent()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::doUpdateTime()
    at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
    at flash.utils::Timer/flash.utils:Timer::tick()

    And below is my code :

    import fl.video.FLVPlayback;
    import fl.video.MetadataEvent;
    import fl.video.CuePointType;
    import fl.video.VideoEvent;
    import flash.display.Sprite;

    public class CuePointsTest1 extends Sprite {

    private var videoPath:String = “rtmp://”;
    private var cuePt:Object = new Object(); // create cue point object

    public function CuePointsTest1() {
    trace(‘inside constructor’);
    cuePt.time = 1;
    cuePt.name = “ASCuePt1”;
    cuePt.type = “actionscript”;
    vDO.source = “rtmp://”;
    vDO.skin = “SkinUnderAll.swf”;
    vDO.skinBackgroundColor = 0x666666;
    vDO.skinBackgroundAlpha = 0.5;
    vDO.addASCuePoint(cuePt); //add AS cue point
    vDO.addEventListener(MetadataEvent.CUE_POINT, cp_listener);


    private function cp_listener(eventObject:MetadataEvent):void{
    trace(‘cue point occured’);
    trace(‘after Stop’);
    vDO.removeEventListener(MetadataEvent.CUE_POINT, cp_listener);
    vDO.source = “rtmp://”;
    trace(‘after source’);
    trace(‘after play’);


    private function onComp(eventObject:VideoEvent):void{
    trace(‘Inside onComp’);
    vDO.source = “rtmp://”;



    am new to ActionScript.

    Please help me to solve this error.

    with thanx and regards,

  46. Aaron said,

    November 5, 2008 at 2:41 pm

    I’m having a problem with an download progress bar I have made. All of the instance names are unique, the layers are unique, the symbols are unique. The symbol seems to referenece the classes just fine. The problem is that I get this error, after I have initialized the symbol on the stage. The next command it recieves is to toggle the visibility of the download progress bar, which it carries out, but throws this type error 1009. This would not be a problem except that it will also throw the error on the webpage with CS4.
    I’m still waiting on content for my site from my boss; however, the prototype functions except for this one Type Error.
    I’ve been searching for answer a better part of two days now, any ideas?

    The instance is named Download_Interface
    the parent symbol is downloader_interface;

    Frame 1

    import com.ProjectControls.[ProjectControls;
    import com.ProjectControls.Downloader.Downloader;

    var Download_Interface:Downloader;


    var loaded:Number;
    var total:Number;

    var bar_mc:MovieClip = new MovieClip;
    var loader_txt:TextField = new TextField;

    this.addEventListener(Event.ENTER_FRAME, loading);

    function loading(e:Event):void{

    total = this.stage.loaderInfo.bytesTotal;
    loaded = this.stage.loaderInfo.bytesLoaded;

    bar_mc.scaleX = loaded/total;
    loader_txt.text = “Loading: ” + Math.floor((loaded/total)*100)+ “%”+ ” Complete”;

    if (total == loaded)
    this.removeEventListener(Event.ENTER_FRAME, loading);

    package com.ProjectControls
    import flash.net.*;
    import flash.events.*;
    import flash.display.*;
    import flash.text.*;
    import com.ProjectControls.Downloader.Downloader;

    public class ProjectControls extends MovieClip


    package com.ProjectControls.Downloader
    import flash.net.*;
    import flash.events.*;
    import flash.display.*;
    import flash.display.MovieClip;
    import flash.text.*;
    import flash.utils.*;
    import com.ProjectControls.ProjectControls;

    public class Downloader extends ProjectControls
    public var progressTXT:TextField;
    public var progress_MC:MovieClip;
    public var encasement_MC:MovieClip;
    public var cancelBTN:SimpleButton;
    public var insertedMyFileReference:FileReference = new FileReference;
    public var myrequest:URLRequest;
    public var TotalByteSize:Number;
    public var DownloadedByteSize:Number;

    public function disable():void
    encasement_MC.visible = false;
    progress_MC.visible = false;
    progressTXT.text = ” “;
    cancelBTN.visible = false;
    public function downloadEvent(MyFileReference, myrequest):void
    { enableInterface();
    insertedMyFileReference = MyFileReference;
    insertedMyFileReference.addEventListener(ProgressEvent.PROGRESS, progressHandler);
    insertedMyFileReference.addEventListener(Event.COMPLETE, completeHandler);
    public function enableInterface():void
    cancelBTN.visible = true;
    progressTXT.visible = true;
    progressTXT.text = “PREPARING DOWNLOAD”;
    cancelBTN.enabled = true;
    progress_MC.visible = true;
    encasement_MC.visible = true;
    cancelBTN.addEventListener(MouseEvent.CLICK, CancelDownload);
    * While the file is downloading, update the progress bar’s status. it’s only text, gotta turn text into visual aid
    public function progressHandler(event:ProgressEvent):void
    /*scale a bar via math of bytesloaded/bytestotal*/
    TotalByteSize = event.bytesTotal;
    DownloadedByteSize = event.bytesLoaded;
    progress_MC.scaleX = DownloadedByteSize/TotalByteSize;
    progressTXT.text = “Downloading: ” + Math.floor((DownloadedByteSize/TotalByteSize)*100)+ “%”+ ” Complete”;

    public function completeHandler(event:Event):void
    var timer = new Timer(5000,1);
    timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
    progressTXT.text = “DOWNLOAD COMPLETE”
    cancelBTN.enabled = false;
    function onTimerComplete(event:TimerEvent):void
    progressTXT.visible = false;
    cancelBTN.enabled = false;
    cancelBTN.visible = false;
    encasement_MC.visible = false;
    progress_MC.visible = false;
    public function CancelDownload(event:MouseEvent):void
    var timer = new Timer(5000,1);
    progressTXT.text = “DOWNLOAD CANCELLED”;
    timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
    function onTimerComplete(event:TimerEvent):void
    progressTXT.visible = false;
    cancelBTN.enabled = false;
    cancelBTN.visible = false;
    encasement_MC.visible = false;
    progress_MC.visible = false;


  47. Aaron said,

    November 5, 2008 at 3:25 pm

    I figured it out. my guess, the preloader prevented the object from initializing, and by moving Download_Interface.disable(); to the frame after the preloader, made everything work. Weird…

  48. elksie2500 said,

    November 13, 2008 at 2:46 pm


    Thanks for your help. I’ve now got my package working. Cheers


  49. cassie said,

    November 16, 2008 at 1:34 pm

    I have to use scenes for my project. I am getting this error code to.

    My button to contacts works. but once it gets there is when i get the error code. here is my code

    btnHome.addEventListener(MouseEvent.CLICK, goHome);
    btnContact.addEventListener(MouseEvent.CLICK, goContact);
    btnServices.addEventListener(MouseEvent.CLICK, goServices);
    function goHome(event:MouseEvent):void {
    gotoAndStop(203, “Scene 1”);
    function goContact(event:MouseEvent):void {
    gotoAndPlay(1, “Scene 2”);
    function goServices(event:MouseEvent):void {
    gotoAndStop(1, “Scene 3”);

  50. Siah said,

    November 22, 2008 at 2:53 pm

    Howdy, getting the error in question and stuck.
    Have a map style nav setup to scroll to different sections of a large movieclip and getting the error.
    I have the mc’s that I’m trying to pull in set with the linkage on. Should I still have them on the stage with an alpha of 0 or something. Many Thanks:

    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;

    var homeX:Number = 500;
    var homeY:Number = 375;

    var aboutX:Number = 1024.0;
    var aboutY:Number = 768;

    var mediaX:Number = -24;
    var mediaY:Number = 768;

    var newsX:Number = 1024.0;
    var newsY:Number = -18;

    var contactX:Number = 24;
    var contactY:Number = 28;

    var xTween:Tween;
    var yTween:Tween;
    var inTween:Tween;
    var outTween:Tween;

    xTween = new Tween(main_mc,”x”, Strong.easeInOut,main_mc.x,homeX,2,true);
    yTween = new Tween(main_mc,”y”, Strong.easeInOut,main_mc.y,homeY,2,true);

    inTween = new Tween(main_mc.home_mc, “alpha”, None.easeNone, 0,1,.5,true);
    outTween = new Tween(main_mc.home_mc, “alpha”, None.easeNone, 1,0,.5,true);


    home_btn.addEventListener(MouseEvent.CLICK, navigate);
    about_btn.addEventListener(MouseEvent.CLICK, navigate);
    media_btn.addEventListener(MouseEvent.CLICK, navigate);
    news_btn.addEventListener(MouseEvent.CLICK, navigate);
    contact_btn.addEventListener(MouseEvent.CLICK, navigate);

    function navigate(event:MouseEvent):void
    if(event.target == about_btn)
    else if(event.target == media_btn)
    else if(event.target == news_btn)
    else if(event.target == contact_btn)

    function setTween(tweenX:Number,tweenY:Number, tweenMC:MovieClip):void
    xTween.begin = main_mc.x;
    yTween.begin = main_mc.y;
    xTween.finish = tweenX;
    yTween.finish = tweenY;
    tweenMC.alpha = 0;
    inTween.obj = tweenMC;

    function fadeIn(event:TweenEvent):void
    outTween.obj = inTween.obj;
    function fadeOut(event:TweenEvent):void


  51. Mike B. said,

    December 11, 2008 at 11:30 pm

    Hi Curtis,

    Heeelp! I’m getting the dreaded 1009! 🙂 I’m trying to preload my main movie swf externally which has a doc class. The doc class controls a particle effect (the one we made in class) but it gives me the 1009 when it loads. If I comment out the particles “for” loop in the doc class I don’t get the error. I think it has something to do with the “stage” being passed into the ParticleLogo() function but I’m stumped. Is there a better way to do this then what I have below?

    import flash.display.MovieClip;

    public class Bohmanart extends MovieClip
    public function Bohmanart():void
    trace(“doc class loaded”);
    private function init():void
    for (var i:uint = 0; i < 19; i++)
    var myNewLogo:ParticleLogo = new ParticleLogo(stage);
    myNewLogo.x = Math.random()*(stage.stageWidth-myNewLogo.width)+myNewLogo.width/2;
    myNewLogo.y = Math.random()*(stage.stageHeight-myNewLogo.height)+myNewLogo.height/2;
    myNewLogo.cacheAsBitmap = true;
    addChildAt(myNewLogo, 0);

    var bohmanart:Loader = new Loader();
    var req:URLRequest = new URLRequest(“bohmanart.swf”)

    bohmanart.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, prog);
    bohmanart.contentLoaderInfo.addEventListener(Event.COMPLETE, fin);

    function prog(e:ProgressEvent):void
    var perc:Number = e.bytesLoaded / e.bytesTotal;

    function fin(e:Event):void

  52. Scott Guthrie said,

    December 13, 2008 at 6:02 pm

    Hi Curtis,
    I making a game in Flash CS3. I keep getting this error. Here’s the error:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.at my_algebra_map_11_24_fla::MainTimeline/checkDoors()

    and here is the function checkDoors:

    function checkDoors(event:Event):void {

    var doors:Array = new Array();
    doors=[map.door1, map.door2, map.door3, map.door4];

    if(character.hitTestObject(map.door1)) {

    if(character.hitTestObject(map.door2)) {


    I am lost as to how the code isn’t finding door1 and door2.
    Any suggestions would be great!
    thanks for the wonderful site,

  53. Jasen Burkett said,

    December 14, 2008 at 7:10 pm

    Making a flash As3 form that takes the info entered and puts it into a mysql database by using php.

    — the code —

    usrPassword.displayAsPassword = true;

    registerBtn.addEventListener(MouseEvent.CLICK, sdClicked);
    function sdClicked(e:MouseEvent):void {
    if (usrFName.text!=”” && usrLName.text!=”” && usrLogin.text!=”” && usrPassword.text!=””) {
    var myData:URLRequest = new URLRequest(“mysite.php”);
    myData.method = URLRequestMethod.POST;
    var variables:URLVariables = new URLVariables;
    variables.usrFName = usrFName.text;
    variables.usrLName = usrLName.text;
    variables.usrLogin = usrLogin.text;
    variables.usrPassword = usrPassword.text;
    myData.data = variables;
    var loader:URLLoader = new URLLoader();
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;
    function dataOnLoad(evt:Event) {
    if(evt.target.data.writing==”Ok”) {
    } else {
    status_txt.text = “Error in saving submitted data”;
    loader.addEventListener(Event.COMPLETE, dataOnLoad);
    } else {
    status_txt.text = “All fields are mandatory”;

    — the error —
    Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
    at Error$/throwError()
    at flash.net::URLVariables/decode()
    at flash.net::URLVariables()
    at flash.net::URLLoader/onComplete()

    So what the crap is wrong?

    I am almost ready to throw flash in the toliet and go back to the basics and use striaght php.

    any help is greatly needed

  54. Giuseppe said,

    December 20, 2008 at 4:43 am

    Hello. I get this error but just if i’m dowloading the swf from a web server or I’m simulating the download in the authoring mode. I’ve got an onEnterFrame function and in the very earlier cycles it seems not able to find the .text property of a textfield wich is inside a movieclip attached from the libraryusing addChild(). I’m also sure that the addChild method is called before the onEnterFrame function starts. Any ideas? And, by the way, the error I see in my browser can be seen by anyone or just by developers? Thank you.

  55. Phil said,

    December 27, 2008 at 4:25 am

    I get this error and I can’t figure it out. I am new to actionscript so please help me out. Here is my code:

    import flash.events.MouseEvent;
    import flash.display.MovieClip;

    function services(MouseEvent):void {

    function servgone(MouseEvent):void {

  56. Paul said,

    December 31, 2008 at 11:37 am

    Well, you can try two things…

    a) It’s better to just assign an event that fires when the new SWF is finished loading… (instead of the OnEnter way)

    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompletedFunction);

    B) And try accessing your newly loaded variables like this…

    localVar = MovieClip(myLoader.content).someVar;

    The MovieClip() wrapper apparently is required here, or things get screwed up.

    Good luck!

  57. imjake9 said,

    January 1, 2009 at 2:52 pm

    Help! I’m being held hostage by error 1009!

    Here’s the problem. I have a program I’m trying to make for AIR with flash. So far, it is only a basic text editor. Here’s my code:

    import flash.filesystem.*

    var defaultDirectory:File = File.documentsDirectory;
    var stream:FileStream;
    var currentFile:File;
    openBTN.addEventListener(MouseEvent.CLICK, openFileFunction)
    saveBTN.addEventListener(MouseEvent.CLICK, saveFileFunction)
    saveAsBTN.addEventListener(MouseEvent.CLICK, saveAsFileFunction)

    function openFileFunction(event:MouseEvent):void {
    function openFile(root:File){
    var TXTFilter:FileFilter = new FileFilter(“Text (*.txt,*.htm,*.html)”,”*.txt;*.htm;*.html”)
    root.browseForOpen(“Open”, [TXTFilter])
    root.addEventListener(Event.SELECT, openFileSelected)
    function openFileSelected(event:Event):void {
    stream = new FileStream;
    currentFile = defaultDirectory
    stream.openAsync((currentFile as File), FileMode.READ)
    stream.addEventListener(Event.COMPLETE, fileReadHandler)
    function fileReadHandler(event:Event):void {
    var txt:String = stream.readUTFBytes(stream.bytesAvailable);
    MainTXT.text = txt
    function saveFileFunction(event:MouseEvent){
    function saveFile(){
    if (currentFile){
    if (stream != null){
    stream.open(currentFile, FileMode.WRITE);
    var txt:String = MainTXT.text
    } else {
    function saveAsFileFunction(event:MouseEvent){
    function saveFileAs(root:File){
    root.browseForSave(“Save As”)
    root.addEventListener(Event.SELECT, saveAsFileSelected)
    function saveAsFileSelected(event:Event):void{
    currentFile = defaultDirectory

    I have openBTN, saveBTN, and saveAsBTN on the stage. Also, it says my error is on line 41. This is inside the saveFile() function, on this line:

    stream.open(currentFile, FileMode.WRITE)

    What is wrong?

  58. imjake9 said,

    January 2, 2009 at 9:15 am

    Also, MainTXT is a text field on the stage.

  59. imjake9 said,

    January 4, 2009 at 9:48 am

    Oops, I figured it out. I forgot this line:

    stream = new FileStream()

  60. Ogre2020 said,

    January 7, 2009 at 8:48 am

    Ok, this should be EZ but I cant get it. i have a function that displays an image when a certain object is clicked. I want to remove the previous image when the next object is clicked but i cant seem to access it outside of the block that its in, as shown by the 2 trace methods… I just get the lovely ERROR#1009 on the trace outside of the if statement

    function dispMain(bookInput:XML, curn:int):void {

    if (swh1 == 0) {
    var loader:Loader = new Loader();
    var loaderMain:MovieClip = new MovieClip();
    loaderMain.mouseChildren = false;

    loaderMain.name = “loadmain”;

    var loader2:Loader = new Loader();
    var loadMask:MovieClip = new MovieClip();
    loadMask.mouseChildren = false;
    loadMask.name = “stageMask”;
    loader2.load(new URLRequest(“http://www.squisheesoft.com/images/clearfix.png”));
    loadMask.x = 20;
    loadMask.y = 100;
    loadMask.scaleX = 60;
    loadMask.scaleY = 100;
    loaderMain.mask = loadMask;

    loader.load(new URLRequest(bookInput.Book.imageLG.text()[curn]));
    loaderMain.x = 30;
    loaderMain.y = 50;
    loaderMain.scaleX = .5;
    loaderMain.scaleY = .5;

    loaderMain.addEventListener(MouseEvent.MOUSE_DOWN, mainDrag);
    loaderMain.addEventListener(MouseEvent.MOUSE_UP, stopDr);
    loaderMain.addEventListener(MouseEvent.MOUSE_OUT, stopDr);
    trace (loaderMain.name);
    swh1 = 1;

    swh1 = 0;
    trace (loaderMain.name);


    if you need the complete code, let me know

  61. pomp said,

    January 21, 2009 at 11:49 am

    i am brand new to flash so pardon me if this is retarded. im trying to make a button which has a movieclip as its mouseover function work as a link to an external site. no matter what i do to the code the button remains non-functional and i get the 1009 error. please help

    pure.addEventListener(MouseEvent.CLICK, pureitem)
    function pureitem (evt) {
    var url = “http://myweb.com/”
    navigateToURL(new URLRequest(url))

  62. Dan R said,

    January 22, 2009 at 11:33 am

    I am doing a Flash site where buttons are clicked and external SWFs load via “addChildAt (myLoader, 0)”. Each SWF that loads has on its first frame a preloader script and movie then the main content starts at frame 2. When the site loads, it loads home.swf into eec.swf (which contains navigation). No errors yet, until I load another SWF. No matter which SWF is loaded next, I get “TypeError: Error #1009: Cannot access a property or method of a null object reference. at home_fla::MainTimeline/PL_LOADING()”. My guess is this has something to do with navigation being in the parent (eec.swf) and the function being in a child (home.swf), but I can’t figure out how to fix it without breaking the loading SWF itself. Each SWF works correctly with no error by itself. Any help would be greatly appreciated.

    Here is the eec.swf frame1 script which controls navigation:

    import flash.display.*;

    var myLoader:Loader = new Loader();
    myLoader.load(new URLRequest(“home.swf”));
    addChildAt(myLoader, 0);

    function uiButton(event:MouseEvent):void {
    //if home button is clicked
    if (event.target==home_btn) {
    if (currentLabel==”about”) {
    } else {
    myLoader.load(new URLRequest(“home.swf”));
    addChildAt(myLoader, 0);
    //if New Construction button is clicked
    if (event.target==newConstr_btn) {
    if (currentLabel==”about”) {
    myLoader.load(new URLRequest(“newConstr.swf”));
    addChildAt(myLoader, 1);
    } else {
    myLoader.load(new URLRequest(“newConstr.swf”));
    addChildAt(myLoader, 1);
    //if Remodeling button is clicked
    if (event.target==remodel_btn) {
    if (currentLabel==”about”) {
    myLoader.load(new URLRequest(“remodel.swf”));
    addChildAt(myLoader, 1);
    } else {
    myLoader.load(new URLRequest(“remodel.swf”));
    addChildAt(myLoader, 1);
    //if Custom Builds button is clicked
    if (event.target==custom_btn) {
    if (currentLabel==”about”) {
    myLoader.load(new URLRequest(“custom.swf”));
    addChildAt(myLoader, 1);
    } else {
    myLoader.load(new URLRequest(“custom.swf”));
    addChildAt(myLoader, 1);
    //if About button is clicked
    if (event.target==about_btn) {


    Here is the frame 1 preloader script that is each SWF that is loaded:

    import flash.display.*;

    this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, PL_LOADING);

    function PL_LOADING(event:ProgressEvent):void {
    var pcent:Number=event.bytesLoaded/event.bytesTotal*100;
    loading_txt.text=”Loading – ” +int(pcent)+”%”;


  63. Dan R said,

    January 22, 2009 at 1:14 pm

    By the way, you can see the test site at http://www.rahmweb.com/eec.

  64. Tod said,

    January 31, 2009 at 11:18 pm


    i have problem with #1009 error
    i wtached Object-Oriented Scrollbar: Part 2 video tutorial

    source of tutorial:
    every thing is fine
    but, when i load the swf to main.swf

    – i can scrol the scroller, but not the content
    – i got this error

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at com.leebrimelow.ui::ScrollBar()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at com.leebrimelow.ui::ScrollBox()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at com.leebrimelow.ui::ScrollBox()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()

    the scenario is:
    – the main time line play and stop at 56.
    – at 56 the main.swf loads the sec1.swf

    any help please to fix this prob
    Thanks in advance

  65. Michiel said,

    February 1, 2009 at 8:49 am

    Hello Curtis J Morley,

    I still have a problem with the TypeError: Error #1009: Cannot access a property or method of a null object reference in Flash Actionscript 3. Could you please help me?

    I have several buttons,all of them on different keyframes with their own label tag (Page0, Page1, Page2, and so on). I have this code on my button in Page0 in my main time line actions layer:

    button1.addEventListener(MouseEvent.CLICK, action1);
    function action1(event:MouseEvent):void {
    //click event
    if(event.type == “click”){

    This button works, however: the addEventListener is not removed, it is still there when entering frame Page1! When I then try to hit button2 in frame Page1 to go to frame page2, it won’t work: the flash movie will not go to and stop at Page2, because the eventListener is still searching for button1, which is not on the stage anymore. Flash then gives me the null-object error.

    So can you please tell me how to remove the addEventListener of button1 when the button is clicked and the flash movie goes to the frame Page1?

    Thanks in advance!

    Regards, Michiel (AS3 newbie)

  66. StefanK said,

    February 3, 2009 at 11:39 pm

    The best 1009 advice on the whole wide web… thank you Mr. Morley!

  67. Jimmy Yuan said,

    February 4, 2009 at 6:32 pm

    I keep getting the error whats wrong with it?


    function goHome(e:MouseEvent):void {
    Home_btn.addEventListener(MouseEvent.CLICK, goHome);

    function goDivisions(e:MouseEvent):void {
    Div_btn.addEventListener(MouseEvent.CLICK, goDivisions);

    function goHistory(e:MouseEvent):void {
    History_btn.addEventListener(MouseEvent.CLICK, goHistory);

    function goPhotos(e:MouseEvent):void {
    Photos_btn.addEventListener(MouseEvent.CLICK, goPhotos);

    function goVideos(e:MouseEvent):void {
    Videos_btn.addEventListener(MouseEvent.CLICK, goVideos);

    function goSponsors(e:MouseEvent):void {
    Sponsors_btn.addEventListener(MouseEvent.CLICK, goSponsors);

    function goContact(e:MouseEvent):void {
    Contact_btn.addEventListener(MouseEvent.CLICK, goContact);

    function goDesign(e:MouseEvent):void {
    Design_btn.addEventListener(MouseEvent.CLICK, goDesign);

    function goEngineering(e:MouseEvent):void {
    Engineering_btn.addEventListener(MouseEvent.CLICK, goEngineering);

    function goFinance(e:MouseEvent):void {
    Finance_btn.addEventListener(MouseEvent.CLICK, goFinance);

    function goMarketing(e:MouseEvent):void {
    Marketing_btn.addEventListener(MouseEvent.CLICK, goMarketing);

    function goOperations(e:MouseEvent):void {
    Operations_btn.addEventListener(MouseEvent.CLICK, goOperations);

    function goback(e:MouseEvent):void {
    back_btn.addEventListener(MouseEvent.CLICK, goHome);

    Sponsors_btn.addEventListener(MouseEvent.CLICK, goSponsors);

  68. Caitlin L said,

    March 4, 2009 at 4:22 pm

    If someone could help me out, I would be REALLY appreciative.

    I’ve been banging my head against the wall for TOO long on this.

    Essentially here’s how I’m set up.
    – On the mainstage I have a control layer (play and stop) that can control an intro audio
    – On the mainstage I also have a main movieclip for my menu.
    – Everything else is within this main movieclip (instance: MCmenu)

    – I’m externally loading all other pages (swf’s) via a load function, so that when the appropriate menu button is chosen, the proper swf is loaded into the viewing area designated on the stage.

    – I’ll include my main coding below, but ALL of my buttons work except one within menu_mc. and I’m still getting the following error that WON’T go away.

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at MrpNewMenu_fla::MCmenu_3/frame1()

    Here’s my coding for ALL of the other buttons…..

    // create a new movie clip to hold loaded content
    var contentHold:MovieClip = new MovieClip();
    contentHold.x = 175;
    contentHold.y = 100;
    var swfHolder:MovieClip;

    // Loading code
    var myURLrequest:URLRequest = new URLRequest();
    var myLoader:Loader = new Loader();
    myLoader.contentLoaderInfo.addEventListener(Event.INIT, loadInitListen);
    function loadInitListen($e) {
    trace (“Loaded”);
    if (contentHold.numChildren > 0) {
    trace(“Num children ” + contentHold.numChildren);
    for (var j = 0; j < contentHold.numChildren; j++) {
    swfHolder = MovieClip(myLoader.content);
    // Menu code
    menu_mc.addEventListener(MouseEvent.CLICK, menuClickListen);

    function menuClickListen($e:MouseEvent):void {
    switch ($e.target) {
    case menu_mc.info_mc.infosub_mc.whatgs_btn:
    trace(“InfoWomen Loaded”);
    myURLrequest.url = “InfoWomen.swf”;
    case menu_mc.women_mc.womensub_mc.wdiff_btn:
    trace(“WomenDiff Loaded”);
    myURLrequest.url = “WomenandSubstances.swf”;
    /*case menu_mc.women_mc.womensub_mc.womenuse_btn:
    trace(“Why Women Use Loaded”);
    myURLrequest.url = “WomenandSubstances.swf”;
    case menu_mc.subclass_mc.diffcat_btn:
    trace(“Diffcat Loaded”);
    myURLrequest.url = “SubstanceIntro.swf”;
    case menu_mc.subclass_mc.stim_mc.stimsub_mc.stimintro_btn:
    trace(“Stim Intro Loaded”);
    myURLrequest.url = “Stim.swf”;
    case menu_mc.subclass_mc.stim_mc.stimsub_mc.cocaine_btn:
    trace(“StimBody Loaded”);
    myURLrequest.url = “StimBody.swf”;
    case menu_mc.subclass_mc.stim_mc.stimsub_mc.crisk_btn:
    trace(“StimRisk Loaded”);
    myURLrequest.url = “StimRisk.swf”;
    case menu_mc.subclass_mc.depress_mc.depsub_mc.depintro_btn:
    trace(“Depress Intro Loaded”);
    myURLrequest.url = “Depress.swf”;
    case menu_mc.subclass_mc.depress_mc.depsub_mc.heroinbody_btn:
    trace(“Depress Body Loaded”);
    myURLrequest.url = “DepressBody.swf”;
    case menu_mc.subclass_mc.depress_mc.depsub_mc.heroinrisk_btn:
    trace(“Depress Risk Loaded”);
    myURLrequest.url = “DepressRisk.swf”;
    case menu_mc.subclass_mc.hall_mc.hallsub_mc.hallintro_btn:
    trace(“Hall Intro Loaded”);
    myURLrequest.url = “HallucinIntro.swf”;
    case menu_mc.subclass_mc.hall_mc.hallsub_mc.hallbody_btn:
    trace(“Hall Body Loaded”);
    myURLrequest.url = “HallucinBody.swf”;
    case menu_mc.subclass_mc.hall_mc.hallsub_mc.hallrisk_btn:
    trace(“Hall Risk Loaded”);
    myURLrequest.url = “HallucinRisk.swf”;
    case menu_mc.pregnancy_mc.pregsub_mc.baby_btn:
    trace(“Baby Effects Loaded”);
    myURLrequest.url = “PregIntro.swf”;
    case menu_mc.pregnancy_mc.pregsub_mc.fasd_btn:
    trace(“FASD Loaded”);
    myURLrequest.url = “Fasd.swf”;
    case menu_mc.pregnancy_mc.pregsub_mc.preghealth_btn:
    trace(“Preg Health Loaded”);
    myURLrequest.url = “PregHealth.swf”;
    case menu_mc.health_mc.healthsub_mc.pain_btn:
    trace(“Pain Management Loaded”);
    myURLrequest.url = “HealthPromo.swf”;
    // Playback control
    /*play_mc.addEventListener(MouseEvent.CLICK, playListen);
    function playListen($e) {
    stop_mc.addEventListener(MouseEvent.CLICK, stopListen);
    function stopListen($e) {

    play_mc.addEventListener(MouseEvent.CLICK, playListen);
    function playListen(event:MouseEvent):void {
    stop_mc.addEventListener(MouseEvent.CLICK, stopListen);
    function stopListen(event:MouseEvent):void {

    I have no idea why this is happening and really need a solution, as I’m not that advanced in coding.

    Thanks in advance

  69. Caitlin L said,

    March 4, 2009 at 4:42 pm

    Oh, and if it helps at all,

    the button that’s not working gives me this error whenever I try to click on it upon export

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at MrpNewMenu_fla::MainTimeline/menuClickListen()

  70. Garrett said,

    March 5, 2009 at 3:47 pm

    Hello Curtis,

    This has been killing me for over a week. After searching the web I landed here. This is the best explanation that I’ve seen yet. But my problem seems to be compounded. Let me try to briefly explain.

    I have a simple VR, with a scroller that moves a plane back and forth. Works good. I have Nodes that animate on the plane that call out specific information about those parts. The Nodes cannot be on all the time because the Nodes intersect. Giving false links.

    This SWF is then loaded into a main file that loads up text and video depending on the clicked Node.

    I have the Scroller on the main timeline, with the Nodes and VR inside a MovieClip. I’m stuck and was hoping to find a solution that does not include going back to AS2.

    Thanks in advance.

  71. matt said,

    March 8, 2009 at 5:41 pm

    i get this error when i use a code like this and go to another frame:

    addEventListener(Event.ENTER_FRAME, movingEveryFrameFunctions);

    function movingEveryFrameFunctions(event:Event):void{
    if(leftRight == 2 && allreadyIns1 == false){
    insCircle1.visible = false;
    insCircle2.visible = true;
    allreadyIns1 = true;
    if(leftRight == 2 && spaceDown == true && allreadyIns2 == false){
    insCircle2.visible = false;
    insCircle3.visible = true;
    allreadyIns2 = true;

    don’t worry all variables and such are defined elsewhere. and i figured out that the ENTER_FRAME event keeps happening and executing that function
    even while the frame is different and therefore, since the movieClips insCircle 1 through 3 don’t exist on the display list, the error comes up.

  72. conan said,

    March 18, 2009 at 6:44 pm

    Thanks, Curtis!

    Your example saved me hours of pulling out my hair and rewriting my (perfectly fine) code–I just put it in the wrong spot on the timeline.

  73. guri said,

    April 28, 2009 at 5:06 am

    I’m getting this error:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.at proces2_fla::MainTimeline/scrollPanel()

    does anyone know what I doing wrong???

    my code on scene is:




    function clickHandler(event:MouseEvent):void{
    navigateToURL(new URLRequest(“http://www.e41364.monline.dk/forside.html”),”_self”);

    function clickHandler1(event:MouseEvent):void{
    navigateToURL(new URLRequest(“http://www.e41364.monline.dk/skraedderi.html”),”_self”);

    function clickHandler3(event:MouseEvent):void{
    navigateToURL(new URLRequest(“http://www.e41364.monline.dk/filosofi.html”),”_self”);

    function clickHandler4(event:MouseEvent):void{
    navigateToURL(new URLRequest(“http://www.e41364.monline.dk/accos.html”),”_self”);

    function clickHandler5(event:MouseEvent):void{
    navigateToURL(new URLRequest(“http://www.e41364.monline.dk/matr.html”),”_self”);

    function clickHandler6(event:MouseEvent):void{
    navigateToURL(new URLRequest(“http://www.e41364.monline.dk/foran.html”),”_self”);

    panel.addEventListener(MouseEvent.MOUSE_OVER, panelOver);

    function panelOver(event:MouseEvent):void{
    panel.removeEventListener(MouseEvent.MOUSE_OVER, panelOver);
    panel.addEventListener(Event.ENTER_FRAME, scrollPanel);

    var b:Rectangle = stroke.getBounds(this);

    function scrollPanel(event:Event):void{
    if(mouseX b.right || mouseY b.bottom) {
    panel.removeEventListener(Event.ENTER_FRAME, scrollPanel);
    panel.addEventListener(MouseEvent.MOUSE_OVER, panelOver);


    if(panel.x >= 235) {
    panel.x = 235;

    if(panel.x <= -480) {
    panel.x = -480;

    var xdist = mouseX – 450;

    panel.x += -xdist / 5;
    and in a movieclip I have this code:


    function gotoSt1(event:MouseEvent):void{


    function gotoSt2(event:MouseEvent):void{


    function gotoSt3(event:MouseEvent):void{


    function gotoSt4(event:MouseEvent):void{


    function gotoSt5(event:MouseEvent):void{

  74. Linda said,

    May 12, 2009 at 2:12 pm

    Hello I keep receiving this actionscript error #1009. I do not know how it got there I let my 8 year play a game on the computer and since then this error now appears. Please help me get rid of it or find out where it came from. It also makes my screen blink on and off.

  75. Pete said,

    May 15, 2009 at 9:45 am

    Thanks for this! I was getting the error ONLY when view the flash in Firefox. It didnt display it in the output window when I was working on it and didnt apear when using IE. Very weird. But including the MC in question through out and turning the opacity to 0% fixed it

  76. Dave said,

    May 18, 2009 at 4:43 am

    Hi im getting this error in the following, please help – its driving me nutts!

    // Copyright (c) 2008, the Open Video Player authors. All rights reserved.
    // Redistribution and use in source and binary forms, with or without
    // modification, are permitted provided that the following conditions are
    // met:
    // * Redistributions of source code must retain the above copyright
    // notice, this list of conditions and the following disclaimer.
    // * Redistributions in binary form must reproduce the above
    // copyright notice, this list of conditions and the following
    // disclaimer in the documentation and/or other materials provided
    // with the distribution.
    // * Neither the name of the openvideoplayer.org nor the names of its
    // contributors may be used to endorse or promote products derived
    // from this software without specific prior written permission.

    // AkamaiConnection class AS3 Reference Player
    // This class demonstrates use of the AkamaiConnection class
    // in connecting to the Akamai CDN and in rendering and controlling
    // a streaming video.

    package {

    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.events.NetStatusEvent;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.media.Video;
    import fl.controls.Button;
    import fl.controls.Slider;
    import fl.events.SliderEvent;
    import flash.external.ExternalInterface;

    import org.openvideoplayer.events.*;
    import org.openvideoplayer.net.*;

    public class accommodation extends MovieClip {

    // UI elements
    private var _video:Video;
    private var _bPlayPause:Button;
    private var _bStopVid:Button;
    private var _bFullscreen:Button;
    private var _videoSlider:Slider;
    private var _volumeSlider:Slider;
    private var _timeDisplay:TextField;
    private var _bufferingDisplay:TextField;

    // Variables
    private var _nc:AkamaiConnection;
    private var _ns:OvpNetStream;
    private var _dragging:Boolean;
    private var _streamLength:Number;

    // Constants – replace these with references to your own content
    private const HOSTNAME:String = “cp23245.edgefcs.net/ondemand”;
    private var FILENAME:String = “23245/mm/flvmedia/806/W/e/b/WebSafeAccomodation-201029?cid=806&aid=201029&afid=306727”;
    // Constructor
    public function accommodation():void {

    // Add the children to the stage
    private function addChildren():void {
    // Draw background
    // Add video
    _video = new Video(898,393);
    _video.x = 0;
    _video.y = 0;
    _video.height = 393;
    _video.width = 898;
    // Add playPause button
    _bPlayPause = new Button();
    _bPlayPause.width = 45;
    _bPlayPause.label = “Pause”;
    _bPlayPause.enabled = false;
    _bPlayPause.x = 40;
    _bPlayPause.y = 350;
    // Add Stop button
    _bStopVid = new Button();
    _bStopVid.width = 40;
    _bStopVid.label = “Stop”;
    _bStopVid.enabled = false;
    _bStopVid.x = 90;
    _bStopVid.y = 350;
    // Add the video slider
    _videoSlider = new Slider();
    _videoSlider.width = 200;
    _videoSlider.x = 140;
    _videoSlider.y = 360;
    _videoSlider.minimum = 0;
    _videoSlider.enabled = false;
    // Add the volume slider
    //_volumeSlider = new Slider();
    //_volumeSlider.width = 80;
    //_volumeSlider.x = 250;
    //_volumeSlider.y = 210;
    //_volumeSlider.minimum = 0;
    //_volumeSlider.maximum = 100;
    //_volumeSlider.value = 80;
    //_volumeSlider.enabled = false;
    // Add the time display
    var format:TextFormat = new TextFormat();
    format.color = 0xFFFFFF;
    format.font = “Verdana”;
    format.bold = true;
    _timeDisplay = new TextField();
    _timeDisplay.x = 240;
    _timeDisplay.y = 230;
    _timeDisplay.width = 200;
    _timeDisplay.defaultTextFormat = format;
    // Add the buffering display
    _bufferingDisplay = new TextField();
    _bufferingDisplay.x = 140;
    _bufferingDisplay.y = 340;
    _bufferingDisplay.width = 200;
    _bufferingDisplay.defaultTextFormat = format;
    _bufferingDisplay.text = “Loading …”;

    // Handle the start of a video scrub
    private function beginDrag(e:SliderEvent):void {
    _dragging = true;

    // handle the end of a video scrub
    private function endDrag(e:SliderEvent):void {

    // Update the volume
    private function volumeHandler(e:SliderEvent):void {
    _ns.volume = _volumeSlider.value/100;

    // Handles the playPause button press
    private function doPlayPause(e:MouseEvent):void {
    switch (_bPlayPause.label) {
    case “Pause” :
    _bPlayPause.label = “Play”;
    case “Play” :
    _bPlayPause.label = “Pause”;

    // Handles the StopVid button press
    private function doStopVid(e:MouseEvent):void {
    var result:Boolean = ExternalInterface.call(‘showhide’, ‘flash’);
    //private function doStopAnim(e:MouseEvent):void {
    //var result:Boolean = ExternalInterface.call(‘zxcSlideShow’, ‘Tst,auto+’);

    // Initializes variables with starting values
    private function initVars():void {
    _dragging = false;
    _nc = new AkamaiConnection();

    // Handles a successful connection
    private function connectedHandler():void {
    trace(“Successfully connected using ” + _nc.actualProtocol + ” on port ” + _nc.actualPort);
    // As soon as we are connected, we’ll measure the available bandwidth

    _ns = new OvpNetStream(_nc.netConnection);


    // Handles a successful bandwidth measurement
    private function bandwidthHandler(e:OvpEvent):void {
    trace(“The bandwidth is ” + e.data.bandwidth + “kbps and the latency is ” + e.data.latency + ” ms.”);
    // Use the bandwidth value to decide which file to play.
    if (e.data.bandwidth <= 100) {
    trace(“Selected = 100kbs : named:” + FILENAME);
    FILENAME = “23245/mm/flvmedia/806/W/e/b/WebSafeAccomodation2-201029?cid=806&aid=201029&afid=306729”;
    } else if (e.data.bandwidth <= 300){
    trace(“Selected = 300kbs : named:” + FILENAME);
    FILENAME = “23245/mm/flvmedia/806/W/e/b/WebSafeAccomodation1-201029?cid=806&aid=201029&afid=306728”;
    } else {
    trace(“Selected = 500kbs : named:” + FILENAME);
    FILENAME = “23245/mm/flvmedia/806/W/e/b/WebSafeAccomodation-201029?cid=806&aid=201029&afid=306727″;

    // Handles a successful stream length request
    private function streamlengthHandler(e:OvpEvent):void {
    _videoSlider.maximum = e.data.streamLength;
    _streamLength = e.data.streamLength;
    _bPlayPause.enabled = true;
    _bStopVid.enabled = true;
    _videoSlider.enabled = true;
    _volumeSlider.enabled = true;
    _ns.volume = .8;
    // Updates the UI elements as the video plays
    private function progressHandler(e:OvpEvent):void {
    _timeDisplay.text = _ns.timeAsTimeCode + ” | ” + _nc.streamLengthAsTimeCode(_streamLength);
    if (!_dragging) {
    _videoSlider.value = _ns.time;
    _bufferingDisplay.visible = _ns.isBuffering;
    _bufferingDisplay.text = “Buffering: ” + _ns.bufferPercentage+”%”;

    // Handles netstream status events. We trap the buffer full event
    // in order to start updating our slider again, to prevent the
    // slider bouncing after a drag.
    private function netStreamStatusHandler(e:NetStatusEvent):void {
    switch (e.info.code) {
    case “NetStream.Buffer.Full”:
    _dragging = false;

    // Handles NetConnection status events. The description notifier is displayed
    // for rejection events.
    private function netStatusHandler(e:NetStatusEvent):void {
    switch (e.info.code) {
    case “NetConnection.Connect.Rejected”:
    trace(“Rejected by server. Reason is “+e.info.description);
    case “NetConnection.Connect.Success”:
    // Catches the end of the stream. Note that the OvpEvent.COMPLETE
    // event should only be used to detect the end of streaming files. For progressive delivery,
    // use the OvpEvent.END_OF_STREAM event.
    private function completeHandler(e:OvpEvent):void {
    _bPlayPause.label = “Play”; //changed play to stop
    _bStopVid.label = “Hide”;
    // Handles metadata that is released by the stream
    private function metadataHandler(e:OvpEvent):void {
    trace(“Metadata received:”);
    for (var propName:String in e.data) {
    trace(“metadata: “+propName+” = “+e.data[propName]);
    // Receives all cuepoint events dispatched by the NetStream
    private function cuepointHandler(e:OvpEvent):void {
    trace(“Cuepoint received:”);
    for (var propName:String in e.data) {
    if (propName != “parameters”) {
    trace(propName+” = “+e.data[propName]);
    } else {
    trace(“parameters =”);
    if (e.data.parameters != undefined) {
    for (var paramName:String in e.data.parameters) {
    trace(” “+paramName+”: “+e.data.parameters[paramName]);
    } else {

    // Handles any errors dispatched by the connection class.
    private function onError(e:OvpEvent):void {
    trace(“Error: ” + e.data.errorDescription);

  77. Owen said,

    May 19, 2009 at 2:42 pm


    I have 8 buttons in my scene and here is my action code:

    var pressed:Boolean = false;
    var xBoton:int;
    var yBoton:int;

    this.btEmpresa1.addEventListener(MouseEvent.CLICK, onMouseClick);
    this.btEmpresa1.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    this.btEmpresa1.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);

    this.btEmpresa2.addEventListener(MouseEvent.CLICK, onMouseClick);
    this.btEmpresa2.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    this.btEmpresa2.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);

    this.btEmpresa3.addEventListener(MouseEvent.CLICK, onMouseClick);
    this.btEmpresa3.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    this.btEmpresa3.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);

    this.btEmpresa4.addEventListener(MouseEvent.CLICK, onMouseClick);
    this.btEmpresa4.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    this.btEmpresa4.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);

    this.btEmpresa5.addEventListener(MouseEvent.CLICK, onMouseClick);
    this.btEmpresa5.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    this.btEmpresa5.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);

    this.btEmpresa6.addEventListener(MouseEvent.CLICK, onMouseClick);
    this.btEmpresa6.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    this.btEmpresa6.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);

    this.btEmpresa7.addEventListener(MouseEvent.CLICK, onMouseClick);
    this.btEmpresa7.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    this.btEmpresa7.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);

    this.btEmpresa0.addEventListener(MouseEvent.CLICK, onMouseClick);
    this.btEmpresa0.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    this.btEmpresa0.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);

    function onMouseOver(event:MouseEvent){
    Mouse.cursor = MouseCursor.BUTTON;

    function onMouseOut(event:MouseEvent){
    Mouse.cursor = MouseCursor.ARROW;

    function onMouseClick(event:MouseEvent){
    var nombreBoton:String = event.target.name;
    var frame:String = (nombreBoton.split(“bt”))[1];
    var boton:MovieClip = root[nombreBoton];
    xBoton = boton.x;
    yBoton = boton.y;
    pressed = true;
    moveBackBoton(boton, xBoton, yBoton);
    pressed = false;

    function moveBoton(boton:MovieClip){
    while(boton.x > 51.9){
    boton.x = boton.x – 0.01;
    boton.x = 51.9;
    while(boton.y > 79.2){
    boton.y = boton.y – 0.01;
    boton.y = 79.2;

    function moveBackBoton(boton:MovieClip, xBoton:int, yBoton:int){
    while(boton.x < xBoton){
    boton.x = boton.x + 0.1;
    boton.x = xBoton;
    while(boton.y < yBoton){
    boton.y = boton.y + 0.1;
    boton.y = yBoton;


    function hideDistnctButtons(nombreBoton:String){
    var aOcultar:String = nombreBoton.split(“btEmpresa”)[1];
    for(var i=0; i<8; i++){
    //trace(nombreBoton + ” ” + aOcultar + ” ” + i)
    if(i != parseInt(aOcultar)){
    (this[(“btEmpresa”+i)]).visible = false;


    function showDistnctButtons(nombreBoton:String){
    var aOcultar:String = nombreBoton.split(“btEmpresa”)[1];
    for(var i=0; i<8; i++){
    //trace(nombreBoton + ” ” + aOcultar + ” ” + i)
    if(i != parseInt(aOcultar)){
    (this[(“btEmpresa”+i)]).visible = true


    Some times when I press a button, I get the error: TypeError: Error #1009: Cannot access a property or method of a null object reference

    Could you help me to figure this out please?

  78. Kali said,

    May 21, 2009 at 8:39 pm

    I have been getting this TypeError: Error #1009 for several months now at various Flash sites. It seems to happen randomly and at any site that has a lot of flash content, even simple ones like yahoo (with flash ads). It doesn’t happen on any other computer I go on, so I know it isn’t the sites. I’ve tried updating Flash, updating my browser, everything I can think of to get rid of it but just can’t seem to. I’ve done lots of forum searches, and seems that people normally experience this when working with there own Flash content, which I do not do. Any help is greatly appreciated.

  79. Jerry said,

    May 22, 2009 at 10:09 am

    Thanks for explaining the error instead of just posting a random bit of code that won’t show the error 😉 That seems to be what the rest of the internet resources do.

    Lotsa love,

  80. gondai said,

    May 25, 2009 at 6:21 am

    i got this error too.. 2 days till now, me n my friend try to solve this eror…
    we move the script and the button that have listener to the same layer at the same frame..
    sometimes this is work.. i don’t know why this happen.. but not all this eror can use this method.. thats why i want know what is exactly the problem? script? or place of object?

    my chse.. i compile the main scene.. there is no problem all of script is works, but when i compile the whle fla (include the intro scene) i got this eror(#1009) and make me to decided to sleep… why this happen again?? script? or scene?
    scene intro and scene main is on the same .fla

  81. Fluena - Web Design Serbia - Flash & more said,

    May 25, 2009 at 8:11 am

    So how do I reference, let’s say a button, that doesn’t appear in my first frame? Is there a way besides putting it to first frame and making it invisible?

  82. dim said,

    May 29, 2009 at 10:20 am

    a had this type of error

    i was trying to access to an method on another Class …. and this error pops

    the problem was that i had and non existing variable in the method that i was trying to access

  83. xenfreak said,

    May 29, 2009 at 10:34 pm

    wow, thanks for the advice on this. i was getting so annoyed that i couldn’t figure it out. what i did was i made a tween on an earlier frame and instantiated a movieclip after the tween, but didn’t instantiate the movieclips on the frame before the tween when i had made the alpha to 0. thanks for the assistance!

  84. Ryan said,

    June 7, 2009 at 2:50 pm

    Thank you for writing your blog! I have been struggling with a script for a few days and I kept getting a ton of errors. I finally fixed everything today by trial and error except error #1009 and after I read your solution I fixed it! Thank you!

  85. Eric said,

    June 11, 2009 at 7:45 am

    i, too, get the 1009 error. i’m trying to load googlemaps.swf. the code in main.swf is:

    mapBtn.addEventListener(MouseEvent.CLICK, bringMap);
    function bringMap(event:MouseEvent):void {
    var mapLoader:Loader = new Loader();
    var mapURL:URLRequest = new URLRequest(“googlemaps.swf”);

    googlemaps.swf pulls data from events.xml file. the load function on the is:

    var xmlLoader:URLLoader = new URLLoader();
    var eventsData:XML = new XML();

    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
    xmlLoader.load(new URLRequest(“events.xml”));

    function LoadXML(e:Event):void {
    //some more code here

    the exact error on main.swf is:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at googlemaps_fla::MainTimeline/LoadXML()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

    any help is appreciated.

  86. Eric said,

    June 11, 2009 at 8:33 am


    i narrowed down my problem, and it doesn’t look its fit for this forum. it appears there’s a problems w/ Google Map’s setSize.

    i eliminated all the code in the loadXML function to the bare minimum and if i put:

    var map:Map = new Map();
    map.key = “your_api_key”;
    map.setSize(new Point(stage.stageWidth, stage.stageHeight));

    it WILL give me a map in googlemap.swf but WITH the 1009 error in main.swf

    if i put:

    var map:Map = new Map();
    map.key = “your_api_key”;
    map.width = 550;
    map.height = 550;

    it WONT give me a map but it will load OK in main.swf

    if anyone has ran into similar issue or knows a work around, i’d still appreciate some help

    Thank you.

  87. Eric said,

    June 11, 2009 at 9:11 am


    i decided to put the map in a movie clip and the solved it
    Thnx all.

  88. Mathias said,

    June 12, 2009 at 3:44 pm

    yeah, thnx a lot, saved me quite some irritations and annoyance:)

  89. Fernando said,

    June 19, 2009 at 11:24 am

    Thanks a very simple, but powerful tip, thanks so much.

  90. Maureen said,

    June 26, 2009 at 3:11 pm

    I’m also “new” to Flash and am making animations for our landing pages. I have not had this error before. I have made several of these. But this time one of the graphics to be clicked on is of a “coupon” that is buried in our site. Click on the graphic (set to alpha 0 as it fades in) and it takes you to the place where it is kept on the site. I “tested” the movie and at first the page comes up…followed by the error message in the OUTPUT tab. Here is the code. Please help! Thank you, Maureen.

    function gotoMASpecialsSite(event:MouseEvent):void
    var maCouponURL:URLRequest = new URLRequest(“http://www.icomamerica.com/en/promotions/marine/SummerSavings/Default.aspx”);
    marineSavings_lp.addEventListener(MouseEvent.CLICK, gotoMASpecialsSite)

  91. Mike W said,

    June 29, 2009 at 1:49 am

    Hi Curtis – thanks for the great advice on your weblog. I’m relatively new to CS4 / AS3 although I’ve been dabbling with Flash for a few years. Just a simple question wrt the original 1009 errors. Frame 1… When the AS3 is compiled at runtime along with the layers of the timeline, is there a specific order that the compilation takes place. My timeline only has one frame but 10 layers. I lay items out on the stage and give them instance names on the lower layers (bottom) and my AS3 is on the top layer. I still get 1009 errors. Does this have anything to do with the order of compilation of the layers? Thanks.

  92. andrew said,

    June 29, 2009 at 9:11 pm

    Thanks so much, this was really frustrating me but you helped a lot

  93. Agustin G said,

    July 2, 2009 at 9:43 pm

    Hi all,

    I’ve had my share on Flash with Actionscript 2.0, however getting used to Actionscript 3.0 seems to be very difficult for some reason. I keep trying to add an action to a button which is impossible.

    I’m currently working on my web-portfolio but I’m really stuck with this same error… 1009 really has me hanging by the ears…

    my code is:


    two.stage.addEventListener(MouseEvent.CLICK, clicked);
    function clicked(event:MouseEvent):void
    // This part is in case I decide to call it on another page
    //var targetURL:URLRequest = new URLRequest(“http://www.engsoc.net/~agutier2/Resume.html”);

    if you visit my website (www.engsoc.net/~agutier2) you can see that “two” is the ‘resume’ button… I don’t have a problem with that, it goes to the resume frame, but once I click on the button to go back (nameless button) I get the error…

    could anyone please please help?? I’d really appreciate it a lot…

  94. Agustin G said,

    July 2, 2009 at 9:47 pm

    Oh sorry, I forgot to add the code for the other frame, its the following:

    function mainFrame(event:MouseEvent):void

    homeBtn.stage.addEventListener(MouseEvent.CLICK, mainFrame);

    pdf.addEventListener(MouseEvent.CLICK, onMouseClick);
    function onMouseClick(event:MouseEvent):void
    var targetURL:URLRequest = new URLRequest(“http://www.engsoc.net/~agutier2/images/Resume/AGutierrez.pdf”);

    w2003.addEventListener(MouseEvent.CLICK, Clicking);
    function Clicking(event:MouseEvent):void
    var targetURL:URLRequest = new URLRequest(“http://www.engsoc.net/~agutier2/images/Resume/AGutierrez.doc”);
    w2007.addEventListener(MouseEvent.CLICK, Clicker);
    function Clicker(event:MouseEvent):void
    var targetURL:URLRequest = new URLRequest(“http://www.engsoc.net/~agutier2/images/Resume/AGutierrez.docx”);

    thanks once again… really really thanks a lot…

  95. Jessica said,

    July 26, 2009 at 3:39 pm

    Hi all,

    I am new to ActionScript and Flash, and I am getting this error: TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at jessicaclucas_fla::MainTimeline/stopResumescroll()

    I have several different clips in one movie that have scrolling content. When I click a button to move to a different clip that doesn’t have a certain scroll, it gives me this error. I cannot figure out how to fix this. You can see the site I am working on: http://www.jessicaclucas.com. I would really appreciate some help! Thank you in advance. Here is the code:

    //Import TweenMax and the plugin for the blur filter
    import gs.TweenMax;
    import gs.plugins.BlurFilterPlugin;

    //Save the content’s and mask’s height.
    //Assign your own content height here!!
    var RESUMECONTENT_HEIGHT:Number = 1500;
    var RESUME_HEIGHT:Number = 450;

    //We want to know what was the previous y coordinate of the content (for the animation)
    var oldResumeY:Number = myResumecontent.y;

    //Position the content on the top left corner of the mask
    myResumecontent.x = myResume.x;
    myResumecontent.y = myResume.y;

    //Set the mask to our content
    myResumecontent.mask = myResume;

    //Create a rectangle that will act as the Resumebounds to the scrollMC.
    //This way the scrollMC can only be dragged along the line.
    var Resumebounds:Rectangle = new Rectangle(resumescrollMC.x,resumescrollMC.y,0,450);

    //We want to know when the user is Resumescrolling
    var Resumescrolling:Boolean = false;

    //Listen when the user is holding the mouse down on the scrollMC
    resumescrollMC.addEventListener(MouseEvent.MOUSE_DOWN, startResumescroll);

    //Listen when the user releases the mouse button
    stage.addEventListener(MouseEvent.MOUSE_UP, stopResumescroll);

    //This function is called when the user is dragging the scrollMC
    function startResumescroll(e:Event):void {

    //Set Resumescrolling to true
    Resumescrolling = true;

    //Start dragging the scrollMC

    //This function is called when the user stops dragging the scrollMC
    function stopResumescroll(e:Event):void {

    //Set Resumescrolling to false
    Resumescrolling = false;

    //Stop the drag

    //Add ENTER_FRAME to animate the scroll
    addEventListener(Event.ENTER_FRAME, enterResumeHandler);

    //This function is called in each frame
    function enterResumeHandler(e:Event):void {

    //Check if we are Resumescrolling
    if (Resumescrolling == true) {

    //Calculate the distance how far the scrollMC is from the top
    var distance:Number = Math.round(resumescrollMC.y – Resumebounds.y);

    //Calculate the percentage of the distance from the line height.
    //So when the scrollMC is on top, percentage is 0 and when its
    //at the bottom the percentage is 1.
    var percentage:Number = distance / RESUME_HEIGHT;

    //Save the old y coordinate
    oldResumeY = myResumecontent.y;

    //Calculate a new y target coordinate for the content.
    //We subtract the mask’s height from the contentHeight.
    //Otherwise the content would move too far up when we scroll down.
    //Remove the subraction to see for yourself!
    var targetY:Number = -((RESUMECONTENT_HEIGHT – RESUME_HEIGHT) * percentage) + myResume.y;

    //We only want to animate the scroll if the old y is different from the new y.
    //In our movie we animate the scroll if the difference is bigger than 5 pixels.
    if (Math.abs(oldResumeY – targetY) > 5) {

    //Tween the content to the new location.
    //Call the function ResumetweenFinished() when the tween is complete.
    TweenMax.to(myResumecontent, 0.3, {y: targetY, blurFilter:{blurX:22, blurY:22}, onComplete: ResumetweenFinished});

    //This function is called when the tween is finished
    function ResumetweenFinished():void {

    //Tween the content back to “normal” (= remove blur)
    TweenMax.to(myResumecontent, 0.3, {blurFilter:{blurX:0, blurY:0}});

  96. Matt said,

    August 3, 2009 at 12:56 pm

    I’m getting so frustrated, I’m building a photo gallery and keep getting this error. Please forgive me because I’m pretty new to AS3.

    I have 11 thumbnails at the bottom of my stage, 4 of which appear on stage at a time. Every time an instance of the RightArrow button is pressed, the functionality is intended to play a certain scene (labeled). These scenes scroll the image bar so 2 additional thumbnails are available for viewing.

    I have the exact same code (except for instance names on frame1 and frame20, and it’s working as it should.


    import flash.events.MouseEvent;

    R_Arrow1.addEventListener(MouseEvent.CLICK, RArrow1);

    function RArrow1(event:MouseEvent):void{

    Frame 20:

    R_Arrow2.addEventListener(MouseEvent.CLICK, RArrow2);

    function RArrow2(event:MouseEvent):void{

    Now, when I get to frame 40, I gave the RightArrow an instance name of R_Arrow3 and this is the code:


    R_Arrow3.addEventListener(MouseEvent.CLICK, RArrow3);

    function RArrow3(event:MouseEvent):void{

    No syntax errors, but when I play the movie and try clicking the RightArrow the third time I get a compiler error of:

    “TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at wedding_gallery_fla::MainTimeline/frame40()”

    Any ideas? Thanks so much!

  97. Matt said,

    August 3, 2009 at 2:05 pm

    nevermind, got it

  98. Adam said,

    August 4, 2009 at 4:45 pm

    Thank you for this incredibly clear description of an otherwise cryptically worded Flash error.

  99. Ana Bee said,

    August 8, 2009 at 1:58 pm

    I am using Flash CS4/AS3. I simply copy the code from http://www.learningactionscript3.com/download/ (Chapter 7–>Particle System) Particle to a new AS file and I get the Error #1009 at Particle/onRun().

    I didn’t change anything in the code just created a new file, copied the contents from Particle.as, delete original file, named new file Particle.as, replaced the old file.

    What could the problem be, Curtis?

  100. Ana Bee said,

    August 8, 2009 at 2:00 pm


  101. Judith said,

    August 10, 2009 at 4:34 pm

    Thanks for the GREAT straight forward advice on that error after I read Fix 1 I knew exactly what the problem was!


  102. Mayuresh said,

    August 11, 2009 at 6:05 am

    hi iam newb to flash.
    i am been harrased by this error 1009
    iam trying to make a movieclip visible only after a button click am doing this via external .asfile
    intially on ythe stage my mc is not visible
    plz help me

  103. psoriasis treatment said,

    August 14, 2009 at 3:43 am

    thanks for this description..helped me a lot

  104. Ana said,

    August 18, 2009 at 12:59 am


    I just came across 1009 and got puzzled at first, had no clue what was wrong. I had an .FLA with some code using a TextArea component. Yes, I did have a TextArea component in my library and yes, I was importing fl.controls.*.

    When I tried loading this SWF in another SWF, I got this error:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at fl.controls::TextArea/drawLayout()
    at fl.controls::TextArea/draw()
    at fl.core::UIComponent/callLaterDispatcher()

    It’s probably obvious why I got this error, but it took me 30 minutes to figure it out: I also needed to have the TextArea component in the library of the main SWF.

  105. Patrick said,

    August 25, 2009 at 8:25 pm

    OK if anyone makes it down this far and hasen’t solved their problem, try this.

    If your refering to a button in your movie



    make sure that every button on the stage is labeled…

    if you have a tween make sure that both buttons are labeled

    check to make sure you don’t have a duplicate button that is not labeled

    laying underneath the button you have labeled.

    Hope this helps,

    I lost 2 nights of sleep over this. I still miss AS2

  106. Gary said,

    September 3, 2009 at 7:42 pm

    Thanks for explaining this error in simple-to-understand terms.

    I had a straightforward animation for a website splash page that would finish with a stopped frame and two buttons would appear to allow the visitor to choose the language they would prefer.

    Running a test yielded the 1009 error. There is a stop(); action to freeze the animation and two button instances that would each call a URLRequest function. In accordance with your instructions, I simply inserted one extra frame just before the frame where the function calls adds an event listener and refers to my button instances. As long as the instances have been added to the stage before the script, no error should appear. And it worked!

    This ActionScript 3.0 stuff ain’t easy.

  107. pietie said,

    September 13, 2009 at 11:55 am

    I got the error with just creating a simple button which takes you to another frame… after I got fed up looking for answers I made an alpha 0% block over the area and gave it the same code… worked.

    I am still too used to AS2

  108. Vero said,

    September 14, 2009 at 9:06 pm

    Thank you so much!!! 🙂

  109. Lisa said,

    October 2, 2009 at 11:56 am

    Hi Curtis,
    Thank you for speaking English in your explanation instead of programmer language. Your explanation was the first one I finally understood and I was able to fix the error! So, for us beginners, keep speaking in plain and simple terms. I will try your site for other issues I may come across (once I learn more).

  110. Miguel said,

    October 11, 2009 at 2:49 pm

    ei i got this problem to
    now i know what caused the problem

    i forget to give my buttons the instanse name
    and i put a instanse name and the problem is gone

    tenia el mismo problema pero vi que es lo que causaba el problema
    se me habia olvidado poner el instanse name de mis botones
    asi que les puse y el probleme se resolvio, espero que puedan hacer lo mismo

  111. Jason said,

    October 13, 2009 at 2:11 pm

    Hey all,

    I have a few classes I need to be linked together. I have a Ball class which just makes an instance of a ball. Then I have a Throwing class which calls the Ball class and has a bunch of math that makes it able to be thrown around. Then I have a parrallax scrolling class which I need to import/instantiate the Throwing class but when I attempt I get this wretched error. I am doing this for a class and we’ve had it for two weeks but I just can’t figure it out. Thanks in advance for any help!!

  112. Fred said,

    October 21, 2009 at 9:14 am

    I am trying to fix a problem that I am having with Flash.

    I get the following error:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at nov_09_fla::MainTimeline/frame1()
    at flash.display::MovieClip/gotoAndStop()
    at nov_09_fla::MainTimeline/clickSection()

    I do not have a MovieClip in my Flash??? Here is my code on frame 1:


    //handle events for buttons…
    calendar.addEventListener(MouseEvent.CLICK, clickSection);
    home.addEventListener(MouseEvent.CLICK, clickSection);
    pickerel.addEventListener(MouseEvent.CLICK, clickSection);
    contact.addEventListener(MouseEvent.CLICK, clickSection);

    function clickSection(evtObj:MouseEvent){
    //trace shows what’s happening.. in the output window
    trace (“The “+evtObj.target.name+” button was clicked!”)
    //go to the section clicked on…

  113. Kunal said,

    October 29, 2009 at 3:17 pm

    This is my script and the error is below. can anyone help me please

    import caurina.transitions.*;
    import flash.display.*;
    import flash.events.*;
    import caurina.transitions.properties.*;

    public dynamic class _bgImgMc extends flash.display.MovieClip

    public function _bgImgMc()
    addFrameScript(0, frame1);

    public function _rtoBgFnc(arg1:flash.events.Event):*
    sw = stage.stageWidth;
    sh = stage.stageHeight;
    _ldngMc.x = sw – 30;
    if (_ldBol && _actvTyp == “static”)
    _cntnr.x = (sw – _cntnr.width) / 2;
    _cntnr.y = (sh – _cntnr.height) / 2;

    public function _imgFnc(arg1:String, arg2:String, arg3:String, arg4:String):*
    if (arg1 == “null”)
    _actv = false;
    _actvTyp = arg4;
    _ldngMc.alpha = 1;
    _cntnr.x = 0;
    _cntnr.y = 0;
    if (_actvTyp == “static”)
    mc = new Images(arg1, false);
    _cntnr.alpha = 0;
    if (_actvTyp == “dynamic”)
    mc1 = new Images(arg1, false);
    mc2 = new Images(arg2, false);
    mc3 = new Images(arg3, false);
    _cntnr.alpha = 0;
    _actv = true;
    _ldBol = false;
    addEventListener(flash.events.Event.ENTER_FRAME, _ldrFnc);

    public function _go(arg1:String, arg2:String, arg3:String, arg4:String):*
    var _pth:String;
    var _pth2:String;
    var _pth3:String;
    var _typ:String;

    var loc1:*;
    _pth = arg1;
    _pth2 = arg2;
    _pth3 = arg3;
    _typ = arg4;
    if (_actv)
    caurina.transitions.Tweener.addTween(_cntnr, {“alpha”:0, “time”:0.5, “onComplete”:function ():*
    if (_actvTyp != “static”)
    delete _cntnr.getChildAt(0);
    delete _cntnr.getChildAt(1);
    delete _cntnr.getChildAt(2);
    removeEventListener(flash.events.Event.ENTER_FRAME, procs);
    delete _cntnr.getChildAt(0);
    _imgFnc(_pth, _pth2, _pth3, _typ);
    if (!_ldBol)
    removeEventListener(flash.events.Event.ENTER_FRAME, _ldrFnc);
    _imgFnc(_pth, _pth2, _pth3, _typ);

    function frame1():*
    _actv = false;
    _cntnr = new flash.display.Sprite();
    stage.addEventListener(flash.events.Event.RESIZE, _rtoBgFnc);

    public function _ldrFnc(arg1:flash.events.Event):*
    if (_actvTyp != “static”)
    if (mc1._ldBol && mc2._ldBol && mc3._ldBol)
    _ldBol = true;
    removeEventListener(flash.events.Event.ENTER_FRAME, _ldrFnc);
    addEventListener(flash.events.Event.ENTER_FRAME, procs);
    caurina.transitions.Tweener.addTween(_cntnr, {“alpha”:1, “time”:0.5});
    _ldngMc.alpha = 0;
    if (mc._ldBol)
    _ldBol = true;
    removeEventListener(flash.events.Event.ENTER_FRAME, _ldrFnc);
    caurina.transitions.Tweener.addTween(_cntnr, {“alpha”:1, “time”:0.5});
    _ldngMc.alpha = 0;

    public function procs(arg1:flash.events.Event):*
    sw = stage.stageWidth;
    sh = stage.stageHeight;
    _initXScr = (-mouseX) / 1.5;
    _xScr = mc1.x;
    _dvScr = _initXScr – _xScr;
    _mvrScr = _dvScr / 10;
    mc1.x = _xScr + _mvrScr;
    _initXScr2 = (-mouseX) / 1.5;
    _xScr = mc2.x;
    _dvScr = _initXScr2 – _xScr;
    _mvrScr = _dvScr / 15;
    mc2.x = _xScr + _mvrScr;
    _initXScr3 = (-mouseX) / 1.5;
    _xScr = mc3.x;
    _dvScr = _initXScr3 – _xScr;
    _mvrScr = _dvScr / 18;
    mc3.x = _xScr + _mvrScr;

    public var _actv:Boolean;

    public var _initXScr:Number;

    public var _dvScr:Number;

    public var _initXScr2:Number;

    public var mc1:Images;

    public var mc3:Images;

    public var mc2:Images;

    public var _xScr:Number;

    public var sw:Number;

    public var sh:Number;

    public var _ldBol:Boolean;

    public var _actvTyp:String;

    public var _mvrScr:Number;

    public var mc:Images;

    public var _initXScr3:Number;

    public var _ldngMc:_ldrMc;

    public var _cntnr:flash.display.Sprite;

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at _bgImgMc/_ldrFnc()

  114. Fernando said,

    November 23, 2009 at 3:31 pm

    Very useful!

  115. adam said,

    November 30, 2009 at 6:46 am

    Thanks so much. I spent ages reading forums and other sites trying to figure out this problem before I stumbled on this site. After that, I solved the problem in less than five minutes!

  116. Amul Patel said,

    November 30, 2009 at 5:11 pm

    your site is extremely helpful – thanks!

  117. Hannah said,

    December 2, 2009 at 11:53 am

    I was wondering if you would be able to help me.
    I Have the error coming up but I am using frame labels and there is content
    where the labels are. It is not inside of a movie. So I don’t know what to do :/

    Any help would be appreciated! Thank you!

  118. Hannah said,

    December 2, 2009 at 12:19 pm

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at PORTFOLIOfinal_fla::MainTimeline/frame111()

  119. David L said,

    December 9, 2009 at 12:03 am

    I am trying to simply link a URL using a button… here is the very simple code…

    blogbtn.addEventListener(MouseEvent.CLICK, onMouseClick);

    function onMouseClick(e:MouseEvent):void

    var request:URLRequest = new URLRequest(“http://www.apple.com”);


    my button is named blogbtn however.. when I move to the frame where the button is located I get this output error before I even click the button. The button doesn’t work.

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at working1_fla::MainTimeline/frame52()
    at flash.display::MovieClip/gotoAndStop()
    at working1_fla::MainTimeline/eventResponseweb4()

    Why would it say that something not even related to the btn would be messing up?

    when I start a brand new flash file, the exact same code works perfectly so why is this code causing me so much pain? thanks.

  120. Adriana said,

    December 14, 2009 at 6:56 am

    Thank you so much !!! You can not even imagine what a BIG help was this post for me! Thank you once again and take care 🙂

  121. nate said,

    December 14, 2009 at 10:59 am

    I, like Josh above, was about to endure some head trauma due to this issue, but you solved it for me! I had a replay button fading in. On the same frame # when the button is at 100% alpha it gets “instantiated” (what an amazing word, though I would’ve assumed the term is “instanced”) I also had the code telling the movie to gotoAndPlay frame 1. Nothing was working until I simply gave the beginning of the alpha fade the same instance name as when it gets to 100%.


  122. edmund said,

    December 23, 2009 at 5:17 am

    thank you very much. i’ve solved my problem

  123. Rico said,

    January 1, 2010 at 5:47 pm

    Thanks so much for providing this info. I’m a self taught flash page designer and am having a real problem understanding certain aspects of AS3.0.

    AS3.0 forums (I’ve been to 4) have been pretty useless in providing me with answers thus far … cuz the answer appears to be SO simple that no one has the time to provide a helpful hint ….

    I never would have thought that I would have found the solution on a blog ….

    I’m bookmarking this site and coming back to read some more!

    Thank you thank you thank you!

  124. Vik said,

    January 6, 2010 at 1:34 pm

    TypeError: Error #1009: Cannot access a property or method of a null object reference.

    Guys! What I am doing is trying to use this application located here –

    Basically, the app is to select multiple files from your HD and upload it to any other computer/server. As I click add it lets me browse my HD but then when I select the file gives me that error.

    If I am using this application directly then it works. As I am trying to use this app in my application where I resize it and drop it in a corner then its giving me the above mentioned error. I have not reached to a stage where I can change the code as yet.

    The code for this app is located here- http://weblog.cahlan.com/files/file_uploads/srcview/index.html

    Any help is appreciated. Thanks in advance.

  125. Praveen said,

    January 10, 2010 at 12:15 pm

    Hello, Mr. Morley.. I started learning Flex by myself yesterday and tried writing this code.. After correcting numerous compiler errors, I encountered error #1009 for the following code. I would be extremely thankful if you could help me with it.. Thank you..

  126. Praveen said,

    January 10, 2010 at 12:15 pm

  127. miki said,

    January 10, 2010 at 6:35 pm

    Im getting this Error:PLEASE HELP!
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    Im traing load my slide show using classes and place them on my site on gallery page( site for pages) when I load the slide show document on a single fla file it works but how to make it work in some other mc or some other frames?

  128. Tim J said,

    January 11, 2010 at 1:23 am

    Thanks for the explanation of the mysterious Error #1009. I’m using AS3. I have a container SWF (using a document class) that loads an external SWF. It was working well and then started failing with the 1009 error. I load an XML file. When that load is complete, I use data from the XML file to load the proper SWF. Seems so simple. I’ve stripped down the container SWF’s doc class to simply the code that follows. Should also note that the external SWF runs error free on its own. If I take out the very last line that actually LOADS THE SWF … no error. It seems like the objects are added in the proper order. Maybe something with latency in loading?? Thanks for any help/insight that you can provide.

    package src.container

    //import fl.controls.ProgressBar;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.xml.*;
    import flash.net.*;
    import flash.utils.*;

    public class Container extends MovieClip

    public function Container():void

    // Loading objects for module data
    var moduleMC;
    var externalModule:MovieClip;
    var courseDataXML:XML;
    var swfLoader:Loader;
    var swfLoaderRequest:URLRequest;
    var moduleList:XMLList;

    // Load XML containing course listing
    var xmlURL:String = “data/course.xml”;
    var requestFile:URLRequest = new URLRequest(xmlURL);
    var loader:URLLoader = new URLLoader(requestFile);
    loader.addEventListener(Event.COMPLETE, xmlLoaded);

    // Function to take action after course listing XML loading is complete
    function xmlLoaded(e:Event):void
    //Create load module data
    courseDataXML = new XML(e.target.data);
    moduleList = courseDataXML.module;

    // Load default module using first item’s src value
    swfLoaderRequest = new URLRequest(courseDataXML.module[0].@src);
    swfLoader = new Loader();
    addChildAt(swfLoader, 0);


  129. Tim J said,

    January 11, 2010 at 1:49 am

    Got it. Found it here: http://www.flepstudio.org/forum/actionscript-3-0-newbies/1906-load-external-swf-error-1009-a.html

    I needed to fire an ADDED_TO_STAGE event from the external SWF. Not sure I fully understand the solution, but it is working great now.

    Used AS2 for a few years and got good at it. Did other stuff for a couple of years and came back to AS3. If Adobe is hoping to thin the Flash herd a bit, AS3 will do it. MS threw Silverlight out there to compete and be “easy”, but its just another MS bumble.

    Thanks for again for maintaining the site. It is very useful and is now in my favorites. Maybe I’ll be able to pitch-in to the support end soon.

  130. Frederik said,

    January 24, 2010 at 7:47 am

    I’m new to flash and trying simply to create a link from a button on the site to another page on the site. I’ve given the button the same name and even instance name as the label on the frame I’m trying to link to. I’m getting this error when I test my movie:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at index_fla::MainTimeline/frame85()
    at flash.display::MovieClip/gotoAndStop()
    at index_fla::MainTimeline/clickSection()

    This is my code:


    recordingsdontlook_mc.addEventListener(MouseEvent.CLICK, dontlookClick);

    function dontlookClick(evtObj:MouseEvent) {

    Can’t figure out why this is not working….
    Could someone please help?

  131. Eric said,

    February 23, 2010 at 9:50 am

    For the stage problem in ended up put stage into from the timeline into the class in order to get it work.

    public class (bla bla bla…) {
    private var $s;
    public function “class name”(s):void {
    // s is stage u put in from timeline then you use $s instead of stage inside the class
    $s = s;

    not the best solution.. but it works without getting errors

  132. Jonathan Frewin said,

    February 26, 2010 at 3:46 pm

    You saved my life with this explanation for this Null Object Reference. All day I’ve spent trying to figure it out, Googling all sorts of complex code stuff. All I needed was this simple explanation.

    Many, many thanks.

    Best Wishes

    Jonathan Frewin

  133. Aaron said,

    March 30, 2010 at 7:22 pm

    Thank you! Thank you! Thank you for your post of 2 and a half years ago! I have been banking my head on the wall for more than 2 hours trying to get a button to work. I can’t believe it was such a simple a solution . . . introducing the code after the button appears on the timeline. Duh!

  134. Carla Castro said,

    April 5, 2010 at 2:08 am

    You are just what we need! Thank you so much! How can you easlily explain things is just “WOW…it makes sense!”. Thank you so much!

    You havehelped me and my uni project and to enjoy AS3.0 Flash CS4…so much fun!

    Long Live Morley!!

  135. Carla Castro said,

    April 5, 2010 at 2:10 am

    …LOL sorry for the gramatical and syntax mistakes…it’s the excitement!

    Carla Castro

  136. Christine said,

    April 6, 2010 at 8:18 pm

    thank you! i send you many good vibes and well wishes! 🙂

  137. moya said,

    April 6, 2010 at 11:37 pm

    hi every body

    i am new in flex and action script.

    i have one form that i add it formItems and it was worked very well after added textInput and when i want to access to textInput text it gives me thid error.

    i am just freaking out , i don’t know couse of this error ,i have another formItem with comboBox element and i can access to value of selectedItem in that very easily.please if you have any ideas about this error please help me


    my code

    in this state i am adding one comboBox and two textInput to the form

    and in this part of cod i handle event of button click where error occur

    case “rep_shek_tedad”:
    if(state.selectedItem != null){
    stateSelectedItem = state.selectedItem;
    }else {
    currentState = ‘enterCharts’;

  138. Kenjio said,

    April 7, 2010 at 6:15 am

    Hello everyone, i apologizes if my english isn’t correct but i have only learn for 1 year.

    I’ve got this error 1009 and i’m stuck in it from 3 day now and i wonder if anyone could help me.

    Sorry but the comments and variables are in french
    //—————————————————————- INITIALISATIONS —//
    var portfolioXML:XML;
    var chargeDonnees:URLLoader = new URLLoader();
    var adresseFichier:URLRequest=new URLRequest(“portfolio.xml”);
    //— Variable qui va permettre de scroller d’un projet à l’autre —
    var index:Number=0;
    var categorie:String=”graphisme”;
    this.infoChargement.visible = true;
    this.infoChargement.text = “Section cours de chargement…”;
    //— Importation de la class Tween —
    import fl.transitions.*;
    import fl.transitions.easing.*;
    //——————————————————————– FONCTIONS —//
    //— Fonction qui affecte les données chargées à une variable —
    function chargementFini(event:Event) {
    infoChargement.visible = false;
    portfolioXML=new XML(chargeDonnees.data);
    //— Fonction qui charge les projets d’une section —
    function chargeProjet(categorieP:String) {
    //— On détermine le nombre de projets
    var nbProjets:Number=portfolioXML[categorieP].children().length();
    for (var i=0; i < nbProjets; i++) {
    //— On place le bouton —
    var boutonP:bProjet=new bProjet ;
    boutonP.texteBouton.text = i+1;
    //— On définit l’action du bouton —
    boutonP.addEventListener(MouseEvent.CLICK, afficheProjet);
    //— On charge les infos du projet —
    var projetC:clipProjet=new clipProjet ;
    //— Nom du projet —
    projetC.nomProjet.text = portfolioXML[categorieP].projet[i].@nom;
    //— Type de projet —
    projetC.typeProjet.text = portfolioXML[categorieP].projet[i].@typeProjet;
    //— Descriptif du projet —
    projetC.descriptionProjet.text = portfolioXML[categorieP].projet[i];
    //— L’image du projet —
    chargeImage(portfolioXML[categorieP].projet[i].@image, projetC.imageProjet);
    //— On incrémente l’index : pour les futurs positions des autres projets —
    //— Fonction qui charge les images —
    function chargeImage(url:String, cible:Object) {
    var loaderImage:Loader = new Loader();
    var urlImage:URLRequest = new URLRequest(url);
    //— Fonction qui scroll d’un projet à l’autre —
    function afficheProjet(event:MouseEvent) {
    var deplaceSections:Tween = new Tween(sections, “y”, Strong.easeOut, sections.y, -event.currentTarget.indexProjet, 1, true);
    //——————————————————————– ECOUTEURS —//


  139. Kenjio said,

    April 7, 2010 at 7:22 am

    It’s ok i’ve found it! I had put a clip and delete him after (my attend was to only delete the background of the clip…) Thx god can keep move on 😀

  140. Thibault said,

    May 14, 2010 at 7:48 am

    Hi !
    I’m having this error 1009 on different elements, and have no idea why, to be honest… My flash project is a little dance game, using keyboard arrows… It compiles properly and all… but when I start playing/testing i get this error everytime i press the Up arrow…
    Just to mention: i created this game following a tutorial, but i decided to add a video after (but I’m no ActionScript genius… I’m still struggling everytime I deal with bits of code)

    Here’s what it says:

    “TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at UrbanDancer_fla::MainTimeline/pressKey()”

  141. Thibault said,

    May 14, 2010 at 7:57 am

    i actually just found the answer by reviewing the code and comparing with other arrows…

    Moral of the story, always readm take your time, and if you have other things that seem to workk : COMPARE !

  142. Kim said,

    May 19, 2010 at 5:56 am

    I STill get the error plss help me….

    Red_btn.addEventListener(MouseEvent.CLICK, Link);
    function Link(event:MouseEvent):void {

    try {
    } catch (e:Error) {
    trace(“Error occurred!”);
    Green_btn.addEventListener(MouseEvent.CLICK, Link2);
    function Link2(event:MouseEvent):void {

    try {
    } catch (e:Error) {
    trace(“Error occurred!”);
    Black_btn.addEventListener(MouseEvent.CLICK, Link3);
    function Link3(event:MouseEvent):void {

    try {
    } catch (e:Error) {
    trace(“Error occurred!”);

    product_btn.addEventListener(MouseEvent.CLICK, callLink);
    function callLink(event:MouseEvent):void {
    var url:String = “products.htm”;
    var request:URLRequest = new URLRequest(url);
    try {
    navigateToURL(request, ‘_self’);
    } catch (e:Error) {
    trace(“Error occurred!”);
    gallery_btn.addEventListener(MouseEvent.CLICK, callLink2);
    function callLink2(event:MouseEvent):void {
    var url:String = “gallery.htm”;
    var request:URLRequest = new URLRequest(url);
    try {
    navigateToURL(request, ‘_self’);
    } catch (e:Error) {
    trace(“Error occurred!”);
    service_btn.addEventListener(MouseEvent.CLICK, callLink3);
    function callLink3(event:MouseEvent):void {
    var url:String = “service.htm”;
    var request:URLRequest = new URLRequest(url);
    try {
    navigateToURL(request, ‘_self’);
    } catch (e:Error) {
    trace(“Error occurred!”);
    staff_btn.addEventListener(MouseEvent.CLICK, callLink4);
    function callLink4(event:MouseEvent):void {
    var url:String = “staff.htm”;
    var request:URLRequest = new URLRequest(url);
    try {
    navigateToURL(request, ‘_self’);
    } catch (e:Error) {
    trace(“Error occurred!”);
    consult_btn.addEventListener(MouseEvent.CLICK, callLink5);
    function callLink5(event:MouseEvent):void {
    var url:String = “consult.htm”;
    var request:URLRequest = new URLRequest(url);
    try {
    navigateToURL(request, ‘_self’);
    } catch (e:Error) {
    trace(“Error occurred!”);

  143. Jordon said,

    June 4, 2010 at 7:32 am


    I keep getting this problem with my code in scene 3 (of 3 for now, planning on adding a LOT more) of my game i’m doing for a class.

    Here’s the problem code:

    this.stage.addEventListener(MouseEvent.MOUSE_DOWN, shotFired);
    this.stage.addEventListener(Event.ENTER_FRAME, moveSniperScope);

    function moveSniperScope(e:Event):void {
    sniperScope_mouse.x -= (sniperScope_mouse.x – mouseX) / 3;
    sniperScope_mouse.y -= (sniperScope_mouse.y – mouseY) / 3;

    function shotFired(e:MouseEvent):void {
    if (sniperScope_mouse.sniperReticle_hit.hitTestObject(targetHead)){
    targetHead.alpha = .5 /*Determine Kill Shot*/
    sniperScope_mouse.y = sniperScope_mouse.y – 60 /*Gun Recoil*/
    sniperScope_mouse.x = sniperScope_mouse.x + 40

    I’ve triple checked the names of my objects, etc. and they are all correct. When I debug, it finds something wrong with line 7 [ sniperScope_mouse.x -= (sniperScope_mouse.x – mouseX) / 3; ]

    any idea what it might be?

    Thanks for your time =)

  144. ryon said,

    June 21, 2010 at 2:35 am

    i have a problem with error 1009.

    but my flash every thing is goin while.

    i put a script flvplayback.visible= false at frame 1.

    but my flvplayback is at the last frame.

    how to correct it?

    my flvplayer is connect wif xml. and it’s behind my contact or homepage if i didnt put visible=false.

  145. Mokhtar said,

    June 23, 2010 at 5:04 am

    Hi everyone!

    I’ve a problem and thanks in advance for your help.

    I’ve a swf acts as a loader for another swf. Let’s name them loaderSwf.swf and targetSwf.swf respectively. the targetSwf works just fine when it’s playing as stand-alone, but when I play the loaderSwf for loading the targetSwf I get the famous TypeError 1009 at MainClass(). The MainClass() is the main document class of the targetSwf. The following is the script of the loaderSwf.

    import flash.net.URLRequest;
    import flash.display.Loader;
    import flash.events.Event;
    import flash.events.ProgressEvent;
    import flash.display.Sprite;

    public final class TestLoader extends Sprite
    public function TestLoader()

    private function startLoad()
    var mLoader:Loader = new Loader();
    var mRequest:URLRequest = new URLRequest(“targetSwf.swf”);
    mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
    mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);

    private function onCompleteHandler(loadEvent:Event)

    private function onProgressHandler(mProgress:ProgressEvent)
    var percent:Number = mProgress.bytesLoaded / mProgress.bytesTotal;
    //percentT.text = percent + ‘%’;

    Actually it’s stranger, at least logically, because the loader’s job is just loading the whole targetSwf at once not to play it sequentially! so after loading has been accomplished the targetSwf would take its place and then bear the responsibility for making each object known.

    Or perhaps I’m not logical enough in this case.

    Thanks again.

  146. Mokhtar said,

    June 23, 2010 at 5:32 am

    Sorry for my English. I am new to English language.

    I hope my post is clear.

    Thank you.

  147. Mokhtar said,

    June 24, 2010 at 7:13 am


    I fixed the problem this morning…

    It was the following line in the MainClass() (the constructor).

    stage.showDefaultContextMenu = false;

    I am new to AS3.


  148. vaishu said,

    September 17, 2010 at 4:03 am

    I have around 20 buttons on my stage(fla file) who s instances are given in property bar…
    ->the buttons are animated in timeline

    and i want to give functionality to these buttons on click in external document file (.as file)

    the code which i wrote is

    import flash.display.MovieClip;
    import flash.events.*;
    import flash.events.Event;
    import flash.display.SimpleButton;
    import flash.events.MouseEvent;
    import flash.display.*;
    import flash.text.TextField;
    import flash.net.*;

    public class Main1 extends MovieClip

    public function Mainf():void{

    function fmain(Event:MouseEvent)
    trace(“i have clicked”);
    function ff(Event:MouseEvent)
    trace(“i have clicked”);
    function fatomic(Event:MouseEvent)
    trace(“i have clicked”);
    function fradio(Event:MouseEvent)
    function fmassenergy(Event:MouseEvent)
    function fmassdefect(Event:MouseEvent)
    function fnuclear(Event:MouseEvent)
    function fconstituent(Event:MouseEvent)
    function frutherford(Event:MouseEvent)
    function fthomsons(Event:MouseEvent)
    function fbohrs(Event:MouseEvent)
    function ftypes(Event:MouseEvent)
    function fatoms(Event:MouseEvent)
    function ffission(Event:MouseEvent)
    function ffusion(Event:MouseEvent)
    function freactor(Event:MouseEvent)
    function fradioactive(Event:MouseEvent)
    function fdisintegration(Event:MouseEvent)
    function ftransmutation(Event:MouseEvent)
    function fnext1(Event:MouseEvent)
    function fprev1(Event:MouseEvent)


    where all buttons instances are on stage…..
    they are no errors but the problem is…the button is not calling the function on click

  149. Kari said,

    September 19, 2010 at 1:07 pm

    After pulling out my hair for about 4.5 hours with this error last night, I read this post (and the comments) and it helped me fix my file this afternoon. Thank you all for your posts, I finally feel sane again.

  150. Larren said,

    September 24, 2010 at 2:00 am

    I had the same problem.

    If the movie clip has a classic tween applied to it which means you have 2 keyframes. Check movieclip labels on both keyframes.

    Hope this helps.

  151. julie said,

    September 25, 2010 at 11:27 am

    thanks so much! this helped me track the problem created by moving from CS3 to CS5.

  152. Nevin said,

    October 17, 2010 at 1:07 pm

    Hi, I’m getting these errors when I run my flash:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at EscapeTheFactory_fla::MainTimeline/F1C()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at EscapeTheFactory_fla::MainTimeline/F5A()

    The Script is as follows:

    var V1:Boolean;
    V1 = false;
    var VName : String;
    VName = T1A.text;
    stage.focus = T2B;
    function F5A(eventObject:MouseEvent) {
    MC1.visible = true;
    if (T2B.text == “Red Pill”) {
    V1 = true;
    } else if (T2B.text == “Blue Pill”) {
    V1 = true;
    } if (V == false){
    T1A.text == “You can’t do that.” + VName;
    stage.focus = T2B;


  153. Veronica said,

    October 27, 2010 at 9:45 am

    I’m getting this error 1009 “TypeError: Error #1009: Cannot access a property or method of a null object reference. at website_flashvrsn_fla::Mainpg_mc_1/stopScroll()

    I am running a simple personal site where there are several buttons that display various data. When I initiate the button that has a custom vertical scroll function, I receive the error from that point forward when any button is activated. The code is as follows:

    scrollText.text = someText;
    scrollText.multiline = true;
    scrollText.wordWrap = true;

    var bounds:Rectangle = new Rectangle(scrollMC.x, scrollMC.y, 0, 68);
    var scrolling:Boolean = false;

    function startScroll (e:Event):void {
    scrolling = true;
    scrollMC.startDrag (false,bounds);

    function stopScroll (e:Event):void {
    scrolling = false;
    scrollMC.stopDrag ();

    scrollMC.addEventListener (MouseEvent.MOUSE_DOWN, startScroll);
    stage.addEventListener (MouseEvent.MOUSE_UP, stopScroll);

    addEventListener (Event.ENTER_FRAME, enterHandler);

    function enterHandler (e:Event):void {
    if (scrolling == true) {
    scrollText.scrollV = Math.round(((scrollMC.y – bounds.y)/68)*scrollText.maxScrollV);

    The site works but I just continually receive the error once I activate the scroll. I am seeking clean code :-). Any ideas, where I may have gone wrong? I appreciate your assistance!

    IndesignCS5 into FlashCS5

  154. Antonio said,

    November 18, 2010 at 12:36 pm

    This is the
    Error message im getting i cnat figure it out

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at arraygame_fla::MainTimeline/shotListener()

  155. an_Eldridge said,

    November 18, 2010 at 2:07 pm

    I found this post to be the most helpful I’ve found so far on error #1009, but I am still wrestling the error myself!

    My AS3 (what I know of it) is very rusty, and I am relying on it to create a very simple portfolio website. I have all my main pages set up in different keyframes in a single timeline on one scene. All my main pages link perfectly through a set of six buttons. I want to have content in sub-pages linked the same way through buttons only existing on certain pages. I have the buttons set up with instances, and each time I try to write one into the code, it throws an error #1009. If I comment out that section of the code, I don’t get the error anymore. When I get the error, all my original buttons keep working- business as usual- but the new button refuses to work.

    Any thoughts? Here’s a sample of my code:


    //Plays through to next page
    function goHome(event:MouseEvent):void

    //Sets the event listener for the about button
    home_btn.addEventListener(MouseEvent.CLICK, goHome);

    //Plays through to next page
    function goAbout(event:MouseEvent):void

    //Sets the event listener for the about button
    abt_btn.addEventListener(MouseEvent.CLICK, goAbout);

    //Plays through to next page
    function goPort(event:MouseEvent):void

    //Sets the event listener for the about button
    port_btn.addEventListener(MouseEvent.CLICK, goPort);

    //Sets the event listener for the resume button
    res_btn.addEventListener(MouseEvent.CLICK, goRes);

    //Plays through to next page
    function goRes(event:MouseEvent):void

    //Sets the event listener for the contact button
    con_btn.addEventListener(MouseEvent.CLICK, goCon);

    //Plays through to next page
    function goCon(event:MouseEvent):void

    //Sets the event listener for the scoop button
    scoop_btn.addEventListener(MouseEvent.CLICK, goScoop);

    //Plays through to next page
    function goScoop(event:MouseEvent):void

    //Sets the event listener for the fonts button
    //fonts_btn.addEventListener(MouseEvent.CLICK, goFonts);

    //Plays through to next page
    //function goFonts(event:MouseEvent):void
    // gotoAndPlay(130);

    The commented code at the end is what throws the error if I un-comment it.

    Any help would be sincerely appreciated!

  156. an_Eldridge said,

    November 18, 2010 at 2:29 pm

    Thanks to reading through this post carefully, I think I figured out a work-around. Any advice would still be great, but at least this gets my buttons to work.

    Thank you all for sharing and helping us all!

  157. Kelly said,

    November 18, 2010 at 9:04 pm

    PERFECT answer. Worked great duh!

  158. kdu said,

    December 23, 2010 at 4:35 am

    Hi, I got an output message that “TypeError: Error #1009: Cannot access a property or method of a null object reference.at flashSnow/::frame1() ”
    Here is my code:
    package {
    import flash.events.Event;
    import flash.display.SimpleButton;
    import flash.display.MovieClip;
    import flash.filters.BlurFilter;
    import flash.text.TextField;

    public class flashSnow extends MovieClip {
    public function flashSnow():void {
    function createSnow(IN_Event:Event):void {
    if (randomInRange(1,3)==1) {
    var mc_particle:MovieClip=createCircle(randomInRange(3,10));
    mc_particle.filters=[new BlurFilter(10,10,2)];
    function createCircle(radius:Number):MovieClip {
    var mc_circle:MovieClip =new MovieClip();
    return (mc_circle);
    function moveSnow(IN_Event:Event):void {
    if (IN_Event.target.y>stage.stageHeight) {
    IN_Event.target.y += (IN_Event.target.width)/10;
    if (IN_Event.target.id==0) {
    IN_Event.target.x += (IN_Event.target.width)/30; }
    else if (IN_Event.target.id==1) {
    IN_Event.target.x -= (IN_Event.target.width)/30;
    function randomInRange(min:Number,max:Number):Number {
    var scale:Number=max- (–min);
    return Math.ceil(Math.random() * scale + min);

    Could you help me to solve it?

  159. Prashant said,

    January 13, 2011 at 4:48 pm

    I’m having a problem making a DVD Menu type thing. Basically, I have on the first frame the menu set up. When you click a button on the first frame, the code is supposed to take you to the second frame where it has the flvplayback and buttons on the bottom to return to the previous frame or navigate within the movie file. The second frame only controls previous cue point and next cue point. The problem I have is that I get the 1009 error code when test it. The code tells me, after debugging, that it’s on something in the first frame. After reading this thread, I looked as hard as I could. Below is my code. Can anyone help?

    first frame:


    import fl.video.*;

    var url:String = (“http://PAL”);
    var request:URLRequest = new URLRequest(url);

    Intro.addEventListener(MouseEvent.CLICK, IntroMod);
    Test.addEventListener(MouseEvent.CLICK, TestBTN);
    Overview.addEventListener(MouseEvent.CLICK, OvrMod);
    PE.addEventListener(MouseEvent.CLICK, PEMod);
    OPM.addEventListener(MouseEvent.CLICK, OPMMod);
    PA.addEventListener(MouseEvent.CLICK, PAMod);
    AM.addEventListener(MouseEvent.CLICK, AMMod);
    RM.addEventListener(MouseEvent.CLICK, RMMod);
    PM.addEventListener(MouseEvent.CLICK, PMMod);
    DI.addEventListener(MouseEvent.CLICK, DIMod);
    SR.addEventListener(MouseEvent.CLICK, SRMod);
    PerfM.addEventListener(MouseEvent.CLICK, PerfMMod);
    CM.addEventListener(MouseEvent.CLICK, CMMod);
    OPTraining.addEventListener(MouseEvent.CLICK, OPMod);

    //Main Menu Buttons

    function TestBTN(event:MouseEvent){

    function IntroMod(event:MouseEvent){

    function OvrMod(event:MouseEvent){

    function PEMod(event:MouseEvent){

    function OPMMod(event:MouseEvent){

    function PAMod(event:MouseEvent){

    function AMMod(event:MouseEvent){

    function RMMod(event:MouseEvent){

    function PMMod(event:MouseEvent){

    function DIMod(event:MouseEvent){

    function SRMod(event:MouseEvent){

    function PerfMMod(event:MouseEvent){

    function CMMod(event:MouseEvent){

    function OPMod(event:MouseEvent){

    second frame:


    //Playback Menu Buttons
    var i=1;
    var j=0;

    MMenu.addEventListener(MouseEvent.CLICK, MainMenu);
    Prev.addEventListener(MouseEvent.CLICK, PrevMod);
    Next.addEventListener(MouseEvent.CLICK, NextMod);

    function MainMenu(event:MouseEvent) {

    function PrevMod(event:MouseEvent) {

    function NextMod(event:MouseEvent) {

    Any help?! PLEASE!!

  160. Alex said,

    February 11, 2011 at 3:45 am

    hey I’m making a short game for college and I’ve done all the code perfectly but that stupid error keeps coming up 🙁
    My code is :-
    var gameLoaded = false;

    stage.addEventListener(Event.ENTER_FRAME, game);
    playb.addEventListener(MouseEvent.CLICK, loadLevel1);

    function game (event)
    trace(“check loopping”);

    if(gameLoaded == false)
    playb.x = 150;

    function loadLevel1 (event)
    playb.x = -2000;
    gameLoaded = true;

    Any help please?

  161. Mohit said,

    March 8, 2011 at 10:21 pm

    THANK u BOSS 🙂

  162. Patrick said,

    March 20, 2011 at 6:10 am

    I fixed my problem… my frame1 for my main stuff was blank, because I thought I’d just have the loader. But then I simple put my main stuff under the loader – so it’s in all frames! The loader ends at frame1, but the main stuff goes from frame1 to frame2!


  163. Rakshith said,

    March 22, 2011 at 1:46 am


    Here is my code and i am getting the below error:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.effects.effectClasses::MoveInstance/play()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\effects\effectClasses\MoveInstance.as:239]
    at mx.effects::EffectInstance/startEffect()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\effects\EffectInstance.as:569]
    at mx.effects.effectClasses::ParallelInstance/play()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\effects\effectClasses\ParallelInstance.as:199]
    at mx.effects::EffectInstance/startEffect()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\effects\EffectInstance.as:569]
    at mx.effects::Effect/play()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\effects\Effect.as:930]
    at mx.core::UIComponent/commitCurrentState()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7198]
    at mx.core::UIComponent/setCurrentState()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7113]
    at mx.core::UIComponent/set currentState()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:4361]
    at Feedback/resulthandler()[C:\Documents and Settings\rakshith\My Documents\Flex Builder 3\Feedback\src\Feedback.mxml:220]
    at Feedback/__service1_result()[C:\Documents and Settings\rakshith\My Documents\Flex Builder 3\Feedback\src\Feedback.mxml:265]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\http\mxml\HTTPService.as:290]
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:193]
    at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:43]
    at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
    at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:403]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

    Here is my code…
    Please do help me out::::

    import mx.containers.Tile;
    import mx.rpc.events.ResultEvent;
    import mx.collections.ArrayCollection;
    import mx.controls.Label;
    import mx.controls.Alert;
    import mx.rpc.events.ResultEvent;

    public var def_val:String=null;
    public var gotIt:ArrayCollection = new ArrayCollection();
    public var temp:Boolean;

    public var i:int=0;

    public function id_to_arr():void{
    gotIt= load_all_courses.lastResult.course_details.details ;

    public function addFindReplaceButton():void {

    var but:Button = new Button();
    but.label = "Submit";



    //Send the text to backend….
    private function SendFeedback(e:MouseEvent):void{
    temp = false;





  164. Curtis J. Morley said,

    March 25, 2011 at 12:53 pm

    RakShith – I apologize that the code was cut off. Your “while” statement is where it looks incomplete. Try using the “code” button on the comments before pasting.


    Curtis J. Morley

  165. Mark said,

    March 30, 2011 at 4:01 pm

    I am a complete newb when it comes to flash and actionscript 3. I have set up a button class and document class. In the button class I have code that defines what the text on the button will be. In the document class I have code that defines what the text on the instances of the button will be. I keep getting the error TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at siteButton/setLabel()
    at Website()

    This is my button class code (siteButton)

    import flash.display.SimpleButton;

    public class siteButton extends SimpleButton

    public function siteButton()
    trace(“siteButton has been cerated”)
    public function setLabel(newLabel:String):void
    this.buttonLabel.text = newLabel;
    This is my document class code (Website)

    import flash.display.MovieClip;

    public class Website extends MovieClip

    public function Website()



    I’m guessing that it’s trying to execute the function before it knows what it is. I just don’t know how to solve it.

  166. FlashProject said,

    April 12, 2011 at 4:25 am

    I got this error message:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at QuizApp/createQuestions()
    at QuizApp()

    after modifying an actionscript tutorial I found online to create an oop quiz application, this is the code, and I cannot figure out what the problem is :


    package {

    import flash.display.Sprite;
    import fl.controls.Button;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;

    public class QuizApp extends Sprite {
    //for managing questions:
    private var quizQuestions:Array;
    private var currentQuestion:QuizQuestion;
    private var currentIndex:int = 0;
    //the buttons:
    private var prevButton:Button;
    private var nextButton:Button;
    private var finishButton:Button;
    //scoring and messages:
    private var score:int = 0;
    private var status:TextField;
    //for randomizing
    private var tempArray:Array;
    private var quizLength:int;

    public function QuizApp() {
    quizQuestions = new Array();
    //added this function for randomizing
    private function createQuestions() {
    tempArray.push(new QuizQuestion(“What color is an orange?”,
    tempArray.push(new QuizQuestion(“What is the shape of planet earth?”,
    tempArray.push(new QuizQuestion(“Who created SpiderMan?”,
    “Jack Kirby”,
    “Stan Lee and Steve Ditko”,
    “Stan Lee”,
    “Steve Ditko”,
    “none of the above”));
    tempArray.push(new QuizQuestion(“Who created Mad?”,
    “Al Feldstein”,
    “Harvey Kurtzman”,
    “William M. Gaines”,
    “Jack Davis”,
    “none of the above”));
    quizLength = tempArray.length


    private function mixQuestions() {
    for (var i:int = 0; i < quizLength; i++) {
    var randomValue:int = Math.floor(Math.random() * tempArray.length);

    private function createButtons() {
    var yPosition:Number = stage.stageHeight – 40;

    prevButton = new Button();
    prevButton.label = "Previous";
    prevButton.x = 30;
    prevButton.y = yPosition;
    prevButton.addEventListener(MouseEvent.CLICK, prevHandler);

    nextButton = new Button();
    nextButton.label = "Next";
    nextButton.x = prevButton.x + prevButton.width + 40;
    nextButton.y = yPosition;
    nextButton.addEventListener(MouseEvent.CLICK, nextHandler);

    finishButton = new Button();
    finishButton.label = "Finish";
    finishButton.x = nextButton.x + nextButton.width + 40;
    finishButton.y = yPosition;
    finishButton.addEventListener(MouseEvent.CLICK, finishHandler);
    private function createStatusBox() {
    status = new TextField();
    status.autoSize = TextFieldAutoSize.LEFT;
    status.y = stage.stageHeight – 80;

    private function showMessage(theMessage:String) {
    status.text = theMessage;
    status.x = (stage.stageWidth / 2) – (status.width / 2);
    private function addAllQuestions() {
    for(var i:int = 0; i < quizQuestions.length; i++) {
    private function hideAllQuestions() {
    for(var i:int = 0; i 0) {
    currentQuestion.visible = false;
    currentQuestion = quizQuestions[currentIndex];
    currentQuestion.visible = true;
    } else {
    showMessage(“This is the first question, there are no previous ones”);
    private function nextHandler(event:MouseEvent) {
    if(currentQuestion.userAnswer == 0) {
    showMessage(“Please answer the current question before continuing”);
    if(currentIndex < (quizQuestions.length – 1)) {
    currentQuestion.visible = false;
    currentQuestion = quizQuestions[currentIndex];
    currentQuestion.visible = true;
    } else {
    showMessage("That's all the questions! Click Finish to Score, or Previous to go back");
    private function finishHandler(event:MouseEvent) {
    var finished:Boolean = true;
    for(var i:int = 0; i < quizQuestions.length; i++) {
    if(quizQuestions[i].userAnswer == 0) {
    finished = false;
    if(finished) {
    prevButton.visible = false;
    nextButton.visible = false;
    finishButton.visible = false;
    } else {
    showMessage("You haven't answered all of the questions");
    private function computeScore() {
    for(var i:int = 0; i < quizQuestions.length; i++) {
    if(quizQuestions[i].userAnswer == quizQuestions[i].correctAnswer) {
    showMessage("You answered " + score + " correct out of " + quizQuestions.length + " questions.");

    Can u please tell me what the problem is and how i can solve it
    , thank you in advance!

  167. Brian said,

    May 28, 2011 at 1:18 pm

    Hi Curtis,

    Your error explanations are actually made for humans to understand. I can’t thank you enough. I just read your post about the underlying reason why I’m running into error #1009, “Trying to reference something that isn’t there yet”. While, I do understand the reasoning behind the error, I don’t know how to solve the error in my situation.

    I have a master container that I load my sections into. Each section, or swf has “intro” & “outro” states so the transitions are smooth. I have this working properly with no issues.

    I’ve decided to add an XML gallery as another section, which has a corresponding Gallery.as file. I have it working properly on its own. However, if I add it to the master container, and run the movie, I get this:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Gallery()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Gallery/urlLoadComplete()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

    Mind you, all movieclips and actions are on the first frame of my gallery.swf.

    Looks like this all has to do with the Gallery.as file. I’m wondering if this is a targeting/scope issue? Or, does my master container not realize the gallery.swf exists? According to your comments about the 1009 error, the movieclip isn’t instantiated yet. Not sure where to begin in this situation. The other sections work, why not this one? If you could at least point me in the right direction that would be fantastic. Any help would be greatly appreciated.

    If what I’m describing doesn’t make much sense, I could post my files.

  168. Dibya said,

    June 7, 2011 at 9:19 pm

    I have this code at login:
    user1Btn.addEventListener(MouseEvent.CLICK, user1click);
    function user1click(evt:MouseEvent) {
    and at desktop:
    logoff.addEventListener(MouseEvent.CLICK, logoffclick);
    function logoffclick(evt:MouseEvent) {
    and i m getting the error 1009. Plz help.

  169. Charlito said,

    August 21, 2011 at 5:50 am

    dude.. u really save me… i was getting that error for like an hour.. didnt know what to do.. but at the end..i notice that i did a reference to a button that hasnt been loaded… i really never comment on anything.. but this time..
    i wanna say thx.


  170. many said,

    September 16, 2011 at 1:53 pm

    Hi Curtis,
    Im actually having the 1009 error, but im tring to call a gallery that is working whit xml, Does the xml has any relation whit the 1009 error? i can paste the code if u can help me.
    Thank you

  171. Albulescu Cosmin said,

    October 6, 2011 at 12:12 am

    Hi, very nice post. Very usefull

  172. Curtis J. Morley said,

    October 20, 2011 at 9:05 pm

    Albulesco Glad this helped with Error 1009.

    Curtis J. Morley

  173. Cindy M said,

    October 14, 2011 at 12:20 pm

    Curtis, you have no idea how many times you’ve helped me out. Once again, thank you!! 🙂

  174. Curtis J. Morley said,

    October 20, 2011 at 9:03 pm

    Cindy M.
    Glad I can help.

  175. Andrei said,

    November 28, 2011 at 8:08 am

    Hi, What about this error displaying when accessing an empty table from a local sql database?

    var selectStmt:SQLStatement = new SQLStatement;
    selectStmt.sqlConnection = conn;

    selectStmt.text = “SELECT * FROM Guest ORDER BY entryID DESC”;

    var result:SQLResult = selectStmt.getResult();

    The Guest table in this case is empty though no rows returned. If the table has more than one row, then the error doesn’t show up. Any other ways to check a database table if it’s empty or not without getting an error?

    thank you

  176. Alex said,

    April 27, 2012 at 5:27 am

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at FinalProject/hitTest()


    import flash.display.MovieClip;
    import flash.events.*;
    import flash.utils.Timer;
    import flash.ui.Keyboard;
    import flash.events.Event;
    import flash.events.KeyboardEvent;
    import flash.events.MouseEvent;
    import flash.text.TextField;

    public class FinalProject extends MovieClip
    //var goes here
    var sn:snake;
    var keys:Array = [];
    var bd:body;
    var bds:Array = new Array();
    var mo:mouse;
    var moARR:Array = new Array();
    var moSpawnChance:Number = 4;
    var moTimer:Timer = new Timer(3000);
    var partsArr:Array= new Array();

    public function FinalProject()
    // constructor code

    public function startGame()
    //add snake and mouse at start of game

    //add mouse timer
    /*moTimer.addEventListener(TimerEvent.TIMER, addMouse);

    public function addSnake()
    //call new snake
    //key listeners
    sn= new snake();
    sn.addEventListener(Event.ENTER_FRAME, update);
    stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
    stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
    addEventListener(Event.ENTER_FRAME, hitTest);

    public function addBody()
    bd= new body();
    public function addMouse()
    var mo:mouse = new mouse();


    trace(“mouse spawn”);

    function update(e:Event):void
    if (keys[Keyboard.RIGHT])
    sn.x += 5;
    sn.rotation = 180;

    if (keys[Keyboard.LEFT])
    sn.x -= 5;
    sn.rotation = 0;
    if (keys[Keyboard.UP])
    sn.y -= 5;
    sn.rotation = 90;
    if (keys[Keyboard.DOWN])
    sn.y += 5;
    sn.rotation = 270;
    if (sn.x = 470)
    sn.rotation = 0;
    sn.x = 460;
    if (sn.y = 305)
    sn.rotation = 90;
    sn.y = 300;

    function onKeyDown(e:KeyboardEvent):void
    keys[e.keyCode] = true;

    function onKeyUp(e:KeyboardEvent):void
    keys[e.keyCode] = false;
    //Add new part to the snake’s body

    function attachNewPart():void
    var newPart:bodyPart = new bodyPart();


    partsArr.push(newPart); //add new part into snake body

    function hitTest(evt:Event)
    if ( mo.hitTestPoint(sn.x, sn.y, true))



  177. Arielle said,

    February 26, 2013 at 11:55 am

    You saved my project ..I’m making a flash app and I was getting that 1009 error because when loaded my button wasn’t found because it was in the 2nd frame so I copyed and pasted that button on frame 1 and changed the alpha to 0 ..goshhh..thanks so much.. and your post saved me from going crazy ..:) thanks again !!

  178. Arielle said,

    February 26, 2013 at 11:56 am

    You saved my project ..I’m making a flash app and I was getting that 1009 error because when loaded my button wasn’t found because it was in the 2nd frame so I copied and pasted that button on frame 1 and changed the alpha to 0 ..goshhh..thanks so much.. and your post saved me from going crazy ..:) and saved my project grade. thanks again !!

  179. Curtis J. Morley said,

    March 2, 2013 at 8:03 pm

    Glad I could help Arielle. This one is always a tricky one.

  180. lester said,

    July 12, 2013 at 2:26 am

    hi here is my code:

    btnBack.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_22);

    function fl_ClickToGoToScene_22(event:MouseEvent):void
    removeEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_22);
    MovieClip(this.root).gotoAndPlay(1, “Scene 2”);

    and it says…

    [SWF] CamRollExCS5.swf – 315914 bytes after decompression
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at CamRollExCS5_fla::MainTimeline/frame1()[CamRollExCS5_fla.MainTimeline::frame1:4]
    at flash.display::MovieClip/gotoAndPlay()
    at CamRollExCS5_fla::MainTimeline/fl_ClickToGoToScene_22()[CamRollExCS5_fla.MainTimeline::frame4:97]
    Test Movie terminated.

    it still runs., but when i use the back button to go back to frame 2, all the other button is unclickable. and one button is gone xC pls help us out, it is for our research study and it is 2 weeks from now..

Leave a Comment