Error 1009 Actionscript Flash CC - actionscript-3

So I have been trying to figure out this error for the past two hours, I've tried researching the entire internet for an answer and so far I haven't been able to figure it out.
Would someone be able to help me! This is my code :
stop();
countdown_mc.visible = false;
stage.focus = stage;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.sensors.Accelerometer;
import flash.events.AccelerometerEvent;
var myAccel: Accelerometer = new Accelerometer();
var score: Number = 0;
var countDown: Timer = new Timer(1000);
stage.addEventListener(Event.ENTER_FRAME, checkHit);
myAccel.setRequestedUpdateInterval(100); //Every half second.
countDown.addEventListener(TimerEvent.TIMER, count);
countDown.start();
if (Accelerometer.isSupported == true) {
myAccel.addEventListener(AccelerometerEvent.UPDATE, update);
function update(e: AccelerometerEvent) {
x_mc.x -= (e.accelerationX * 30);
o_mc.x -= (e.accelerationX * 30);
if (x_mc.x < 150) {
x_mc.x = 150;
}
if (x_mc.x >= stage.stageWidth - 150) {
x_mc.x = stage.stageWidth - 150;
}
if (o_mc.x < 150) {
o_mc.x = 150;
}
if (o_mc.x >= stage.stageWidth - 150) {
o_mc.x = stage.stageWidth - 150;
}
}
}
function count(eeee: TimerEvent) {
var drop: Number = Math.floor(Math.random() * 5) + 1;
if (drop == 1) {
x_mc.gotoAndPlay(2);
countDown.stop();
gotoAndPlay(180);
o_mc.stop();
stage.removeEventListener(Event.ENTER_FRAME, checkHit);
stage.removeEventListener(AccelerometerEvent.UPDATE, update);
stage.removeEventListener(TimerEvent.TIMER, count);
} else if (drop == 2) {
o_mc.gotoAndPlay(2);
countDown.stop();
gotoAndPlay(180);
x_mc.stop();
stage.removeEventListener(Event.ENTER_FRAME, checkHit);
stage.removeEventListener(AccelerometerEvent.UPDATE, update);
stage.removeEventListener(TimerEvent.TIMER, count);
} else if (drop) {
x_mc.stop();
o_mc.stop();
} else if (x_mc.hitTestObject(exoHit_mc)) {
score++;
}
}
function checkHit(eeee: Event) {
if (x_mc.hitTestObject(exeHit_mc)) {
gotoAndStop(257);
stage.removeEventListener(Event.ENTER_FRAME, checkHit);
stage.removeEventListener(AccelerometerEvent.UPDATE, update);
stage.removeEventListener(TimerEvent.TIMER, count);
}
}
And this is the error :
[SWF] flash%20gmae.swf - 2013164 bytes after decompression
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashgmae_fla::MainTimeline/count()[flashgmae_fla.MainTimeline::frame179:91]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashgmae_fla::MainTimeline/count()[flashgmae_fla.MainTimeline::frame179:91]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashgmae_fla::MainTimeline/count()[flashgmae_fla.MainTimeline::frame179:79]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashgmae_fla::MainTimeline/count()[flashgmae_fla.MainTimeline::frame179:91]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashgmae_fla::MainTimeline/count()[flashgmae_fla.MainTimeline::frame179:79]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashgmae_fla::MainTimeline/count()[flashgmae_fla.MainTimeline::frame179:67]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
[UnloadSWF] flash%20gmae.swf
Test Movie terminated.
I have figured out that is has something to do with the x_mc and o_mc movie clips but I have no idea what the issue is as I am new to action script.
Thank you so much!

x_mc and o_mc are not present on the frames, or don't have an instance name set. Verify that both objects have the correct instance name set. After doing that, verify this for exoHit_mc and exeHit_mc as well.

Related

Actionscript3 shooter game error 1009 and 2009

