Riddle Me This? Is PlayerType “StandAlone” == “External”

Ok so now i’m confused… I’m working on a pure actionscript project in Flex 3 whereby i’m using an RSL (Runtime Shared Library) which contains some visual assets either as graphic only or as a functioning class with associated graphic. I want to test my RSL is loading ok from within Flex IDE but it always gives me a security sandbox error unless i test from a remote server… fair enough (if a little bit annoying). Surely there’s a better way to do this during development…answers on a postcard please!

What i really would like from all this is to be able to find out what the difference is between “Standalone”, “External”, “Plugin” & “ActiveX” player types and how each of these affects the current sandbox. Is “External” a Flash IDE only type? I ask because i can never get this type of player when using Flex. In Flex i can only ever get “Standalone” or “Plugin”/”ActiveX” (if using an html wrapper). Yet if i publish the same source using Flash CS4 i always get “External”. If i can get “External” in Flex does it grant access to remote data, rsl’s etc and allow a local swf any more abilities over a “Standalone” version?

I spent ages yesterday trying to find examples and info about this but nothing i discovered completely answered my question. Every single example of loading and accessing an RSL used a relative (local) path to the loading swf. In the end i did manage to get my RSL to load from a different domain but like i said my main swf has to be served remotely otherwise in the Flex IDE i get:

Error #2142: Security sandbox violation: local SWF files cannot use the LoaderContext.securityDomain property. file:///C:/Documents and Settings/USER/My Documents/Flex Builder 3//bin-debug/DocumentClass.swf was attempting to load http://www.mysite.com/shiz/SharedAsset.swf.

If anyone has experience using this sort of setup please help…


11 responses to “Riddle Me This? Is PlayerType “StandAlone” == “External”

  • mattjpoole

    Why dont you just compile your assets .fla as a SWC and include it in your AS project class path?

    This will expose any assets without the need for a RSL… or do you need the assets to load at runtime?

    • Doug

      Needs to be runtime only as we’re loading in a swf that contains custom button skins and graphics on a per customer basis.

    • Doug

      There might also be a use case for adding specific functionality depending on the users system. Kind of like the plugin idea you have with IPlayer except we’ll load these non core as classes on demand.

  • TJ Downes

    RSLs are designed to be used over the HTTP protocol and therefore can’t be used when the path is a physical file path. They require a domain, and since your local file path does not have the capability to pass domain info any attempts to use it in this manner are going to result in your error.

    I recommend setting up a local http server on your test machine for development if you are using RSLs, otherwise you may need to consider including it as an external SWF/SWC until you are ready to deploy to your staging server.

  • JesterXL

    When you have security issues like this:

    1. copy the file path of your html/swf
    2. go here
    3. choose “Add Location” from the drop down and paste in the file path of your swf; if it’s an html file, replace “.html” with “.swf”
    4. close your browser (don’t have too, but some people have references to SWF’s they don’t know about)
    5. re-run your app

  • julien

    Standalone = The swf file running in Flash Player itself (FlashPlayer.exe on windows, FlashPlayer.app on osx, or flashplayer on lnx) … pretty sure you should get ActiveX or Plugin using FlexBuilder, and External using Flash IDE, the differences are explained in the Flex documentation,

  • Mike Morearty

    The “External” player is player that is embedded within apps like Flash Professional, Photoshop, Acrobat, and so on.

    “Standalone” is when you run flashplayer.exe. “ActiveX” is Internet Explorer, and “Plugin” is all other web browsers.

    As for how those affect sandboxes, I don’t have a good grasp of those details, but the main thing to keep in mind is, if you are deploying to a web page, then your users will all be getting “ActiveX” or “Plugin”, and those two have essentially identicaly security models (probably exactly identical security models, but I’m not experienced enough in such things to claim that with certainty).

    – Mike Morearty, Flex Builder dev team

  • Doug

    Thanks everyone for the feedback!

    So can anyone confirm if i should be seeing “External” in Flex. If so i guess something has corrupted my setup – my next question is where does Flex look to find Flash Player? Is there a setting in the preferences where i can change this? Flex will only ever launch FP from a path to my desktop if i’m publishing without using a html wrapper.

  • Joeflash

    You shouldn’t need to use a file server with your RSLs when run locally if you’re using a relative file path, i.e. “../assets/flashRSL.swf”

    Compiling from the Flash IDE uses the standalone Flash Player, or Flash.exe to display your SWF. The sandbox I believe is “Local with Networking,” which enables you to access HTTP addresses from a SWF located on the local file system.

    Flex should run the SWf from your browser. Playing the SWF in your browser Flash Player should be the same, unless you’re trying to access an absolute file path, in which case you’ll have to go to the Security Manager app and allow those local folder locations for the Flash Player plugin, as previously stated. This should only be necessary for testing, as the app will conform to a slightly different security sandbox when loaded from a server, which is another good reason to do server testing in between smaller local unit tests.

  • Andres

    The issue is that you cannot import an external swf located on the web (in a REMOTE sandbox) into the SecurityDomain of your local swf. The error says that you tried to specify the securityDomain that you want the remote swf to go into, but you cannot do that when dealing with a parent swf running in the local sandbox. You can only do that when the parent swf is also in a remote sandbox (ie http://www.server.com/parent.swf).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: