Jump to content
Search Community

darloScott

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by darloScott

  1. The following post helped me get to the MovieClip inside of the external swf I am loading: http://forums.greensock.com/viewtopic.php?f=6&t=4242&p=16820&hilit=swf+movieclip#p16820 However I want to play the timeline of the movieclip in an external swf, so I attempt this by using _bgd = loader.getSWFChild("TestClip") as MovieClip; _bgd.gotoAndPlay(2); However all that happens is the Clip goes to frame 2 but does not play it's timeline (there is no stop(); in frame 2), it appears the clip just takes a snapshot of that frame. If I then try to manipulate the timeline with MouseEvents etc this has no effect. Any help would be appreciated.
  2. The adobe decoder is available on Mike Chambers github account here: https://github.com/mikechambers/as3corelib I never thought of using the DataLoader to get the text, I'm going to try the same method on a new app I'm working on.
  3. Hi, I'm having issues with createing multiple SWFLoaders inside LoaderMax, I can load two SWFLoaders into LoaderMax fine in the same method like this: _appDomain = new ApplicationDomain(); _loader = new LoaderMax({ name:"themeLoader", onComplete:completeHandler, autoDispose:true}); _loader.append(new SWFLoader("Views.swf", {name:"interfacePackage", context:new LoaderContext(false, _appDomain), autoDispose:true, autoPlay:false})); _loader.load(); trace("load second theme"); _loader.append(new SWFLoader("ViewsTwo.swf", {name:"interfacePackageTwo", context:new LoaderContext(false, _appDomain), onComplete:getContentSecond, autoDispose:true, autoPlay:false})); _loader.load(); BUT as soon as I want to load the second SWF on a MouseEvent it doesn't load. The code is below: private function loadAssets():void{ _appDomain = new ApplicationDomain(); _loader = new LoaderMax({ name:"themeLoader", onComplete:completeHandler, autoDispose:true}); _loader.append(new SWFLoader("Views.swf", {name:"interfacePackage", context:new LoaderContext(false, _appDomain), autoDispose:true, autoPlay:false})); _loader.load(); var btn:MovieClip = new MovieClip(); btn.graphics.beginFill(0xff9900); btn.graphics.drawRect(0,0,100,100); btn.graphics.endFill(); addChild(btn); btn.addEventListener(MouseEvent.CLICK,loadSecondTheme); } private function loadSecondTheme(e:MouseEvent):void{ trace("load second theme"); _loader.append(new SWFLoader("ViewsTwo.swf", {name:"interfacePackageTwo", context:new LoaderContext(false, _appDomain), onComplete:getContentSecond, autoDispose:true, autoPlay:false})); _loader.load(); } Has anyone had the same problem? Any help would be appreciated. I have attached the simple test files I have created, hopefully there is a simple solution. Thanks, Scott
  4. Thanks for taking a look, sorry you couldn't get the example to work. I have uploaded an attachment which is a very simple, stripped down version, which should work fine if you just compile main.fla. If you see line 100 of Main.as you'll see the comment which will toggle between loading in seperate domains to the main application domain. It sounds like you've probably already identified the issue I am having, when run locally the player is blocking cross-scripting so the classes from the external swf's cannot be accessed from the StyleManager in the main application domain. It's not ideal, but I suppose I could load the external swf's into the main application domain until I need to deploy the application and then I can switch to seperate domains and test on the server. Thanks again for your help, it's been driving me crazy. Scott
  5. Hi, This is linked to my last post viewtopic.php?f=6&t=4484 but I thought it was unique enough for a seperate thread. I have found a number of posts with similar issues but non the same as mine so sorry for any cross over in content. The problem is simple, I'm loading a swf which contains MovieClips,each of which follow an interface called IStyleable. I load the swf into the main application and access the Class insisde the swf by using get Class: var ClassReference = _loader.getClass("HeaderBar"); _mainHeader = new ClassReference(); addChild(_mainHeader); _mainHeader.y = 200; As the main application uses a singleton style manager, it sets up the styles and automatically styles any classes which use the IStyleable interface. So as soon as the _mainHeader is added it get's styled successfully. Now for the problem: This all works fine when I load the external swf into the same domain as the main application: _loader = new SWFLoader($path, {onComplete:completeHandler}); However when I load the swf from it's own domain (so that I can unload it succesfully, see previous post viewtopic.php?f=6&t=4484) the compiler gives me sandbox errors and an the debug message points to the greensock.loading.SWFLoader?_rslAddedHandler. I have tried to set the loader's context to SecurityDomain.currentDomain so that the loaded swf's security domain is the same as the main application but this only created more sandbox errors. After looking on various forums I have tried many different solututions, but with no luck. I believe that when the swf is loaded form the seperate application domain the main application can access the classes inside the swf but cannot access it's methods (which I need as the movieclip needs to be styled using the StyleManager in the main application). I have posted my source files from my FDT project, it uses robotlegs and other swc's but the paths are relative and should work fine. In main.as, if you comment out line 73 and uncomment 75 the application will load as expected, but as it is, the sandbox issues occur. Ideally I want the loaded swf to behave as if it is in the same domain as the main application, but i'm sure that is easier said than done. UPDATE The sandbox issue doesn't appear to occur when running in the browser on the local sever (http://localhost/PP3/Main.html) However when I publish from FDT to the local server folder I get the errors. I really don't want to be running my application in the browser to get it to work and want to debug within FDT without all these sandbox errors. Any help with this would be greatly appreciated, Scott
  6. Hi, I had a quick look around and couldn't find anyone having the same problem but sorry if this has been covered already... Scenario I'm loading a swf file into a new application domain which contains MovieClips which style the application, when the user selects a new theme I want to unload this swf and load a new swf into a new application domain which contains new theme MovieClips to change the appearance of the application. Problem 1. So i create a new application domain: _newDomain = new ApplicationDomain(); _appContext = new LoaderContext(false, _newDomain); 2. I then load the swf into it: _loader = new SWFLoader("Squares.swf", {onComplete:completeHandler,context:_appContext}); _loader.load(); 3. I then add an item from the loaded swf to the stage: var ClassReference:Class = _newDomain.getDefinition("Square") as Class; _square = new ClassReference(); addChild(_square); 4. When the user wants to swap a theme I unload the first loaded swf: removeChild(_square); _square = null; _loader.unload(); _loader.dispose(); 5. Here is where the problem lies: I test that the swf has been unloaded successfully by trying to add another instance of the square from the swf that should no longer exsist, I didn't expect the ClassReference to be able to access the square but it does....another instance of the Square is added. So the question is how do I get rid of the swf file succesfully? I don't have any listeners, timers etc setup in the main movie which would restrict the swf being eligible for garbage collection so I'm lost as to what is going on. var ClassReference:Class = _newDomain.getDefinition("Square") as Class; _newSquare = new ClassReference(); addChild(_newSquare); I have added a little example as an attachment, you may need to point the fla to the greensock swc using file>actionscript settings>library path: Any help would be appreciated! Thanks, Scott
×
×
  • Create New...