0 Replies Latest reply on Nov 20, 2009 6:49 AM by madhooper

    code worked to drag flv but the code doesn't work to drag swf. I think i'm missing something small

    madhooper Level 1

      I created a video play that plays flv videos. I altered the code from video display to swfloader and now I can't drag the swf videos.

       

      Thanks in advance for any assistance.

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="galleryData.send()" viewSourceURL="srcview/index.html">
      <mx:Style source = "PhotoGallery.css"/>
      <mx:HTTPService id="galleryData" url="assets/videos.xml"/>
         
      <mx:Script>
              <![CDATA[
                  import mx.events.*;
                 
                  //import component classes
                  import mx.controls.SWFLoader;
                  import mx.containers.Panel;
                  //inmport drag & drop classes
                  import mx.events.DragEvent;
                  import mx.managers.DragManager;
                  import mx.core.*;
                 
                  //Handle drag of videos
                  private function dragIt(event:MouseEvent, value:String):void
                  {
                    // instantiate dragInitiator
                    var dragInitiator:SWFLoader = event.currentTarget as SWFLoader;  
                   
                    // instantiate dragSource
                    var dragSource:DragSource = new DragSource();
                    dragSource.addData(value, 'value');
                   
                    // instantiate dragProxy
                    var dragProxy:SWFLoader = new SWFLoader();
                    dragProxy.source = event.currentTarget.source;
                   
                    //set of the thumbanails being dragged
                    dragProxy.width = 150 ;
                    dragProxy.height = 150 ;
                   
                    DragManager.doDrag(dragInitiator, dragSource, event, dragProxy);
                  }
                 
                  //handle when entering in the drop zone
                  private function dragEnterHandler(event:DragEvent):void
                  {
                    var dropTarget:Panel=event.currentTarget as Panel;
                    if (event.dragSource.hasFormat('value'))
                    {
                      DragManager.acceptDragDrop(dropTarget);
                    }
                  }
                 
                  //Handle exiting drop zone
                  private function dragExitHandler(event:DragEvent):void
                  {
                    var dropTarget:Panel=event.currentTarget as Panel;                              
                  }                   
                 
                  // handle dropping target in dropzone
                  private function dragDropHandler(event:DragEvent):void
                  {
                    var value:String = event.dragSource.dataForFormat('value') as String;
                  
                    myVideo.source = value;
                    //myVideo.play();
                    //myVideo.volume = 0;             
                  }
              ]]>
          </mx:Script>
         
          <mx:Parallel id="over">
              <mx:Zoom  duration="100" zoomHeightTo="1.4" zoomWidthTo="1.4"/>
              <mx:Glow id="glowImage" duration="300"
              alphaFrom="1.0" alphaTo="0.3"
              blurXFrom="0.0" blurXTo="30.0"
              blurYFrom="0.0" blurYTo="30.0"
              color="0xFFFFFF"/>
          </mx:Parallel>
         
          <mx:Parallel id="out">
              <mx:Zoom  duration="100" zoomHeightTo="1" zoomWidthTo="1" />
              <mx:Glow id="unglowImage" duration="200"
              alphaFrom="0.3" alphaTo="1.0"
              blurXFrom="30.0" blurXTo="0.0"
              blurYFrom="30.0" blurYTo="0.0"
              color="0xFFFFFF"/>
          </mx:Parallel>
         
         
          <mx:Panel layout="absolute"
               id="thumbsPanel" title="Dameon" width="311" height="441" verticalCenter="0" right="636" horizontalCenter="-274" backgroundColor="#040404" borderColor="#C61D02">
              <mx:Tile right="10" left="10" top="42" bottom="10">
             
              <mx:Repeater dataProvider="{galleryData.lastResult.gallery.videos.video}" id="imageRepeater">
             
                  <mx:HBox width="70" height="70" verticalAlign="middle" horizontalAlign="center" id="viewerPanel">
                      <mx:SWFLoader width="50" height="50" source="{imageRepeater.currentItem}" mouseMove="dragIt(event,event.target.getRepeaterItem() )" rollOutEffect="{out}" rollOverEffect="{over}"/>
                  </mx:HBox>
                  </mx:Repeater>
              </mx:Tile>
          </mx:Panel>
          <mx:Panel layout="absolute" id="viewPanel" title="Enjoy!" dragDrop="dragDropHandler(event);" dragEnter="dragEnterHandler(event);" dragExit="dragExitHandler(event);" verticalCenter="0" height="441" width="590" horizontalCenter="185" backgroundColor="#020202" borderColor="#000000">
              <mx:SWFLoader width="546" height="389" id="myVideo" left="0" top="10"/>
          </mx:Panel>
         
      </mx:Application>