# AS3 code not working if i add a scene before the as3 code scene

**URL:** <https://forum.kirupa.com/t/as3-code-not-working-if-i-add-a-scene-before-the-as3-code-scene/325422>\
**Category:** flash\
**Created:** [October 14, 2011, 7:47am UTC](https://forum.kirupa.com/t/as3-code-not-working-if-i-add-a-scene-before-the-as3-code-scene/325422 "2011-10-14T07:47:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohiniraj](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@mohiniraj](https://forum.kirupa.com/u/mohiniraj)\
**Post date:** [October 14, 2011, 7:47am UTC](https://forum.kirupa.com/t/as3-code-not-working-if-i-add-a-scene-before-the-as3-code-scene/325422/1 "2011-10-14T07:47:05Z")

</div>

Hi,

I have an Actionscript coded flash file which run perfectly without any error.

I am not getting why it shows an error after i do insert a scene before or a frame before the current frames;

TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at myFile\_fla::MainTimeline/frame2()  
at flash.display::Sprite/constructChildren()  
at flash.display::Sprite()  
at flash.display::MovieClip()  
at myFile\_fla::images\_mc\_1()

I am moving all frames along with actionscript to next frame as i want add preloader to it.

can anyone specify the reason?

Thank you.
