您的位置:首页 > 编程语言

自己做的一个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;
}
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