/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package { /* Imports */ import flash.display.Sprite; import com.OtherClass; public class Main extends Sprite { /* Private Properties */ private static var _instance:Main; private var otherClass:OtherClass; /* Constructor */ public function Main() { _instance = this; otherClass = new OtherClass(); } /* Public Methods */ public static function get instance():Main { return _instance; } } } /************ ***************/ package com { /* Imports */ import flash.display.Sprite; public class OtherClass { /* Private Properties */ private var _dc:Sprite; private var _sh:uint; private var _sw:uint; /* Constructor */ public function OtherClass() { _dc = Main.instance; _sh = _dc.stage.stageHeight; _sw = _dc.stage.stageWidth; } } }