4 Replies Latest reply on Jun 24, 2010 1:19 PM by mattparisi

    Loading plugins over http:// or file://


      Hi guys, I've recently decided to change the plugin architecture of my player to load plugins dynamically over http:// or file://.  I'm finding that none of my plugins load successfully.  When testing locally, I use file:// and the plugin swf resides in the same folder as my main application swf.  Each of my plugins is a separate library project in which i link the swc to my main player app.  Then in the project properties of my player app I set each plugin library link type to RSL, and hence a swf is generated.  This is the swf I am using as my plugin swf.  Is this the proper/best way to accomplish what I'm setting out to do?  If so, any insight as to why they might be failing?  It's very difficult to debug since there's no interesting information in the plugin load error.


      Thanks in advance.



        • 1. Re: Loading plugins over http:// or file://

          Hi Matt,


          If you are loading the plugins dynamically, there is no reason to add a reference to the plugin at compile time. Simply load the swf using the file or http protocol.


          Typically what plugin developers do, if they are using Flex Builder, is create an AS3 project, which outputs a swf.


          You can test the loading of your plugin by using this sample app:




          Just type the URL of your plugin into the input box and click "Load Plugin". Since remote SWFs cannot access local files, you won't be able to use the file protocol, but you could copy your plugin swf to a web server or localhost and load it from there.  Or you can grab the source for that sample app from the OSMF source and run it locally.  That sample can load plugins dynamically or statically. But for static loading, it needs a reference to the plugin's PluginInfo class, which you'll see in the source.  To load dynamically, all it needs is a url to a swf.


          - charles

          • 2. Re: Loading plugins over http:// or file://
            mattparisi Level 1

            That's all awesome information.  Thank you for clarifying. 


            I do have one more question.


            Previously I was passing in metadata to specific plugins from my player app.  How would I go about doing the same with dynamicall loaded plugins since I don't have reference to the PluginInfo classes? 





            • 3. Re: Loading plugins over http:// or file://
              charles_newman-V6Q5sa Level 1

              Well, the metadata can be added to the plugin resource and/or the media resource.  You don't need the PluginInfo class to do that. Although some plugin developers will put constants for the metadata namespace and keys in the PluginInfo class.  What I've done in the past for people who want to load my plugin dynamically, or for plugins I don't want to hand out source for, is to create a library (swc) that contains a string utils class containing these constants and the plugin is built against that.  The player project references the SWC and this prevents the player devs from having to type in strings for the metadata namespace and key constants.


              - charles

              • 4. Re: Loading plugins over http:// or file://
                mattparisi Level 1

                That's exactly what i was looking for.