I’m still not understanding how to access the stage within a class.
basically all I want to do is get the midpoint with stageWidth and stageHeight but I keep getting this error:
Cannot access a property or method of a null object reference.
code as it stands:
package com.mysite.mouse{
//imports
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.MouseEvent;
import flash.geom.Point;
//class
public class ZoomToPoint extends MovieClip {
//variables
private var clip:MovieClip;
private var scp:Point;
//constructor
public function ZoomToPoint($clip:MovieClip) {
clip = $clip;
clip.buttonMode = true;
clip.addEventListener(MouseEvent.CLICK, clickHandle);
}
//handler
private function clickHandle(evt:MouseEvent):void {
scp = new Point(stage.stageWidth/2,stage.stageHeight/2);
}
}
}