actionscript 3 - Globally accessing the main MovieClip -
q: there way main movieclip (i.e. entry point of app) globally? means: object not beingness attached film clip (yes: know can access main film clip through ´root´ property parting existing film clip).
what need retrieve film parameters i'm using class not related movieclips @ all, cannot have access standard root property.
sure can. create static function:
//code in main class: private static var _main:main; //assuming document class called main //set var in constructor of main public function main() { _main = this; //other code } public static function getinstance():main { homecoming _main; } //code in custom class: private function dosomething():void { var m:main = main.getinstance(); } actionscript-3
No comments:
Post a Comment