查看文章 |
Swiff & vcastr
2007-09-27 13:47
// based on mootools r984 var XFlv = new Class({ Implements: [ Options], options: { width: 500, height: 350, top: 20, left: 20, swf:{ width:'100%', height:'100%', properties: { 'class': 'xFlvObj' }, params:{ 'wmode': 'transparent' }, vars:{ 'showMovieInfo': 0, 'IsAutoPlay': 1 } }, fx:{ transition: Fx.Transitions.Quint.easeIn, duration: 300, wait: false } }, initialize: function(){ var p = Array.link(arguments, {'src': $type.string , 'title': $type.string , 'options': $type.object}); this.setOptions(p.options || {} ); p.title = p.title || 'Swiff Movie'; this.dom = new Element("div", { 'class':'xFlv', 'styles':{ width:this.options.width, height: this.options.height,top:this.options.top, left: this.options.left} }).inject(document.body); this.close = new Element("div",{ 'class':'xFlvClose', 'events':{ mouseover: this.on, mouseout: this.out, click: function(){ this.dom.empty().destroy(); }.bind(this) } }).inject(this.dom); this.title = new Element("div",{ 'class':'xFlvTitle' }).setHTML(p.title).inject(this.dom ); this.box = new Element("div",{ 'class':'xFlvBox' }).inject(this.dom ); this.obj = new Swiff( "/ext/js/Swiff/vcastr22.swf" , $merge( this.options.swf, { 'container': this.box , 'params': {'movie': p.src }, 'vars' :{'vcastr_file': p.src ,'vcastr_title':p.title } }) ); this.resize = new Element("div",{ 'class':'xFlvSize' }).inject(this.dom); this.dom.makeResizable({handle :this.resize ,onDrag: this.render.bind(this) , onComplete:function(){ var p = this.dom.getCoordinates(); XFlv.pos.width = p.width; XFlv.pos.height = p.height; }.bind(this) }); this.dom.makeDraggable({handle :this.title , onComplete:function(){ var wp = window.getSize(); var p = this.dom.getCoordinates(); XFlv.pos.left = p.left - wp.scroll.x; XFlv.pos.top = p.top - wp.scroll.y; }.bind(this) }); this.render(); }, render: function(){ var p = this.dom.getCoordinates(); this.box.setStyles({ height: p.height - 29, width: p.width - 12 }); this.close.setStyles({ left: p.width - 18 }); this.title.setStyles({ width: p.width - 32 }); this.resize.setStyles({ left: p.width - 8, top: p.height - 9 }); }, on: function(){ this.setStyle('background-image',this.getStyle('background-image').replace(/\.gif/,'.on.gif')); }, out: function(){ this.setStyle('background-image',this.getStyle('background-image').replace(/(\.on)?\.gif/,'.gif')); } }); XFlv.pos = {}; new Asset.css('/ext/js/Swiff/flv.css'); ======================================================== .xFlv{ position:absolute; top:20px; left:20px; background:#E7E3E5; text-align:left; } .xFlvTitle{ position:absolute; height:18px; font-size:12px; line-height:18px; text-indent:1em; cursor:move; } .xFlvBox{ position:absolute; top:20px; left:6px; } .xFlvBox *{ width:100%; height:100%; } .xFlvSize{ position:absolute; background:url(/ext/js/Swiff/img/resize.gif) no-repeat 50% 20%; width:10px; height:10px; cursor:nw-resize; } .xFlvClose{ position:absolute; top:5px; background:url(/ext/js/Swiff/img/close.gif) no-repeat 50% 0%; width:10px; height:10px; cursor: pointer; } .xFlvObj{ width:100%; height:100%; } |
最近读者: