Hmmm... what's the rest of the Slide constructor? It sounds like maybe
that's where the error is...

Also, if you try running your Flash file in debug mode (Hit
Ctrl-Shift-Enter), the debugger will take control at the moment when you're
trying to access a null object, which usually helps you figure out what's
causing these kinds of problems.

--T


On Tue, Jan 27, 2009 at 4:40 PM, K-Dawg <kdaw...@gmail.com> wrote:

> Hello,
>
> I am new to Action Script 3.  I am used to Java, Perl, & Python.  I am
> receiving the following error:
>
> TypeError: Error #1009: Cannot access a property or method of a null object
> reference.
>    at Slide$iinit()
>    at PondoShow$iinit()
>
> All I have a PondShow class that extends Sprite.  then I have a Slide
> class.  I am trying to instantiate an array for Slide objects.
>
>    import flash.display.Sprite;
>    import flash.events.*;
>    import flash.text.*;
>    import flash.net.URLRequest;
>    import flash.utils.*;
>
>    public class PondoShow extends Sprite {
>        private var slides:Array;
>        private var slideCounter:int;
>        private var myTimer:Timer;
>
>        public function PondoShow() {
>            myTimer = new Timer(3000);
>            slides = new Array(4);
>            slides[0] = new Slide("This is a test", "this is only a test",
> "img/food_array.jpg", "Click here to find out more", "more.html", 100, 100,
> 50, 50, 200, 200);
>            slides[1] = new Slide("This is a test", "this is only a test",
> "img/food_array2.jpg", "Click here to find out more", "more.html", 100,
> 100,
> 50, 50, 200, 200);
>            slides[2] = new Slide("This is a test", "this is only a test",
> "img/food_array3.jpg", "Click here to find out more", "more.html", 100,
> 100,
> 50, 50, 200, 200);
>            slides[3] = new Slide("This is a test", "this is only a test",
> "img/get_it_to_go_logo.jpg", "Click here to find out more", "more.html",
> 100, 100, 50, 50, 200, 200);
>            slideCounter = 0;
>            trace("before adding slides");
>            while(true) {
>                if (slides[slideCounter].imgload) {
>                    addChild(slides[slideCounter].loader.content);
>                    break;
>                }
>            }
>
> Error occurs when instantiating the first Slide object.  It also fails when
> I do not use an array and all I do is try to create a single object.
>
> My slide class has a constructor:
>
>        public function Slide(primaryText:String, secondaryText:String,
> imagePathString:String, slideLinkText:String, slideLink:String,
> primaryTextX:int, primaryTextY:int, secondaryTextX:int, secondaryTextY:int,
> linkX:int, linkY:int) {
>
> Thanks for any help.  I am new to AS 3.
>
> Kevin
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to