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

14 posts
  • Has been part of the Envato Community for over 6 years
  • Has collected 10+ items on Envato Market
itsjosee says

Hi,

I guess I should let you know what two files I’m working with on this project.

I’m using this external preloader… http://activeden.net/item/external-asset-preloaderloader/38518

...to load this gallery. I’m also going to be loading in 3 different galleries. But for now, I’ve only tested one.

http://activeden.net/item/whole-browser-xml-slideshow-image-viewer/22014

Here’s my problem..

I have a main.swf that is going to load conceptGallery.swf, portraitsGallery.swf, and miscGallery.swf

So far I’ve only finished up conceptGallery.swf and it looks great when I’m looking at it by itself. But when I try and load it into my main.swf, I get this error:

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

I’ve looked around google but with not much luck :(

Does anybody have any suggestions? This is my first time working in AS3 , so any help would be greatly appreciated.

Thank you.

2587 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 more
ThemeProvince says

Have you used stage at all for example:

stage.stageWidth

in your conceptGallery.swf?

14 posts
  • Has been part of the Envato Community for over 6 years
  • Has collected 10+ items on Envato Market
itsjosee says
Have you used stage at all for example: stage.stageWidth in your conceptGallery.swf?

I believe so.

I read that as an answer when I was browsing through Google. But since I didn’t build the gallery myself, I’m not quite sure what to do edit and what not :)

But looking through the first few lines, I found this:

var empty_mc:Loader=new Loader(); stage.addChild(empty_mc); var swfStage:Stage = empty_mc.stage; swfStage.scaleMode = StageScaleMode.NO_SCALE; swfStage.align = StageAlign.TOP_LEFT;

Other than that, the only other thing involving “Stage” was for the full screen function.

2587 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 more
ThemeProvince says

There’s your problem.

Use ADDED _TO_STAGE and include all you stage statements in there.

14 posts
  • Has been part of the Envato Community for over 6 years
  • Has collected 10+ items on Envato Market
itsjosee says
There’s your problem. Use ADDED _TO_STAGE and include all you stage statements in there.

thePhoenix,

So replace everything that is stage.something to ADDED _TO_STAGE, or replace what is swfStage?

2587 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 more
ThemeProvince says
There’s your problem. Use ADDED _TO_STAGE and include all you stage statements in there.

thePhoenix,

So replace everything that is stage.something to ADDED _TO_STAGE, or replace what is swfStage?

addEventListener(Event.ADDED_TO_STAGE, setupStage);

function setupStage (e:Event):void {

// all stage statements in here

}

2587 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 more
ThemeProvince says

Resolved

1 post
  • Has been part of the Envato Community for over 2 years
shwetasaxena says

Hi…

I am using AS3 .0 preloader for load external swf And i am getting error

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

When i put these code in my main swf

stage.scaleMode = StageScaleMode.SHOW_ALL; stage.align = StageAlign.TOP;

below is the loader swf code

var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); loader.load(new URLRequest("~certipath.swf")); function progressHandler(event:ProgressEvent):void { var ratio:Number = event.bytesLoaded / event.bytesTotal; percent.text = Math.ceil(ratio*100).toString(); bar.scaleX = ratio; } function completeHandler(event:Event):void{ removeChild(percent); removeChild(bar); removeChild(loading); removeChild(countD); removeChild(bgg); percent = null; bar = null; addChild(loader); }

Could please help me, I have searched a lot… but no luck… what i do to resolve this problem and I also tried your code [posted above].... but loader didn’t call the main swf… :(

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by