2014-10-15 2 views
-1

Так что я пытался выяснить эту ошибку за последние два часа, я пробовал исследовать весь интернет для ответа, и до сих пор мне не удалось это понять.Ошибка 1009 ActionScript Flash CC

Кто-нибудь сможет мне помочь! Это мой код:

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); 



    } 
} 

И это ошибка:

[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. 

Я понял, что это что-то делать с x_mc и o_mc видеофрагменты, но я понятия не имею, о чем идет речь так как я новичок в скрипте действий.

Большое вам спасибо!

+0

Просто предположение: один из объектов, на которые ссылается ваш скрипт, отсутствует (не существует) в кадре 179. Проверьте свои временные рамки. – Craig

ответ

1

x_mc и o_mc не присутствуют на фреймах или не имеют имени экземпляра. Убедитесь, что оба объекта имеют правильное имя экземпляра. После этого проверьте это для exoHit_mc и exeHit_mc.

Смежные вопросы