ScrapEvent

카테고리 없음 2011. 2. 25. 01:46
반응형

  private function scrapBtnDown(e:MouseEvent):void
  {
   //스크랩
   
   var swfLoader:SWFLoader = new SWFLoader();
   var url:String;
   
   if (GlobalConf.swfPath == null) {
    url = "popup.swf"
   }else {
    url = GlobalConf.swfPath + "popup.swf";
   }
   
   GlobalConf.scrapUrl = url;
   
   trace("scrapUrl: " , GlobalConf.scrapUrl);
   
   
   swfLoader.load(url);
   swfLoader.addEventListener(Event.COMPLETE, loaded);
   
   
   var _url:String = GlobalConf.swfPath + "player.swf";
   var _flv:String = GlobalConf.flvPath;
   
   var copyTag:String;
   copyTag = _url + "?flvPath=" + _flv + "tvcf.flv";
 
   ClipboardCopyTag.flvCopyTag(copyTag, "object", 277, 196.5);
   
  }


package com.smilejsu.media
{
 import com.k2.core.GlobalConf;
 import flash.display.MovieClip;
 import flash.display.Sprite;
 import flash.display.StageAlign;
 import flash.display.StageScaleMode;
 import flash.events.Event;
 import flash.events.MouseEvent;
 import flash.external.ExternalInterface;
 
 /*
  *
  * com.smilejsu.media.ScrapPlayer
  *
  */
 public class ScrapPlayer extends MovieClip
 {
  public var player:BasePlayer;
  private var _flvPath:String;
 
  public function ScrapPlayer()
  {
   addEventListener(Event.ADDED_TO_STAGE, init);
  }
 
  private function init(e:Event):void
  {
   removeEventListener(Event.ADDED_TO_STAGE, init);
   
   //스테이지 셋팅
   stage.align = StageAlign.TOP_LEFT;
   stage.scaleMode = StageScaleMode.NO_SCALE;
   stage.showDefaultContextMenu = false;
   
   
   var obj:Object = root.loaderInfo.parameters;
   
   _flvPath =  obj.flvPath;
   
   if (_flvPath == "" || _flvPath == null )
   {
    _flvPath = "";
   }
   
   player.init(_flvPath);
   
   
  }
 }
}



package com.smilejsu.desktop
{
 import flash.display.MovieClip;
 import flash.desktop.Clipboard;
 import flash.desktop.ClipboardFormats;
 
 
 public class ClipboardCopyTag extends MovieClip
 {
  public static const URL:String = "url"
  public static const EMBED:String = "embed"
  public static const OBJECT:String = "object"
 
  public function ClipboardCopyTag()
  {
  }
  public static function flvCopyTag(swfURL:String ,scrapType:String="object", w:Number =680 , h:Number=478):void
  {
   
   var _w:Number = w;
   var _h:Number = h;
   var _scrapType:String = scrapType;
   var _swfURL:String = swfURL;
   var copyUrl:String;
   
   if (_scrapType == ClipboardCopyTag.EMBED) {
   
    copyUrl = '<embed src="' + _swfURL + '" type="application/x-shockwave-flash" allowFullScreen="true" wmode="transparent" width="' + _w + '" height="' + _h + '"></embed>';
   
   }else if (_scrapType == ClipboardCopyTag.OBJECT) {
   
    copyUrl = '<object style="height:' + _h +'px; width:' + _w + 'px"><param name="movie" value="' + _swfURL + '"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="' + _swfURL + '" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="' + _w + '" height="' + _h +'"></object>';
   }
   
   Clipboard.generalClipboard.clear();
   Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, copyUrl);
  }
 
  public static function urlCopyTag(_url:String):void {
   
   Clipboard.generalClipboard.clear();
   Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, _url);
  }
 
  public static function flvTagReturn(swfURL:String ,scrapType:String="object", w:Number =640 , h:Number=360):String {
   var _w:Number = w;
   var _h:Number = h;
   var _scrapType:String = scrapType;
   var _swfURL:String = swfURL;
   var copyUrl:String;
   
   if (_scrapType == ClipboardCopyTag.EMBED) {
   
    copyUrl = '<embed src="' + _swfURL + '" type="application/x-shockwave-flash" allowFullScreen="true" wmode="transparent" width="' + _w + '" height="' + _h + '"></embed>';
   
   }else if (_scrapType == ClipboardCopyTag.OBJECT) {
   
    copyUrl = '<object style="height:' + _h +'px; width:' + _w + 'px"><param name="movie" value="' + _swfURL + '"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="' + _swfURL + '" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="' + _w + '" height="' + _h +'"></object>';
   }
   
   return copyUrl;
  }
 
 }

}

반응형
: