私のコードであなたの助けを求めたいです。コンパイルは問題ありませんが、以下のコードに到達すると、このエラーがスローされます。
エラー #1009: HiddenObjects_fla::MainTimeline/myFunction()[HiddenObjects_fla.MainTimeline::frame12:9] で null オブジェクト参照のプロパティまたはメソッドにアクセスできません
メイン タイムラインにフレーム 12 がありません。
import flash.display.Sprite;
import flash.events.*;
addEventListener(Event.ENTER_FRAME,myFunction);
function myFunction(event:Event):void {
var lazania:int = 0;
typewriter_piece1.addEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece1);
typewriter_piece1.addEventListener(MouseEvent.MOUSE_UP, stop_drag_piece1);
typewriter_piece2.addEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece2);
typewriter_piece2.addEventListener(MouseEvent.MOUSE_UP, stop_drag_piece2);
typewriter_piece3.addEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece3);
typewriter_piece3.addEventListener(MouseEvent.MOUSE_UP, stop_drag_piece3);
typewriter_piece4.addEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece4);
typewriter_piece4.addEventListener(MouseEvent.MOUSE_UP, stop_drag_piece4);
typewriter_piece5.addEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece5);
typewriter_piece5.addEventListener(MouseEvent.MOUSE_UP, stop_drag_piece5);
typewriter_piece6.addEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece6);
typewriter_piece6.addEventListener(MouseEvent.MOUSE_UP, stop_drag_piece6);
stop();
//typewriter piece 1 = K
function start_drag_piece1(event:MouseEvent):void{
typewriter_piece1.startDrag();
};
function stop_drag_piece1(event:MouseEvent):void{
if (Target1.hitTestObject(typewriter_piece1.Target1_Button)){
typewriter_piece1.stopDrag();
typewriter_piece1.x = Target1.x;
typewriter_piece1.y = Target1.y;
typewriter_piece1.mouseEnabled = false;
typewriter_piece1.mouseChildren = false;
lazania++;
if(lazania == 6){
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece1);
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece1);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece2);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece2);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece3);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece3);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece4);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece4);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece5);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece5);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece6);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece6);
gotoAndStop(1, "Scene 5");
}
//checklazania(lazania);
}
else{
typewriter_piece1.x = 25;
typewriter_piece1.y = 139,95;
typewriter_piece1.stopDrag();
}
};
//typewriter piece 2 = Y
function start_drag_piece2(event:MouseEvent):void{
typewriter_piece2.startDrag();
};
function stop_drag_piece2(event:MouseEvent):void{
if (Target2.hitTestObject(typewriter_piece2.Target2_Button)){
typewriter_piece2.stopDrag();
typewriter_piece2.x = Target2.x;
typewriter_piece2.y = Target2.y;
typewriter_piece2.mouseEnabled = false;
typewriter_piece2.mouseChildren = false;
lazania++;
if(lazania == 6){
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece1);
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece1);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece2);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece2);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece3);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece3);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece4);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece4);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece5);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece5);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece6);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece6);
gotoAndStop(1, "Scene 5");
}
//checklazania(lazania);
}
else{
typewriter_piece2.x = 25;
typewriter_piece2.y = 179,95;
typewriter_piece2.stopDrag();
}
};
//typewriter piece 3 = Π
function start_drag_piece3(event:MouseEvent):void{
typewriter_piece3.startDrag()
};
function stop_drag_piece3(event:MouseEvent):void{
if (Target3.hitTestObject(typewriter_piece3.Target3_Button)){
typewriter_piece3.stopDrag();
typewriter_piece3.x = Target3.x;
typewriter_piece3.y = Target3.y;
typewriter_piece3.mouseEnabled = false;
typewriter_piece3.mouseChildren = false;
lazania++;
if(lazania == 6){
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece1);
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece1);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece2);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece2);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece3);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece3);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece4);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece4);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece5);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece5);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece6);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece6);
gotoAndStop(1, "Scene 5");
}
//checklazania(lazania);
}
else{
typewriter_piece3.x = 25;
typewriter_piece3.y = 219,95;
typewriter_piece3.stopDrag();
}
};
//typewriter piece 4 = P
function start_drag_piece4(event:MouseEvent):void{
typewriter_piece4.startDrag()
};
function stop_drag_piece4(event:MouseEvent):void{
if (Target4.hitTestObject(typewriter_piece4.Target4_Button)){
typewriter_piece4.stopDrag();
typewriter_piece4.x = Target4.x;
typewriter_piece4.y = Target4.y;
typewriter_piece4.mouseEnabled = false;
typewriter_piece4.mouseChildren = false;
lazania++;
if(lazania == 6){
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece1);
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece1);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece2);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece2);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece3);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece3);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece4);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece4);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece5);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece5);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece6);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece6);
gotoAndStop(1, "Scene 5");
}
//checklazania(lazania);
}
else{
typewriter_piece4.x = 25;
typewriter_piece4.y = 259,95;
typewriter_piece4.stopDrag();
}
};
//typewriter piece 5 = O
function start_drag_piece5(event:MouseEvent):void{
typewriter_piece5.startDrag()
};
function stop_drag_piece5(event:MouseEvent):void{
if (Target5.hitTestObject(typewriter_piece5.Target5_Button)){
typewriter_piece5.stopDrag();
typewriter_piece5.x = Target5.x;
typewriter_piece5.y = Target5.y;
typewriter_piece5.mouseEnabled = false;
typewriter_piece5.mouseChildren = false;
lazania++;
if(lazania == 6){
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece1);
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece1);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece2);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece2);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece3);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece3);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece4);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece4);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece5);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece5);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece6);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece6);
gotoAndStop(1, "Scene 5");
}
//checklazania(lazania);
}
else{
typewriter_piece5.x = 25;
typewriter_piece5.y = 299,95;
typewriter_piece5.stopDrag();
}
};
//typewriter piece 6 = Σ
function start_drag_piece6(event:MouseEvent):void{
typewriter_piece6.startDrag()
};
function stop_drag_piece6(event:MouseEvent):void{
if (Target6.hitTestObject(typewriter_piece6.Target6_Button)){
typewriter_piece6.stopDrag();
typewriter_piece6.x = Target6.x;
typewriter_piece6.y = Target6.y;
typewriter_piece6.mouseEnabled = false;
typewriter_piece6.mouseChildren = false;
lazania++;
if(lazania == 6){
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece1);
typewriter_piece1.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece1);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece2);
typewriter_piece2.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece2);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece3);
typewriter_piece3.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece3);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece4);
typewriter_piece4.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece4);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece5);
typewriter_piece5.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece5);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_DOWN, start_drag_piece6);
typewriter_piece6.removeEventListener(MouseEvent.MOUSE_UP, stop_drag_piece6);
gotoAndStop(1, "Scene 5");
}
//checklazania(lazania);
}
else{
typewriter_piece6.x = 25;
typewriter_piece6.y = 339,95;
typewriter_piece6.stopDrag();
}
};
}