topical media & game development

talk show tell print

lib-flex-ximpel-editor-net-ximpel-components-OverlayEditorView.mx

lib-flex-ximpel-editor-net-ximpel-components-OverlayEditorView.mx (swf ) [ flash ] flex


  <?xml version="1.0" encoding="utf-8"?>
  <!-- 
      This program is free software: you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
      the Free Software Foundation, either version 3 of the License.
  
      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.
  
      You should have received a copy of the GNU General Public License
      along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
          Javier Quevedo Fernández 05-2009.
  -->
  <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" 
          layout="absolute" 
          showCloseButton="true"
          close="closeButtonHandler(event);"
          horizontalScrollPolicy="off" verticalScrollPolicy="off"
          horizontalCenter="0" verticalCenter="0"
           creationComplete="init();" title="Overlays editor: {this.clip.file}"  xmlns:ns1="net.ximpel.components.*">
           
           <mx:Script>
                   <![CDATA[
                           import net.ximpel.classes.ExtendedOverlay;
                           import net.ximpel.classes.OverlayCel;
                           import net.ximpel.classes.MediaClip;
                           import mx.binding.utils.BindingUtils;
                          import mx.managers.PopUpManager;                         
                           [Bindable]
                           public var clip:MediaClip;
                                   
                           public function init():void{
                                   overlayDataGrid.dataProvider = clip.overlays;
                                   BindingUtils.bindProperty(this.clip, "branchQuestion", this.branchQuestionInput, "text");
  
                                   //
                           }        
                           public function loadData():void{
                                   
                           }
                           
                           private function closeButtonHandler(event:Event):void{
                                   PopUpManager.removePopUp(this);
                           }
                           
                           private function addOverlayHandler(event:Event):void{
                                   clip.addOverlay();
                                   overlayDataGrid.dataProvider = clip.overlays;
                                   
                           }
                           
                           private function removeOverlayHandler(event:Event):void{
                                   
                           }
                           
                           private function addOverlayCelHandler(event:Event):void{
                                   var extendedOverlay : ExtendedOverlay = overlayDataGrid.selectedItem as ExtendedOverlay;                                 
                                   extendedOverlay.addOverlayCell();
                                   overlayCelGrid.dataProvider = extendedOverlay.overlayCels;
                           }
                           
                           private function removeOverlayCellHandler(event:Event):void{
                                   
                           }
                           
                           
                           private function itemFocusInOverlayGridHandler(event : Event): void{
                                   var extendedOverlay : ExtendedOverlay = overlayDataGrid.selectedItem as ExtendedOverlay;
                                   overlayCelGrid.dataProvider = extendedOverlay.overlayCels;
                                   overlayCelGrid.validateNow()
                                   overlayCelGrid.dataProvider = extendedOverlay.overlayCels;
                                   //overlayCelGrid.
                                   //overlayCelGrid.validateDisplayList();
                                   overlayCelRemoveLink.enabled = true;
                                   overlayCelAddLink.enabled = true;
                           }
                           
                           private function overlayGridChangeHandler(event:Event):void{
                                   overlayCellForm.enabled=false;
                           }
                           
                           private function overlayCellsChangeHandler(event : Event):void {
                                    var overlayCell : OverlayCel = overlayCelGrid.selectedItem as OverlayCel;
                                   overlayCellForm = new OverlayCellForm();
                                   overlayCellForm.overlayCel = overlayCell;
                                   overlayCellFormCanvas.removeAllChildren();
                                   overlayCellFormCanvas.addChild(overlayCellForm);
                                   overlayCellForm.enabled=true;
                                   
                           }
  
                          private function onRemoveOverlayClick(event:Event):void{
                                          clip.removeOverlay(ExtendedOverlay(overlayDataGrid.selectedItem));
                                          overlayDataGrid.dataProvider = clip.overlays;
                                          overlayCelGrid.dataProvider = null;
                          }
                          
                          private function onRemoveOverlayCelClick(event:Event):void{
                                  var extendedOverlay : ExtendedOverlay = overlayDataGrid.selectedItem as ExtendedOverlay;
                                   extendedOverlay.removeOverlayCell(OverlayCel(overlayCelGrid.selectedItem));
                                   overlayCelGrid.dataProvider=extendedOverlay.overlayCels;
                          }
                           
                   
                   ]]>
           </mx:Script>
           <mx:DataGrid id="overlayCelGrid" x="270" y="96" width="186" height="162" editable="false" change="overlayCellsChangeHandler(event)">
              <mx:columns>
                          <mx:DataGridColumn width="200" headerText = "Label" dataField="label" textAlign="right"/>
                   </mx:columns>
           </mx:DataGrid>
           <mx:DataGrid id="overlayDataGrid" x="10" y="96" width="248" height="162" editable="true" change="overlayGridChangeHandler(event)" itemFocusIn="itemFocusInOverlayGridHandler(event)">
              <mx:columns>
                          <mx:DataGridColumn width="200" headerText = "Start time" dataField="startTime" textAlign="right"/>
                          <mx:DataGridColumn width="200" headerText = "Duration" dataField="endTime" textAlign="right"/>
                   </mx:columns>
           </mx:DataGrid>
           <mx:Label x="10" y="67" text="Overlay"  fontSize="12" fontWeight="bold"/>
           <mx:Label x="270" y="68" text="Cells" fontSize="12" fontWeight="bold"/>
           <mx:LinkButton x="140" y="66" label="Add" click="addOverlayHandler(event)" fontWeight="normal"/>
           <mx:LinkButton x="191" y="66" label="Remove" click="onRemoveOverlayClick(event)" fontWeight="normal"/>
           <mx:LinkButton id="overlayCelRemoveLink" x="396" y="66" label="Remove" click="onRemoveOverlayCelClick(event)" enabled="false" fontWeight="normal"/>
           <mx:LinkButton id="overlayCelAddLink" x="348" y="66" label="Add" click="addOverlayCelHandler(event)" enabled="false" fontWeight="normal"/>
          
           <mx:Canvas x="10" y="266" width="446" height="260" borderStyle="solid" borderThickness="2" backgroundColor="#A2FA7F">
                    <mx:Label x="198" y="123" text="Preview"/>
           </mx:Canvas>
           <mx:Label  x="10" y="10" text="Branchquestion" fontSize="12" fontWeight="bold"/>
           <mx:TextInput  id="branchQuestionInput" text="{this.clip.branchQuestion}" width="228" y="36" x="10"/>
           <mx:Canvas id="overlayCellFormCanvas" x="464" y="66" width="337" height="460">
                    <ns1:OverlayCellForm id="overlayCellForm" x="0" y="0"  width="327" enabled="false">
                    </ns1:OverlayCellForm>
           </mx:Canvas>
                   
  </mx:TitleWindow>
  


(C) Æliens 18/6/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.