3 Replies Latest reply on May 24, 2011 3:20 PM by Peter Blazejewicz

    Change Encore Project into a adobe air desktop application with password

    Justin_19

      Good afternoon,

      I am trying to find a a way that i can change or inport a Encore project into a adobe air desktop application so that a can password protect it. I have a training simulator built in Encore that has a large number of menus and videos that i would like to tern into a tesk top application that i can password protect. Encore out puts this as a swf file. Is there any way to do this? I have bin looking around an the web and can't seem to find any information on this kind of problem. Any help would be greatly appreciated.

      Many thanks,

      Justin

        • 1. Re: Change Encore Project into a adobe air desktop application with password
          Peter Blazejewicz Level 4

          Hi Justin,

           

          is that all wrapped into single Flash movie (.swf)? If so you could try to embed that movie into Air runtime host application, see below extremely simple demontration of that:

           

           

          <?xml version="1.0" encoding="utf-8"?>

          <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                                      xmlns:s="library://ns.adobe.com/flex/spark"

                                      xmlns:mx="library://ns.adobe.com/flex/mx">

               <!-- ui -->

               <s:SWFLoader width="100%" height="100%" source="@Embed(source='MyApplication.swf')"/>

          </s:WindowedApplication>

           

           

          "MyAppllication.swf" is Flash movie created for Flash runtime (e.g. with your 3rd party tool or Flash CS or Flash Builder). When building Air application it will be embedded into final .swf. It needs to be copied into e.g. "src" folder so it is accessible for AIR compiler (as in above sample).

          note: the embedded content does not know that it is embedded into other hosting movie - it's self contained.

          try above solution and let us know,

          regards,

          Peter

          • 2. Re: Change Encore Project into a adobe air desktop application with password
            Justin_19 Level 1

            Thank you for your help Peter

                 Well it does have some source files that go a long with .swf file that it uses. So what i did was create a new project in flash builder 4 and then i changed the .mxml file to

             

            <?xml version="1.0" encoding="utf-8"?>

                 <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                                                       xmlns:s="library://ns.adobe.com/flex/spark"

                                                       xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:ns1="*">

             

                 <mx:SWFLoader x="0" y="0" width="100%" height="100%" source="flashdvd.swf"/>

             

                 <!-- ui -->

            </s:WindowedApplication>

             

            but every time i try and run the application i get this error

             

            SecurityError: Error #3207: Application-sandbox content cannot access this feature.

            at flash.system::Security$/allowsDomain()

            at com.adobe.flashdvd::FlashDVD()[/p4/encore/depot/Main/third_party/Metaliq/classes/com/adob e/flashdvd/FlashDVD.as:73]

             

            It seems to not be able to access the sources files even with them copyed into the src file. Do i have to include them some how?

            Thank you so much for you help!

            Justin

            • 3. Re: Change Encore Project into a adobe air desktop application with password
              Peter Blazejewicz Level 4

              Hi Justin,

               

              ok, assuming that your external SWF tries to access some hosting application context (methods/properties) you could try:

               

               

              <?xml version="1.0" encoding="utf-8"?>

              <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                                          xmlns:s="library://ns.adobe.com/flex/spark"

                                          xmlns:mx="library://ns.adobe.com/flex/mx"

                                          applicationComplete="applicationCompleteHandler(event)">

                   <fx:Script>

                        <![CDATA[

                             import mx.controls.Alert;

                             import mx.events.FlexEvent;

                             //

                             private var loader:URLLoader = null;

                             //

                             protected function applicationCompleteHandler(event:FlexEvent):void

                             {

                                  loader = new URLLoader();

                                  loader.dataFormat = URLLoaderDataFormat.BINARY;

                                  var url:String = "MyApplication.swf";

                                  loader.load(new URLRequest(url));

                                  loader.addEventListener(Event.COMPLETE, loaderCompleteHandler);

                                  loader.addEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler);                   

                             };

                             //

                             protected function loaderCompleteHandler(event:Event):void

                             {

                                  // allow cross-scripting in case loaded content tries to access

                                  // that context properties or methods

                                  var context:LoaderContext = new LoaderContext();

                                  //

                                  context.allowCodeImport = true;

                                  swfLoader.loaderContext = context;

                                  swfLoader.load(loader.data);

                                  cleanup();

                             };

                             protected function loaderErrorHandler(errorEvent:IOErrorEvent):void

                             {

                                  mx.controls.Alert.show(errorEvent.text, "ERROR");

                                  cleanup();

                             };

                             private function cleanup():void

                             {

                                  loader.removeEventListener(Event.COMPLETE, loaderCompleteHandler);

                                  loader.removeEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler);

                                  loader = null;

                             }

                            

                        ]]>

                   </fx:Script>

                   <!-- ui -->

                   <s:SWFLoader width="100%" height="100%" id="swfLoader"/>

                   <!-- -->

              </s:WindowedApplication>

               

               

              See that doc for some details "allowCodeImport":

              http://www.adobe.com/devnet/flashplayer/articles/fplayer10_1_air2_security_changes.html

              note: I'm not sure if that would 100% work. I don't know what Encore authored .swf really do, for that you could ask on Encore forum:

              http://forums.adobe.com/community/encore/encore_general

               

              regards,

              Peter