Good day everyone! I'm Jeremy, a college student. I'm working on a shooter game that has story and up to 3 levels (this is our finals that is due in 2 days). I know that I must know this stuff bcoz of school, but honestly I dont. And I'm really not good with actionscript 3 so I really need ur help guys. I know that this problem has been all over the net. But I still don't know how to solve the Error Code 1009 and 2007..
So this is my code for frame4:
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.events.Event;
stop();
var container:MovieClip = new MovieClip();
addChild(container);
//move the spaceship using our mouse
function controlSpaceShip(event:Event):void
{
shipMC.x = stage.mouseX;
Mouse.hide();
}
stop();
var score:int = 0;
stage.addEventListener(Event.ENTER_FRAME, controlSpaceShip);
//shoot bullets when we left click on the mouse
function shootBullet(event:MouseEvent):void
{
var thebullet:MovieClip = new bullet(); //calls the bullet symbol from the library
//positions the bullet at the position of your ship
thebullet.x = shipMC.x + 30;
thebullet.y = shipMC.y + 20;
//we add the bullet onto the stage
container.addChild(thebullet);
}
stage.addEventListener(MouseEvent.CLICK, shootBullet);
//when bullet hits the enemy1
function hitEnemy(event:Event):void {
if (container.hitTestObject(enemy1)) {
enemy1.alpha = 0;
score = score + 5;
txtScore.text = (score).toString();
}
}
stage.addEventListener(Event.ENTER_FRAME, hitEnemy);
//when bullet hits the enemy2
function hitEnemy2(event:Event):void {
if (container.hitTestObject(enemy2)) {
enemy2.alpha = 0;
score = score + 5;
txtScore.text = (score).toString();
}
}
stage.addEventListener(Event.ENTER_FRAME, hitEnemy2);
//when bullet hits the enemy3
function hitEnemy3(event:Event):void {
if (container.hitTestObject(enemy3)) {
enemy3.alpha = 0;
score = score + 5;
txtScore.text = (score).toString();
}
}
stage.addEventListener(Event.ENTER_FRAME, hitEnemy3);
//when bullet hits the enemy4
function hitEnemy4(event:Event):void {
if (container.hitTestObject(enemy4)) {
enemy4.alpha = 0;
score = score + 5;
txtScore.text = (score).toString();
}
}
stage.addEventListener(Event.ENTER_FRAME, hitEnemy4);
//when bullet hits the enemy5
function hitEnemy5(event:Event):void {
if (container.hitTestObject(enemy5)) {
enemy5.alpha = 0;
score = score + 5;
txtScore.text = (score).toString();
}
}
stage.addEventListener(Event.ENTER_FRAME, hitEnemy5);
//when bullet hits the enemy6
function hitEnemy6(event:Event):void {
if (container.hitTestObject(enemy6)) {
enemy6.alpha = 0;
score = score + 5;
txtScore.text = (score).toString();
}
if (txtScore.text == (150).toString())
{
gotoAndStop(5);
}
}
stage.addEventListener(Event.ENTER_FRAME, hitEnemy6);
//move the enemies vertically
function moveEnemies(event:Event):void {
//ENEMY 1
enemy1.y += 8; //increment the y location of my enemy 6 pixels
if (enemy1.y > 600) { //if my enemy is outside the stage
enemy1.y = 0; //place it back on the stage
enemy1.x = Math.random() * 550; //randomize its horizontal location
}
//ENEMY 2
enemy2.y += 4; //increment the y location of my enemy 3 pixels
if (enemy2.y > 600) { //if my enemy is outside the stage
enemy2.y = 0; //place it back on the stage
enemy2.x = Math.random() * 550; //randomize its horizontal location
}
//ENEMY 3
enemy3.y += 3; //increment the y location of my enemy 3 pixels
if (enemy3.y > 600) { //if my enemy is outside the stage
enemy3.y = 0; //place it back on the stage
enemy3.x = Math.random() * 550; //randomize its horizontal location
}
//ENEMY 4
enemy4.y += 4; //increment the y location of my enemy 3 pixels
if (enemy4.y > 600) { //if my enemy is outside the stage
enemy4.y = 0; //place it back on the stage
enemy4.x = Math.random() * 550; //randomize its horizontal location
}
//ENEMY 5
enemy5.y += 4; //increment the y location of my enemy 3 pixels
if (enemy5.y > 600) { //if my enemy is outside the stage
enemy5.y = 0; //place it back on the stage
enemy5.x = Math.random() * 550; //randomize its horizontal location
}
//ENEMY 6
enemy6.y += 4; //increment the y location of my enemy 3 pixels
if (enemy6.y > 600) { //if my enemy is outside the stage
enemy6.y = 0; //place it back on the stage
enemy6.x = Math.random() * 550; //randomize its horizontal location
}
}
stage.addEventListener(Event.ENTER_FRAME, moveEnemies);
so after killing all 6 enemies and scoring at least 150, I want the frame to jump to frame5(success) while frame 5 has the button to click going to frame6(story and goes to level2)..
and here's the error that keeps on going and going..
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at finals_interactivegame2_fla::MainTimeline/moveEnemies()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at finals_interactivegame2_fla::MainTimeline/controlSpaceShip()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy2()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy3()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy4()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy5()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy6()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at finals_interactivegame2_fla::MainTimeline/moveEnemies()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at finals_interactivegame2_fla::MainTimeline/controlSpaceShip()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy2()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy3()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy4()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy5()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy6()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at finals_interactivegame2_fla::MainTimeline/moveEnemies()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at finals_interactivegame2_fla::MainTimeline/controlSpaceShip()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy2()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at finals_interactivegame2_fla::MainTimeline/hitEnemy3()
I hope somebody help me because I don't know what to do anymore. I don't have people to help me. My classmates are not approachable and friendly. and this will be submitted in 2 days. So I don't want to fail. I just hope someone.. someone to help me with my game.
You can check my file at Actionscript3 shooter game
Thank you.
Your problem is that your adding all these ENTER_FRAME listeners, but then not removing them before you go to the next frame. So they keep running forever, and they try to reference all your enemy's and container even though those things got unloaded when you changed frames.
To resolve this issue, you need to remove ALL those listeners before you move on to frame 5.
I'd recommend creating a function called checkGameComplete or something like that:
function checkGameComplete():void {
if (txtScore.text == (150).toString()){
stage.removeEventListener(Event.ENTER_FRAME, hitEnemy6); //repeat for ALL enter frame listeners
//rest of the removeEventListeners
gotoAndStop(5);
}
}
Then call that checkGameComplete() on every hitEnemy check.
As an aside, make your code less redundant by making ONE hit enemy method, ONE move method, and ONE enter frame listener:
stop();
var score:int = 0;
var container:MovieClip = new MovieClip();
addChild(container);
stage.addEventListener(Event.ENTER_FRAME, gameLoop); //just the one ENTER FRAME handler
Mouse.hide(); //you only need to call this once, instead of every bullet fire
stage.addEventListener(MouseEvent.CLICK, shootBullet);
function shootBullet(event:MouseEvent):void
{
var thebullet:MovieClip = new bullet(); //calls the bullet symbol from the library
//positions the bullet at the position of your ship
thebullet.x = shipMC.x + 30;
thebullet.y = shipMC.y + 20;
//we add the bullet onto the stage
container.addChild(thebullet);
}
function gameLoop(event:Event):void {
if(!shipMC) return;
shipMC.x = stage.mouseX;
moveEnemy(enemy1, 8);
moveEnemy(enemy2, 4);
moveEnemy(enemy3, 3);
moveEnemy(enemy4, 4);
moveEnemy(enemy5, 4);
moveEnemy(enemy6, 4);
}
function hitEnemyCheck(enemy):void {
if (container.hitTestObject(enemy)) {
//enemy.visible = false; //instead of hiding it, move it back up
enemy.y = -100;
score = score + 5;
txtScore.text = (score).toString();
checkGameComplete();
}
}
function moveEnemy(enemy, amount):void {
enemy.y += amount; //increment the y location of my enemy
if (enemy.y > 600) { //if my enemy is outside the stage
enemy.y = 0; //place it back on the stage
enemy.x = Math.random() * 550; //randomize its horizontal location
}
hitEnemyCheck(enemy);
}
function checkGameComplete():void {
if (txtScore.text == (150).toString()){
stage.removeEventListener(Event.ENTER_FRAME, gameLoop);
stage.removeEventListener(MouseEvent.CLICK, shootBullet); //clean up listeners
removeChild(container); //get rid of this container you created
Mouse.show(); //show the mouse again
gotoAndStop(5);
}
}
I also noticed, that on your frame 5 code (and frame 6 code too), you're calling the wrong function on the next3_btn click:
next3_btn.addEventListener(MouseEvent.CLICK,next2Click); // <-- your calling next2Click instead of next3Click
Should be:
next3_btn.addEventListener(MouseEvent.CLICK,next3Click);
In your hitEnemy6 function and before gotoAndStop(5), you should remove all event listeners that you have already added, to goto to the 5th frame :
stage.removeEventListener(Event.ENTER_FRAME, hitEnemy)
stage.removeEventListener(Event.ENTER_FRAME, hitEnemy2)
stage.removeEventListener(Event.ENTER_FRAME, hitEnemy3)
stage.removeEventListener(Event.ENTER_FRAME, hitEnemy4)
stage.removeEventListener(Event.ENTER_FRAME, hitEnemy5)
stage.removeEventListener(Event.ENTER_FRAME, hitEnemy6)
stage.removeEventListener(Event.ENTER_FRAME, moveEnemies)
stage.removeEventListener(Event.ENTER_FRAME, controlSpaceShip)
stage.removeEventListener(MouseEvent.CLICK, shootBullet)
gotoAndStop(5)
In your moveEnemies function, you should verify every time if your enemy object is not null using a simple if as :
if (enemy1) {
enemy1.y += 8
if (enemy1.y > 600){
enemy1.y = 0
enemy1.x = Math.random() * 550
}
}
You should do that for all your enemy objects (1 -> 6).
I don't know why you created 6 Event.ENTER_FRAME, one for every enemy object !? you can simply do :
stage.addEventListener(Event.ENTER_FRAME, hitEnemy)
function hitEnemy(event:Event):void {
if (container.hitTestObject(enemy1)) {
enemy1.alpha = 0
score = score + 5
txtScore.text = (score).toString()
}
if (container.hitTestObject(enemy2)) {
enemy2.alpha = 0
score = score + 5
txtScore.text = (score).toString()
}
// do the same thing for all your enemy objects ...
}
...

Strange issue with preloader

I have some problem with my preloader.
Preloader Code:
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
var game:MovieClip
var added:Boolean;
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("source.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
function onCompleteHandler(e:Event):void {
game = e.currentTarget.content
game.alpha = 0;
}
function onProgressHandler(e:ProgressEvent):void {
loader.loadBar.setProgress(e.bytesLoaded, e.bytesTotal);
}
addEventListener(Event.ENTER_FRAME, function(e:Event):void {
if(game != null){
if(!added) {
addChild(game);
added = true;
}
if(game.alpha < 1) game.alpha += 0.1;
When I load my game console returns TypeError: Error #1009: Cannot access a property or method of a null object reference.
I turn on permit debugging in game and again load. Now console returns TypeError: Error #1009: Cannot access a property or method of a null object reference.
at main()[C: \Users\Lukasz\Desktop\Flash\rs\main.as:141];
So I checked 141 line and since 141 to 155 I have keyboard events.
stage.addEventListener(KeyboardEvent.KEY_UP, function(e:KeyboardEvent):void {
if(e.keyCode == 32 && moveAvailable) {
startEvent();
}else if(e.keyCode == 32) {
moveAvailable = true;
}
moveSpeed = 70;
});
stage.addEventListener(KeyboardEvent.KEY_DOWN, function(e:KeyboardEvent):void {
if(e.keyCode == 32) {
moveSpeed = 140
if(!startBtn.enb) moveAvailable = false;
}
});
When I get comment /**/ between this code game load correctly.
By the way I try this.parent and parent. instead of stage. but nothing changed :(
Someone have idea on this problem ?
You need check stage before use it
if (stage) {
addStageEvent();
} else {
this.addEventListener(Event.ADDED_TO_STAGE, addStageEvent);
}
function addStageEvent(e:Event = null):void {
//put the 141-155 line code here
}

1009 Error Flash game CS4 AS3

I am coding a flash game in which the ball hits a movie clip object and this takes the user to a new scene.
I have 3 main methods:
movePaddle, moveBall and changeFrame.
it works fine but when i execute the changeFrame method (ball hits movie clip)to go to a new frame i get a whole page of 1009 errors:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FlashGameNEW_fla::MainTimeline/changeFrame()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FlashGameNEW_fla::MainTimeline/movePaddle()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FlashGameNEW_fla::MainTimeline/moveBall()
This is repeated many times.
Any help would be greatly appreciated.
Thanks.
EDIT: with code below
function beginCode():void{
mcPaddle.addEventListener(Event.ENTER_FRAME, movePaddle);
mcBall.addEventListener(Event.ENTER_FRAME, moveBall);
mcBall.addEventListener(Event.ENTER_FRAME, changeFrame);
}
function movePaddle(event:Event):void{
mcPaddle.x = mouseX - mcPaddle.width / 2;
if(mouseX < mcPaddle.width / 2){
//Keep the paddle on stage
mcPaddle.x = 0;
}
if(mouseX > stage.stageWidth - mcPaddle.width / 2){
mcPaddle.x = stage.stageWidth - mcPaddle.width;
}
}
function changeFrame(event:Event):void{
if (mcBall.hitTestObject(Northcote)) {
this.gotoAndPlay(3);
}
}
The problem is you havent instances of mcPaddle and mcBall in frame 3 (For instance, they are not created right now and will be created later). Do check for existing instance:
function movePaddle(event:Event):void {
if (!mcPaddle)
return;
mcPaddle.x = mouseX - mcPaddle.width / 2;
if(mouseX < mcPaddle.width / 2){
//Keep the paddle on stage
mcPaddle.x = 0;
}
if(mouseX > stage.stageWidth - mcPaddle.width / 2) {
mcPaddle.x = stage.stageWidth - mcPaddle.width;
}
}
function changeFrame(event:Event):void{
if (mcBall && Northcote && mcBall.hitTestObject(Northcote)) {
this.gotoAndPlay(3);
}
}

as3 TypeError: Error #1009: Cannot access a property or method of a null object reference. -enterframe

i'm making a simple game and i'm still learning as3
i want to hit test object on the stage , bila1 with omidae1 if hittestobject gotoframe
all the objects are on the stage with corect instancename, maintimeline as3 below
everything works fine but i get the null error
TypeError: Error #1009: Cannot access a property or method of a null
object reference. at
testpeframe_fla::MainTimeline/bling()[testpeframe_fla.MainTimeline::frame1:32]
So the problem is Event.ENTER_FRAME, bling
how can i fix that ?
import flash.events.MouseEvent ;
import flash.events.Event;
import fl.transitions.Tween;
import fl.transitions.easing.*;
btnt.visible = false;
butondrr.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler2);
function fl_MouseClickHandler2(event:MouseEvent):void
{
var myTween:Tween = new Tween(bila1, "x", Strong.easeOut, 500, 700, 1, true);
var myTweenm:Tween = new Tween(bila1, "y", Strong.easeOut, 250, 600, 8, true);
}
stage.addEventListener(Event.ENTER_FRAME, bling);
function bling(event:Event):void
{
if(bila1.hitTestObject(omidae1))
{
omidae1.visible = false;
btnt.visible = true;
}
}
removeEventListener(Event.ENTER_FRAME, bling);
stop();
btnt.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(5);
}
Insert a new frame at frame 1 (move all the other frames up one, frame 1 -> frame 2, etc)
What might be happening is that you're trying to access things before the swf is completely loaded.
In frame one add:
addEventListener(Event.ADDED_TO_STAGE, ready);
stop();
function ready(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, ready);
gotoAndPlay(2);
}

'Error #1009: Cannot access a property or method of a null object reference.' in Flash CS5?

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at src::Game/onClick()
This is the full error^, however it doesn't give me the error on the timeline, but the output, when the flash game is played. Here's the code: http://pastebin.com/FnjWCQJ8 , the error's in line 35 or 49.
Thank you.
Its because blue1,blue2,and blue3 are not defined anywhere.
private function onClick(m:MouseEvent):void{
blue1.startme = true;
blue2.startme = true;
blue3.startme = true;
}
Probably line 31 - your stage instance in the Game constructor. Your MovieClip is probably not on the stage yet. Use an ADDED_TO_STAGE event listener, then add listeners to stage on added to stage handlers.
/*
* Constructor.
*/
public function Game()
{
addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
}
protected function addedToStageHandler(event:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
// Listeners.
stage.addEventListener(Event.ENTER_FRAME, _update);
stage.addEventListener(MouseEvent.MOUSE_DOWN, _mouseAction);
stage.addEventListener(MouseEvent.MOUSE_UP, _mouseAction);
stage.addEventListener(MouseEvent.CLICK, onClick);
// Helicopter.
_helicopter = new Helicopter();
stage.addChild(_helicopter);
}