/ Published in: ActionScript 3
Expand |
Embed | Plain Text
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; } } }
Comments
Subscribe to comments
You need to login to post a comment.

Please Elaborate. The acid test for me is, can I trace and output a variable from Main through OtherClass? Can I do it with this?
Sure. Just declare the variable in the main document class as public and access it from other class. Questions u can email me. [email protected]