2 Replies Latest reply on Sep 12, 2010 7:05 AM by DavideBarranca

    Embed an extension within another one

    DavideBarranca

      Hello,

      I know that it's possible to embed a Javascript (instruction in this cookbook) within the extension's swf.

      I also know that an extension can call another extension (info in the Extension Builder documentation here).

       

      So, would it be possible to embed the swf of the extension A within the extension B and be able to call it?

       

      Thanks in advance,

       

      Davide

        • 1. Re: Embed an extension within another one
          James Boag Adobe Employee

          Hi Davide,

           

          When you say embed an extension, what exactly do you mean? You can use the SWFLoader object to create modular SWFs which will be loaded into your main extension, and all of these should have access to the same HostObject information that your host SWF does.

           

          You could also load a SWC into your extension via compile time linking, if you wanted to share code between two extensions. You can connect this to the apedelta and CSAW SWCs in the same way as your initial extension, in order to get the same level of application interaction.

           

          In terms of calling a loaded SWF, there are a number of ways to go about it. With the SWFLoader, though, you can call functions at the top level of the child application directly, which is probably the easiest solution. For more on the SWFLoader, see http://livedocs.adobe.com/flex/3/html/help.html?content=controls_15.html

           

          Best,

           

          James

          • 2. Re: Embed an extension within another one
            DavideBarranca Level 1

            Hello James,

            actually my needs are very basic: I've a Ps panel with some stuff in it and an "about" button - which used to be a simple alert() in JS with some text.

             

            Now I'd like to make the button open a bigger window with possibly more stuff (images, links and so on); so I've thought to pack this into a single SWF, embed it, and launch it from the main Ps extension.

            (So I don't need it to be embedded and showed like an icon in the panel, for instance).

            One problem could be - and this happens with modal dialogs I guess - that the panel size (width and height) is a limit: if my Ps panel is 400x200 pixels, it can't contains an "about" window 500x600.

             

            "Invoking external resources" in the CS Extension Builder guide could be a possibility, but to create a separate extension just to hold a big info window seems to me strange. Is there in your opinion a better way to manage this?

             

            Thanks in advance,

             

            Davide

             

            UPDATE ----------

            I've been able to find a solution, namely an info.mxml component (mx:Window), that I launch with a simple function:

             

            public function myDoAbout():void{

            var window:Window = new info();

            if(window){

            window.type = CSXSWindowType.MODAL_DIALOG;

            window.width = 400;

            window.height = 600;

            window.resizable = false;

            window.open();

            }

            }