You can use parent if your class is added as a child, and call functions in it’s parent like thus;
document class:
package {
import flash.display.Sprite;
import com.subclass;
public class dclass extends Sprite {
public function dclass():void {
var s:subclass = new subclass();
addChild(s);
s.init();
};
public function helloWorld():void {
trace("Call!");
};
};
};
subclass.as
package com {
import flash.display.Sprite;
public class subclass extends Sprite {
public function subclass():void {
};
public function init():void {
dclass(parent).helloWorld();
};
};
};
You can call it from within a class as long as you have a reference to an instance upon which the function is defined.
What’s up with the code that you posted? You didn’t really put it in any context, so am I supposed to guess that parent is the main timeline? If so, you can cast it to MainTimeline, or to whatever you named your timeline class.
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.getTimer;
public class Buggy extends MovieClip {
public var moving = 'no';
public var bitmapLevel:Bitmap = new Bitmap();
//Fire rate is in frames
public function Buggy() {
//Rotate them so they fill in the opposite direction
trace(bitmapLevel.bitmapData);
}
}
}