3 Replies Latest reply on Sep 3, 2012 6:30 AM by benjaminmueller_burda

    New window that resizes content

    jordidy

      Hi,

       

      how can I open a <mx:Window> component inside photoshop with CSXSWindowType.PANEL that resizes its contents?

      I am trying to detect the windowResize event but it doesn't seem to work.

       

      That's the code for ExtraLayers.mxml

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Window
                xmlns:csxs="com.adobe.csxs.core.*" 
                xmlns:mx="http://www.adobe.com/2006/mxml" 
                layout="absolute" 
                minWidth="300" 
                minHeight="300"
                width="100%"
                height="100%"
                windowResize="resizeHandler()"
                  windowComplete="init()"
                >
        <mx:Script>
               <![CDATA[
        
                  public function init():void
                  {
                       trace("CSXS Window init");
                  }
        
                  public function resizeHandler():void
                  {
                       trace("RESIZED");
                   }
               ]]>
        </mx:Script>
        
        
        <mx:VBox>
        
             <mx:Button name="close" click="this.close()" />
        </mx:VBox>
      </mx:Window>
      
      

       

      and this is how I am trying to open it:

       

      if (!LAYERS_PANEL) {
           LAYERS_PANEL = new ExtraLayers();
           if (LAYERS_PANEL) {
                LAYERS_PANEL.type = CSXSWindowType.PANEL; 
                LAYERS_PANEL.title = "Extra Layers"; 
                LAYERS_PANEL.width = 300;
                LAYERS_PANEL.height = 500;
                LAYERS_PANEL.resizable = true;
           }
      }
                                               
      if (LAYERS_PANEL) {
           LAYERS_PANEL.open(true);
           LAYERS_PANEL.addEventListener(Event.CLOSE, function():void { LAYERS_PANEL = null;});
      }
      
      
        • 1. Re: New window that resizes content
          benjaminmueller_burda Level 1

          Hi,

           

          I haven't done any Photoshop Plug-In Development but "some" for InDesign.  I still do not understand what you try to achive? Other than that you have a "Syntax Error" in your code

           

           

          LAYERS_PANEL.addEventListener(Event.CLOSE, function():void { LAYERS_PANEL = null;});

           

          should be

           

           

          LAYERS_PANEL.addEventListener(Event.CLOSE, function() {

                                                                      LAYERS_PANEL = null;

                                                                 }

                                        );

           

          you do not append the "return type" like in Java/Actionscript to an Extendscript function declaration.

           

          Are you using FlashBuilder for this? Barebones CSSDK with an editor?

           

          would like to help

           

          regards

           

          b.

          • 2. Re: New window that resizes content
            jordidy Level 1

            Hi Benjamin,

             

            thanks for the reply.

            Sorry if the code didn't show what my problem is.

            What I am trying to accomplish is to open a new window type PANEL that resizes its content whenever the window is resized.

            The code for the opening window is the ExtraLayers.mxml and the way I am opening is the other code I pasted.

             

            Right now I can open the new window (ExtraLayer.mxml) but whenever I drag the corner to resize it the content stays at the same size.

            I tried firing the onResize event with no success (the handler doesn't get executed)

             

            Hope it's clearer now. Sorry for the confusion and thanks for your help

            • 3. Re: New window that resizes content
              benjaminmueller_burda Level 1

              hi,

               

              maybe I am just too stupid today .. here is how I would solve it

               

              PStest.mxml (the panel)

               

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

              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" historyManagementEnabled="false"  applicationComplete="colorSync()" xmlns:local="*">

                  <mx:Script>

                      <![CDATA[

                         

                         

                         

                          [Bindable]

                          private var hostName:String = HostObject.mainExtension;

                         

                          public function colorSync():void{

                             

                          }

                         

                      ]]>

                  </mx:Script>

                 

                  <local:TestWindow left="0" right="0" top="0" bottom="0">

                     

                  </local:TestWindow>

                 

              </mx:Application>

               

              and your window

               

              TestWindow.mxml (the window in the panel)

               

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

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

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

                        xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">

                  <fx:Declarations>

               

                  </fx:Declarations>

              </s:Window>

               

              The size of an embedded "window" (even though Adobe doesn't recommend to use the baseclass "window") can be easily controlled via the parent Application (the panel).  When you resize the panel the window automatically gets resizes as well through "left / top / right / bottom" ..

               

              I hope I didn't completely misunderstand your problem.

               

              regards

               

              b.