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

14 posts
  • Bought between 10 and 49 items
  • Has been a member for 5-6 years
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.

2565 posts Put a Donk On It
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • United Kingdom
  • Exclusive Author
  • Attended a Community Meetup
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 100 and 199 users
+5 more
ThemeProvince says

Have you used stage at all for example:

stage.stageWidth

in your conceptGallery.swf?

14 posts
  • Bought between 10 and 49 items
  • Has been a member for 5-6 years
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.

2565 posts Put a Donk On It
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • United Kingdom
  • Exclusive Author
  • Attended a Community Meetup
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 100 and 199 users
+5 more
ThemeProvince says

There’s your problem.

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

14 posts
  • Bought between 10 and 49 items
  • Has been a member for 5-6 years
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?

2565 posts Put a Donk On It
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • United Kingdom
  • Exclusive Author
  • Attended a Community Meetup
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 100 and 199 users
+5 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

}

2565 posts Put a Donk On It
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • United Kingdom
  • Exclusive Author
  • Attended a Community Meetup
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 100 and 199 users
+5 more
ThemeProvince says

Resolved

1 post
  • Has been a member for 1-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… :(

by
by
by
by
by
by