Author Message

Posted: Thu May 14, 2015 2:54 pm   Post subject: Error loading local SWFs

Issue
I'm receiving the following error when attempting to load a SWF using a snippet of sample code:

Code:
Error: The loaded SWF file is not a presentation created with iSpring Pro
   at classes::iSpringTest/onMovieLoaded()[<path>\iSpringTest.as:54]
*** Security Sandbox Violation ***
SecurityDomain '<path>/swf/behavior.swf' tried to access incompatible context 'app:/iSpringTest.swf'

The SWF I'm trying to load is stored locally. It was generated using iSpring, and actually loads just fine when using the source FLA provided in samples. I'm also able to compile and execute the provided sample without issue which is why this issue is a little perplexing.

I'm guessing there's something simple & obvious that I'm overlooking.

Here's the actual code I'm running, ripped from one of the samples:
Code:
public function iSpringTest() {
   m_loader = new Loader();
         m_loader.contentLoaderInfo.addEventListener(Event.INIT, onMovieLoaded);
   //
   var appDomain:ApplicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
   var context:LoaderContext = new LoaderContext(false, appDomain);
   m_loader.load(new URLRequest(File.applicationDirectory.nativePath + "/swf/behavior.swf"), context);
}
      
private function onMovieLoaded(e:Event):void {
   var contentInfo:LoaderInfo = LoaderInfo(e.target);
   m_playerView = contentInfo.content;
         
   // Query IPresentationPlayerContainer interface of the loaded SWF file
   m_playerContainer = m_playerView as IPresentationPlayerContainer;
   if (m_playerContainer == null)
   {
      // The loaded file is not an iSpring presentation
            throw new Error("The loaded SWF file is not a presentation created with iSpring Pro");
   }
         
   // Wait for the player to initialize
         //m_playerContainer.addEventListener(PlayerContainerEvent.PLAYER_IS_AVAILABLE, onPlayerAvailable);
         
   // Add the presentation to stage
         addChild(m_playerView);
         
   trace("contentInfo: " + contentInfo);
   trace("m_playerView: " + m_playerView);
   trace("m_playerContainer: " + m_playerContainer);
}


Environment
Flash Pro CS6
iSpring Suite DX 7.1.0 (trial)
AIR 17


Update:
Looks like this error occurs when using "File.applicationDirectory.nativePath" in the file path. Using a relative path instead seems to be working (i.e. "/swf/movie.swf")


Profile profile test

Posted: Thu May 14, 2015 5:40 pm   Post subject: Re: Error loading local SWFs

Thank you for the post!
I think you can try to add the following code to LoaderContext:
SecurityDomain.currentDomain()

I hope this helps you to resolve the issue.


Profile profile test
Display posts from previous:  Sort by  

  


Who is online
Who is online In total there are 6 users online :: 2 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 108 on Thu Nov 21, 2013 3:41 pm

Registered users: Baidu [Spider], Bing [Bot]