Вот вся моя отлаженная ошибка:
Car initiated: [object MovieClip]
Wheel initiated: [object MovieClip]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.George.MegaAmazingApp.Components::Wheel/clickHandler()[C:\Documents and Settings\reithg\My Documents\Classes\com\George\MegaAmazingApp\Components\Wheel.as:24]
[UnloadSWF] GeorgesMegaAmazingApp.swf
Test Movie terminated.
Car.as:
package com.George.MegaAmazingApp.Components
{
import flash.display.MovieClip;
public class Car extends MovieClip
{
public var carObj:MovieClip;
public function Car(carObj:MovieClip)
{
trace("Car initiated: " + carObj)
this.carObj = carObj;
}
public function Accelerate(speed:Number)
{
carObj.y -= speed;
}
}
}
Wheel.as
package com.George.MegaAmazingApp.Components
{
import flash.display.Stage;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.MovieClip;
public class Wheel extends Car
{
public var rotated:Number;
public var wheelObj:MovieClip;
public function Wheel(wheelObj:MovieClip, carObj:MovieClip)
{
super(carObj);
this.carObj = carObj;
this.wheelObj = wheelObj;
trace("Wheel initiated: " + wheelObj);
wheelObj.addEventListener(MouseEvent.CLICK, clickHandler);
}
private function clickHandler(event:MouseEvent):void
{
stage.addEventListener(Event.ENTER_FRAME, super.Accelerate(2));
}
}
}
и мой SWF, который его инициирует:
import com.George.MegaAmazingApp.Components.*;
var wheelObj:Wheel = new Wheel(this.wheel,this.car);
Кто-нибудь знает, что случилось?