Jump to content


  • Posts

  • Joined

  • Last visited

Genis200's Achievements


Newbie (1/14)



  1. Hi there! I am using the GreenSock LoaderMax in order to load a SWF. My dilemma is that I'd like to be able to get a variable defined in the Main class of the SWF file. The problem is, this variable is a private variable. I have tried setting the variable by doing loader.rawContent.variable, but I am unable to get or set this variable. Is there a way to do this without changing the variable to public, etc? I'm sorry if this is a noobish question, I'm not very familiar with ActionScript 3. My code: My loader class: package { import flash.display.*; import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import flash.events.Event; public class AS3Loader extends Sprite { var cpLoader; var Content; var mainContext; public function AS3Loader() { this.cpLoader = new SWFLoader("http://mywebsite.com/mySWF.swf", {onComplete:onfinish}); addChild(this.cpLoader.content); this.cpLoader.load(); } function onfinish(event:LoaderEvent):void { Content = this.cpLoader.rawContent; mainContext = Content.mainContext } } } And the source of the class that I want to load: package com.swf.main { import flash.display.MovieClip; import flash.events.Event; import flash.display.StageScaleMode; import com.swf.check; public class Main extends MovieClip { private var mainContext:MainContext; public function Main() { addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStageHandler); } private function onAddedToStageHandler(_arg1:Event):void { if (_arg1.target == this) { removeEventListener(Event.ADDED_TO_STAGE, this.onAddedToStageHandler); this.init(); }; } private function init():void { stage.scaleMode = StageScaleMode.SHOW_ALL; check.ALLOW_DOMAINS(); this.mainContext = new MainContext(this); } public function setWrapperView(_arg1):void { this.mainContext.setWrapperView(_arg1); } } }