4 Replies Latest reply on Feb 6, 2011 3:56 AM by Pablo Souza

    mxml and action script

    KiarasH.Mozafari

      Hello Everyone,

      how can I make panel component from spark package draggable ?

       

      <sx:Panel    x="118" y="89" width="564" height="234" id="addPanel" title="sss" textAlign="right" enabled="true" >

      </sx:Panel>

       

      thanks in advance ,..

        • 1. Re: mxml and action script
          Pablo Souza Level 3

          I believe you are looking for this:

           

          http://flextip.blogspot.com/2009/09/draggable-spark-panel.html

           

          Let me know if it helps you!

           

           

          Regards,

          Pablo Souza

          • 2. Re: mxml and action script
            Pablo Souza Level 3

            You can also use a Spark TitleWindow instead of a Spark Panel.

             

             

            <?xml version="1.0" encoding="utf-8"?>
            <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                           xmlns:s="library://ns.adobe.com/flex/spark" 
                           xmlns:mx="library://ns.adobe.com/flex/mx">
             <s:controlBarContent>
              <s:Button id="btn"
                        label="launch Spark TitleWindow"
                        click="btn_clickHandler(event);" />
             </s:controlBarContent>
             
             <fx:Script>
              <![CDATA[
               import mx.core.IFlexDisplayObject;
               import mx.events.CloseEvent;
               import mx.managers.PopUpManager;
               import spark.events.TitleWindowBoundsEvent;
               
               protected function btn_clickHandler(evt:MouseEvent):void {
                // Add and center the pop up window.
                PopUpManager.addPopUp(titleWin, this, true);
                PopUpManager.centerPopUp(titleWin);
               }
               
               protected function titleWin_closeHandler(evt:CloseEvent):void {
                // Remove the pop up window.
                PopUpManager.removePopUp(evt.currentTarget as IFlexDisplayObject);
               }
              ]]>
             </fx:Script>
             
             <fx:Declarations>
              <s:TitleWindow id="titleWin"
                             title="Spark TitleWindow container"
                             width="240"
                             close="titleWin_closeHandler(event);"
                             creationComplete="titleWin.moveArea.visible = ch.selected;">
               <s:layout>
                <s:VerticalLayout paddingLeft="10" paddingRight="10"
                                  paddingTop="10" paddingBottom="10" />
               </s:layout>
               <s:controlBarContent>
                <s:CheckBox id="ch"
                            label="Should I be draggable?"
                            selected="true"
                            change="titleWin.moveArea.visible = ch.selected;" />
               </s:controlBarContent>
               <s:Label text="The quick brown fox jumps over the lazy dog."
                        width="100%" />
              </s:TitleWindow>
             </fx:Declarations>
             
            </s:Application>

             

             

             

            Regards,

            Pablo Souza

            1 person found this helpful
            • 3. Re: mxml and action script
              KiarasH.Mozafari Level 1

              thnask a lot both of you ..

              I really need to drag Panel componet, and titleWindiws is so useful !

               

              ^^

              • 4. Re: mxml and action script
                Pablo Souza Level 3

                Really nice!

                 

                Best regards,

                Pablo Souza