Flash CS3: Error #1010

I am working on a banner swf for the side of a webpage and having some trouble. I am trying to send pictures back and forth on the screen, and change the pictures while they are offscreen, since there will be only two picture floaters moving about at one time. However, I am getting an error now when I try to run the thing. The runtime output is as follows:

TypeError: Error #1010: A term is undefined and has no properties.
at pictureframe/switchit()
at pix/choose()
at pix/frame1()
None of my object have more than one frame, since the whole project is in as3, so you can ignore that bit. Also I should note that I am using the TweenLite tweening engine. It’s entirely possible this is a very simple mistake as I have no formal coding experience and rely mostly on tutorials. Here is the code from the involved items:


/*
My moving picture object. This object(pix) is
 created at the stage level in frame 1, layer 2,
 along with several other, stable objects. This 
symbol creates an instance of pictureframe(next code box).
 I took the tweening code for this from another section
 of the project that works with no errors, so I believe it 
is unrelated. Also, the integer num is currently set to 2 for
 testing purposes, but will later be a random number 
between 0-8.
*/

import fl.transitions.*;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.utils.Timer;
import flash.events.TimerEvent;
import gs.TweenLite;

var rnum:Number = new Number(1);
var pf:pictureframe = new pictureframe();

pf.x = 0;
var num:int = 2;
addChild(pf);
choose();

function choose():void
{
    pf.switchit(num);
    pf.y = ((Math.random()*620)+4);
    rnum = (Math.random()*10);
    
    if ((rnum % 2) < 1)    {
        goRight();    }
    else            {
        goLeft();    }
}

function goRight():void
{
    pf.x =(-12);
    TweenLite.to(pf, 12, {x:404, ease:None.easeOut, delay:(Math.random()*5), onComplete:choose});
}

function goLeft():void
{
    pf.x =(404);
    TweenLite.to(pf, 12, {x:-12, ease:None.easeOut, delay:(Math.random()*5), onComplete:choose});
}

/*
This is the symbol named pictureframe.
 It was made to handle the switching of
 pictures. There are 9 pictures in jpeg 
format that have been added o symbols 
named accordingly. All involved symbols
 have been exported for actionscript etc.
*/
    var pic_1:pic1 = new pic1();
    var pic_2:pic2 = new pic2();
    var pic_3:pic3 = new pic3();
    var pic_4:pic4 = new pic4();
    var pic_5:pic5 = new pic5();
    var pic_6:pic6 = new pic6();
    var pic_7:pic7 = new pic7();
    var pic_8:pic8 = new pic8();
    var pic_9:pic9 = new pic9();
    var picArray = new Array(pic_1, pic_2, pic_3, pic_4, pic_5, pic_6, pic_7, pic_8, pic_9);
    var last:int = -1;
    
function switchit(x:int):void
{
    if (last > -1)
    {
        removeChild(picArray[last]);
    }
    addChild(picArray[x]);
    last = x;    
}

I played around with the flash debugger and found that when the switchit function is actually run, the picture objects in the array are still null. I do not know why, but it would appear that they are created before switchit is called, but not initialized properly? Thankyou for taking the time to read this far. :smiley: If you have any idea what I am doing wrong, please let me know!