自己做的一个flash banner焦点切换的同样发上源代码!
2010-11-10 13:32
381 查看
自己做的一个flash banner焦点切换的同样发上源代码!
http://down.qiannao.com/space/file/qiannao/share/2010/11/10/01289367719521.zip/.page
package
{
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class flash_banner2 extends MovieClip
{
public function flash_banner2 ()
{
var fileW:int = file0_mc.width - 2;
var fileH:int = file0_mc.height - 2;
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
var ishow:int = 0;
var _timer:Timer = new Timer(2000);
_timer.addEventListener (TimerEvent.TIMER,timerF);
_timer.start ();
var __file0:URLRequest = new URLRequest("q_images/01.jpg");
var __file1:URLRequest = new URLRequest("q_images/02.jpg");
var __file2:URLRequest = new URLRequest("q_images/03.jpg");
var __file3:URLRequest = new URLRequest("q_images/04.jpg");
var _file0:Loader=new Loader();
var _file1:Loader=new Loader();
var _file2:Loader=new Loader();
var _file3:Loader=new Loader();
_file0.load (__file0);
_file1.load (__file1);
_file2.load (__file2);
_file3.load (__file3);
_file0.contentLoaderInfo.addEventListener (Event.COMPLETE,_file0f);
_file1.contentLoaderInfo.addEventListener (Event.COMPLETE,_file1f);
_file2.contentLoaderInfo.addEventListener (Event.COMPLETE,_file2f);
_file3.contentLoaderInfo.addEventListener (Event.COMPLETE,_file3f);
function _file0f (Event)
{
file0_mc.addChild (_file0);
_file0.width = fileW;
_file0.height = fileH;
_file0.x++;
_file0.y++;
_file0.alpha = 0.5;
}
function _file1f (Event)
{
file1_mc.addChild (_file1);
_file1.width = fileW;
_file1.height = fileH;
_file1.x++;
_file1.y++;
_file1.alpha = 0.5;
}
function _file2f (Event)
{
file2_mc.addChild (_file2);
_file2.width = fileW;
_file2.height = fileH;
_file2.x++;
_file2.y++;
_file2.alpha = 0.5;
}
function _file3f (Event)
{
file3_mc.addChild (_file3);
_file3.width = fileW;
_file3.height = fileH;
_file3.x++;
_file3.y++;
_file3.alpha = 0.5;
}
mainshow (0,_file0,_file1,_file2,_file3);
file0_mc.addEventListener (MouseEvent.CLICK,file0DownF);
file1_mc.addEventListener (MouseEvent.CLICK,file1DownF);
file2_mc.addEventListener (MouseEvent.CLICK,file2DownF);
file3_mc.addEventListener (MouseEvent.CLICK,file3DownF);
file0_mc.addEventListener (MouseEvent.MOUSE_OVER,file0Over);
file0_mc.addEventListener (MouseEvent.MOUSE_OUT,file0Out);
function file0Over ()
{
_timer.stop ();
over0_mc.alpha = 1;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
function file0Out ()
{
_timer.start ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
file1_mc.addEventListener (MouseEvent.MOUSE_OVER,file1Over);
file1_mc.addEventListener (MouseEvent.MOUSE_OUT,file1Out);
function file1Over ()
{
_timer.stop ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 1;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
function file1Out ()
{
_timer.start ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
file2_mc.addEventListener (MouseEvent.MOUSE_OVER,file2Over);
file2_mc.addEventListener (MouseEvent.MOUSE_OUT,file2Out);
function file2Over ()
{
_timer.stop ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 1;
over3_mc.alpha = 0.5;
}
function file2Out ()
{
_timer.start ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
file3_mc.addEventListener (MouseEvent.MOUSE_OVER,file3Over);
file3_mc.addEventListener (MouseEvent.MOUSE_OUT,file3Out);
function file3Over ()
{
_timer.stop ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 1;
}
function file3Out ()
{
_timer.start ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
show_mc.addEventListener (MouseEvent.MOUSE_OVER,showOver);
show_mc.addEventListener (MouseEvent.MOUSE_OUT,showOut);
function showOver ()
{
_timer.stop ();
}
function showOut ()
{
_timer.start ();
}
function file0DownF (Event:MouseEvent)
{
mainshow (0,_file0,_file1,_file2,_file3);
ishow = 0;
}
function file1DownF (Event:MouseEvent)
{
mainshow (1,_file0,_file1,_file2,_file3);
ishow = 1;
}
function file2DownF (Event:MouseEvent)
{
mainshow (2,_file0,_file1,_file2,_file3);
ishow = 2;
}
function file3DownF (Event:MouseEvent)
{
mainshow (3,_file0,_file1,_file2,_file3);
ishow = 3;
}
function timerF (Event:TimerEvent)
{
mainshow (ishow,_file0,_file1,_file2,_file3);
ishow++;
if (ishow == 4)
{
ishow = 0;
}
}
}
public function mainshow (showFile,file0,file1,file2,file3)
{
switch_mc.play ();
var _fileshow:Loader=new Loader();
var __fileshow:URLRequest;
switch (showFile)
{
case 0 :
file0.alpha = 1;
file1.alpha = 0.5;
file2.alpha = 0.5;
file3.alpha = 0.5;
__fileshow = new URLRequest("q_images/01.jpg");
break;
case 1 :
file0.alpha = 0.5;
file1.alpha = 1;
file2.alpha = 0.5;
file3.alpha = 0.5;
__fileshow = new URLRequest("q_images/02.jpg");
break;
case 2 :
file0.alpha = 0.5;
file1.alpha = 0.5;
file2.alpha = 1;
file3.alpha = 0.5;
__fileshow = new URLRequest("q_images/03.jpg");
break;
case 3 :
file0.alpha = 0.5;
file1.alpha = 0.5;
file2.alpha = 0.5;
file3.alpha = 1;
__fileshow = new URLRequest("q_images/04.jpg");
break;
}
_fileshow.load (__fileshow);
_fileshow.contentLoaderInfo.addEventListener (Event.COMPLETE,showF);
function showF ()
{
show_mc.addChild (_fileshow);
_fileshow.width = stage.stageWidth;
_fileshow.height = stage.stageHeight;
}
}
}
}
http://down.qiannao.com/space/file/qiannao/share/2010/11/10/01289367719521.zip/.page
package
{
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class flash_banner2 extends MovieClip
{
public function flash_banner2 ()
{
var fileW:int = file0_mc.width - 2;
var fileH:int = file0_mc.height - 2;
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
var ishow:int = 0;
var _timer:Timer = new Timer(2000);
_timer.addEventListener (TimerEvent.TIMER,timerF);
_timer.start ();
var __file0:URLRequest = new URLRequest("q_images/01.jpg");
var __file1:URLRequest = new URLRequest("q_images/02.jpg");
var __file2:URLRequest = new URLRequest("q_images/03.jpg");
var __file3:URLRequest = new URLRequest("q_images/04.jpg");
var _file0:Loader=new Loader();
var _file1:Loader=new Loader();
var _file2:Loader=new Loader();
var _file3:Loader=new Loader();
_file0.load (__file0);
_file1.load (__file1);
_file2.load (__file2);
_file3.load (__file3);
_file0.contentLoaderInfo.addEventListener (Event.COMPLETE,_file0f);
_file1.contentLoaderInfo.addEventListener (Event.COMPLETE,_file1f);
_file2.contentLoaderInfo.addEventListener (Event.COMPLETE,_file2f);
_file3.contentLoaderInfo.addEventListener (Event.COMPLETE,_file3f);
function _file0f (Event)
{
file0_mc.addChild (_file0);
_file0.width = fileW;
_file0.height = fileH;
_file0.x++;
_file0.y++;
_file0.alpha = 0.5;
}
function _file1f (Event)
{
file1_mc.addChild (_file1);
_file1.width = fileW;
_file1.height = fileH;
_file1.x++;
_file1.y++;
_file1.alpha = 0.5;
}
function _file2f (Event)
{
file2_mc.addChild (_file2);
_file2.width = fileW;
_file2.height = fileH;
_file2.x++;
_file2.y++;
_file2.alpha = 0.5;
}
function _file3f (Event)
{
file3_mc.addChild (_file3);
_file3.width = fileW;
_file3.height = fileH;
_file3.x++;
_file3.y++;
_file3.alpha = 0.5;
}
mainshow (0,_file0,_file1,_file2,_file3);
file0_mc.addEventListener (MouseEvent.CLICK,file0DownF);
file1_mc.addEventListener (MouseEvent.CLICK,file1DownF);
file2_mc.addEventListener (MouseEvent.CLICK,file2DownF);
file3_mc.addEventListener (MouseEvent.CLICK,file3DownF);
file0_mc.addEventListener (MouseEvent.MOUSE_OVER,file0Over);
file0_mc.addEventListener (MouseEvent.MOUSE_OUT,file0Out);
function file0Over ()
{
_timer.stop ();
over0_mc.alpha = 1;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
function file0Out ()
{
_timer.start ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
file1_mc.addEventListener (MouseEvent.MOUSE_OVER,file1Over);
file1_mc.addEventListener (MouseEvent.MOUSE_OUT,file1Out);
function file1Over ()
{
_timer.stop ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 1;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
function file1Out ()
{
_timer.start ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
file2_mc.addEventListener (MouseEvent.MOUSE_OVER,file2Over);
file2_mc.addEventListener (MouseEvent.MOUSE_OUT,file2Out);
function file2Over ()
{
_timer.stop ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 1;
over3_mc.alpha = 0.5;
}
function file2Out ()
{
_timer.start ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
file3_mc.addEventListener (MouseEvent.MOUSE_OVER,file3Over);
file3_mc.addEventListener (MouseEvent.MOUSE_OUT,file3Out);
function file3Over ()
{
_timer.stop ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 1;
}
function file3Out ()
{
_timer.start ();
over0_mc.alpha = 0.5;
over1_mc.alpha = 0.5;
over2_mc.alpha = 0.5;
over3_mc.alpha = 0.5;
}
show_mc.addEventListener (MouseEvent.MOUSE_OVER,showOver);
show_mc.addEventListener (MouseEvent.MOUSE_OUT,showOut);
function showOver ()
{
_timer.stop ();
}
function showOut ()
{
_timer.start ();
}
function file0DownF (Event:MouseEvent)
{
mainshow (0,_file0,_file1,_file2,_file3);
ishow = 0;
}
function file1DownF (Event:MouseEvent)
{
mainshow (1,_file0,_file1,_file2,_file3);
ishow = 1;
}
function file2DownF (Event:MouseEvent)
{
mainshow (2,_file0,_file1,_file2,_file3);
ishow = 2;
}
function file3DownF (Event:MouseEvent)
{
mainshow (3,_file0,_file1,_file2,_file3);
ishow = 3;
}
function timerF (Event:TimerEvent)
{
mainshow (ishow,_file0,_file1,_file2,_file3);
ishow++;
if (ishow == 4)
{
ishow = 0;
}
}
}
public function mainshow (showFile,file0,file1,file2,file3)
{
switch_mc.play ();
var _fileshow:Loader=new Loader();
var __fileshow:URLRequest;
switch (showFile)
{
case 0 :
file0.alpha = 1;
file1.alpha = 0.5;
file2.alpha = 0.5;
file3.alpha = 0.5;
__fileshow = new URLRequest("q_images/01.jpg");
break;
case 1 :
file0.alpha = 0.5;
file1.alpha = 1;
file2.alpha = 0.5;
file3.alpha = 0.5;
__fileshow = new URLRequest("q_images/02.jpg");
break;
case 2 :
file0.alpha = 0.5;
file1.alpha = 0.5;
file2.alpha = 1;
file3.alpha = 0.5;
__fileshow = new URLRequest("q_images/03.jpg");
break;
case 3 :
file0.alpha = 0.5;
file1.alpha = 0.5;
file2.alpha = 0.5;
file3.alpha = 1;
__fileshow = new URLRequest("q_images/04.jpg");
break;
}
_fileshow.load (__fileshow);
_fileshow.contentLoaderInfo.addEventListener (Event.COMPLETE,showF);
function showF ()
{
show_mc.addChild (_fileshow);
_fileshow.width = stage.stageWidth;
_fileshow.height = stage.stageHeight;
}
}
}
}
相关文章推荐
- 网站基于flash实现的Banner图切换效果代码
- [转]Flash焦点图片切换代码
- 收藏一个漂亮的Flash焦点图切换
- 收藏一个漂亮的Flash焦点图切换
- 网站基于flash实现的Banner图切换效果代码
- 网上找的代码太多,自己用JQuery写一个横向滑动切换效果,代码超少
- 最近项目中有遇到报表数据入库的情况,数据量说大不大,说小又赖得自己手动敲!于是自己动手写了一个入库的,下面直接上代码,如有同样的,请联系我删除此文
- 自己编的一个图像反色代码
- 自己写了一个代码自动生成器
- 一个用as做出的FLASH导航条代码
- 给大家提供一个C#2.0的网站后台文章上传与前台显示的代码!呵呵!fckeditor大家自己调哦!
- Github网站加载不完全,响应超时,如何解决 Github是一个代码托管平台和开发者社区,开发者可以在Github上创建自己的开源项目并与其他开发者协作编码。毫不夸张地说,高效利用Github是一
- DataGridView动态绑定combox列,checkbox列(仿照老大的代码自己写的一个小例子供自己以后参考)
- javascript 封装的一个实用的焦点图切换效果
- ::自己写的一个超简单的ASP分页代码::
- jQ网站幻灯片切换效果焦点图代码
- 几行代码搞定Flash应用的多语言实时切换问题
- 给Visual Studio 2005设置一个代码边界线,提醒自己,别写的太长哦。
- 一个简单的基于jQuery的焦点图(幻灯片)代码