首页  |  精品网站  |  原创作品秀   |  艺术设计  |  网络学院  |  信息中心  |  站内搜索  |  求职招聘  |  建站资源  |  服装网站  |  编程开发 |  设计论坛 
  平面设计 画册 VI欣赏 包装 CG-插画   酷站 个人网页 商业网站   Alexa排名 CSS 建站资源 下载专区 JS特效 品牌服装 服装院校   专题欣赏 SEO 图标欣赏
域名注册 虚拟主机 广州网站建设 广州网页设计 IDC赞助 设计资源下载 虚拟主机 域名注册 品牌网站建设 服装品牌网站建设 广告服务 网站推广 娱乐
当前位置:首 页 >> 网络学院 >> Flash ※ FreeHand >> 一个飞翔菜单的制作

一个飞翔菜单的制作

来源:flash8 被读135次

中资源
转载请注明出处-中国设计秀-cnwebshow.com

更新了,效果基本一致了.另外加了缓冲(可选,默认为假)


有白色的线条,是因为,这个底条是50个小图组成,FLASH 处理的时候不是很完美.按理是没有的,也算是个BUG吧 ,你可以自己绘制,就不会有这个问题了.

还有就是请教各位
1:怎么设置创建出来的文本的字体大小(不用scale)
2:怎么获取文本从第一个字到最后一个字的距离
3:文本的bold属性怎么才能对中文有效

源码下载:flash_dock_menu.rar

模仿“css+js” 的那个菜单,舞台大小设置为  640*480  把这段代码插入第一帧(仅一帧)
在库中放入数组 menu_Array 中的名称为连接名的图片 和连接名为 dock_bg2 的图片

//-----------------------------代码--------------------------------------------------
import flash.display.BitmapData;
//-------------------是否缓冲(false/true)---------------------------------------
var huanchong:Boolean = false;
//-------------------若缓冲为真-缓冲大小---------------------------------------
var huanchong_num:Number = 3;
var main_bg:BitmapData = BitmapData.loadBitmap("main_bg");
//-------------------铺背景--------------------------------
for (var j:Number = 0; j<=767; j++) {
this.createEmptyMovieClip("bg_mc"+j, this.getNextHighestDepth());
this["bg_mc"+j].attachBitmap(main_bg, this.getNextHighestDepth());
this["bg_mc"+j]._x = j*20-Math.floor(j/32)*640;
this["bg_mc"+j]._y = Math.floor(j/32)*20;
}
//-----------------链接名称--------------------------------
var menu_Array:Array = new Array();
menu_Array = ["主页", "联系", "Protfolio", "音乐", "电影", "历史", "日历", "链接", "RSS", "RSS2"];
//-----------------创建一个底条位图实例-------------------------
var flash8_菜鸟_kingofkofs:BitmapData = BitmapData.loadBitmap("dock_bg");
//-----------------创建一个MC用来加载位图对象----------------
_root.createEmptyMovieClip("setoff", _root.getNextHighestDepth());
for (var j:Number = 0; j<=menu_Array.length*4-1+2; j++) {
_root.setoff.createEmptyMovieClip("setoff_son"+j, _root.setoff.getNextHighestDepth());
_root.setoff["setoff_son"+j].attachBitmap(flash8_菜鸟_kingofkofs, _root.getNextHighestDepth(), "auto", true);
_root.setoff["setoff_son"+j]._x = j*10-210;
_root.setoff["setoff_son"+j]._y = -60;
_root.setoff._x = Stage.width/2-5;
_root.setoff._y = Stage.height;
_root.setoff._height = 50;
_root.setoff.ori_width = _root.setoff._width;
}
//-----------------创建MC以及加载库中的位图---------------------
for (var j:Number = 0; j<=menu_Array.length-1; j++) {
this[img[j]] = BitmapData.loadBitmap(menu_Array[j]);
_root.createEmptyMovieClip(menu_Array[j], _root.getNextHighestDepth());
_root[menu_Array[j]].createEmptyMovieClip("mc", _root.getNextHighestDepth());
_root[menu_Array[j]].mc.attachBitmap(this[img[j]], _root.getInstanceAtDepth(), "auto", true);
_root[menu_Array[j]].mc._width = 40;
_root[menu_Array[j]].mc._height = 40;
_root[menu_Array[j]].mc._x = -_root[menu_Array[j]]._width/2;
_root[menu_Array[j]].mc._y = -_root[menu_Array[j]]._height;
_root[menu_Array[j]]._x = j*_root[menu_Array[j]]._width+(Stage.width-_root[menu_Array[j]]._width*menu_Array.length)*0.5+15;
_root[menu_Array[j]]._y = Stage.height;
_root[menu_Array[j]].ori_x = _root[menu_Array[j]]._x;
_root[menu_Array[j]].ori_y = _root[menu_Array[j]]._y;
_root[menu_Array[j]].ori_wid = _root[menu_Array[j]]._width;
_root[menu_Array[j]].ori_hei = _root[menu_Array[j]]._height;
//trace(_root[menu_Array[j]].ori_x);
}
var all_wid:Number = 0;
_root.createEmptyMovieClip("point", _root.getNextHighestDepth());
setInterval(function () {
updateAfterEvent();
_root.all_wid = _root[menu_Array[0]]._width+_root[menu_Array[1]]._width+_root[menu_Array[2]]._width+_root[menu_Array[3]]._width+_root[menu_Array[4]]._width+_root[menu_Array[5]]._width+_root[menu_Array[6]]._width+_root[menu_Array[7]]._width+_root[menu_Array[8]]._width+_root[menu_Array[9]]._width;
_root.setoff._width = (_root.all_wid-400)+_root.setoff.ori_width;
if (!huanchong) {
  _root.point._x = _xmouse;
  _root.point._y = _ymouse;
} else {
  _root.point._x += (_xmouse-_root.point._x)/huanchong_num;
  _root.point._y += (_ymouse-_root.point._y)/huanchong_num;
}
for (var j:Number = 0; j<=menu_Array.length-1; j++) {
  //-------------------计算及设置鼠标滑过时MC的高低----------------
  if (_root.point._x>=_root[menu_Array[j]].ori_x && _root.point._x-_root[menu_Array[j]].ori_x<=_root[menu_Array[j]].ori_wid*2.5 && _root.point._y<_root[menu_Array[j]]._y && _root[menu_Array[j]]._y-_root.point._y<=_root[menu_Array[j]].ori_hei*2.5) {
   _root["percent_x"+j] = 1-(_root.point._x-_root[menu_Array[j]].ori_x)/(_root[menu_Array[j]].ori_wid*2.5);
   _root["percent_y"+j] = 1-((_root[menu_Array[j]]._y-_root[menu_Array[j]].ori_wid)-_root.point._y)/(_root[menu_Array[j]].ori_hei*2.5-20);
   if (_root["percent_y"+j]>=1) {
    _root["percent_y"+j] = 1;
   }
   _root["percent_xy"+j] = _root["percent_x"+j]*_root["percent_y"+j];
   _root[menu_Array[j]]._width = _root["percent_xy"+j]*60+40;
   _root[menu_Array[j]]._height = _root["percent_xy"+j]*60+40;
  } else if (_root.point._x<_root[menu_Array[j]].ori_x && _root[menu_Array[j]].ori_x-_root.point._x<_root[menu_Array[j]].ori_wid*2.5 && _root.point._y<_root[menu_Array[j]]._y && _root[menu_Array[j]]._y-_root.point._y<=_root[menu_Array[j]].ori_hei*2.5) {
   _root["percent_x"+j] = 1-(_root[menu_Array[j]].ori_x-_root.point._x)/(_root[menu_Array[j]].ori_wid*2.5);
   _root["percent_y"+j] = 1-((_root[menu_Array[j]]._y-_root[menu_Array[j]].ori_wid)-_root.point._y)/(_root[menu_Array[j]].ori_hei*2.5-20);
   if (_root["percent_y"+j]>=1) {
    _root["percent_y"+j] = 1;
   }
   _root["percent_xy"+j] = _root["percent_x"+j]*_root["percent_y"+j];
   _root[menu_Array[j]]._width = _root["percent_xy"+j]*60+40;
   _root[menu_Array[j]]._height = _root["percent_xy"+j]*60+40;
  } else if (huanchong) {
   _root[menu_Array[j]]._width -= (_root[menu_Array[j]]._width-40)/5;
   _root[menu_Array[j]]._height -= (_root[menu_Array[j]]._height-40)/5;
  } else {
   _root[menu_Array[j]]._width = 40;
   _root[menu_Array[j]]._height = 40;
  }
  //-------------------菜单提示TXT----------------
  _root[menu_Array[j]].onRollOver = function() {
   this.menu_name = true;
   this.swapDepths(_root.getNextHighestDepth());
  };
  _root[menu_Array[j]].onRollOut = function() {
   this.menu_name = false;
  };
  if (_root[menu_Array[j]].menu_name) {
   _root.createTextField(menu_Array[j]+"txt", _root.getNextHighestDepth(), -10, -40, 50, 30);
   _root[menu_Array[j]+"txt"].bold = true;
   _root[menu_Array[j]+"txt"].text = menu_Array[j];
   _root[menu_Array[j]+"txt"]._xscale = _root[menu_Array[j]+"txt"]._yscale=150;
   _root[menu_Array[j]+"txt"].textColor = 0x000000;
   _root[menu_Array[j]+"txt"]._x = _root[menu_Array[j]]._x-_root[menu_Array[j]+"txt"]._width/2;
   _root[menu_Array[j]+"txt"]._y = Stage.height-_root[menu_Array[j]]._height-20;
   _root[menu_Array[j]+"txt"].selectable = false;
  } else {
   _root[menu_Array[j]+"txt"].removeTextField();
  }
}
_root[menu_Array[0]]._x = _root.setoff._x-_root.setoff._width/2+_root[menu_Array[0]]._width/2+10;
for (var j:Number = 1; j<=menu_Array.length-1; j++) {
  _root[menu_Array[j]]._x = _root[menu_Array[j-1]]._x+_root[menu_Array[j-1]]._width/2+_root[menu_Array[j]]._width/2;
}
}, 10);
转载请注明出处-中国设计秀-cnwebshow.com



投稿 】【对本文进行评论】 【字体: 】【发布于2007-09-26 09:36】

相关专题:暂无相关专题

上一篇:this的使用   下一篇:AS3生成单独“双击事件”
 认证LOGO下载
     
Copyright © 2005-2007 中国设计秀_网页设计教程_优秀网页设计欣赏_平面设计欣赏 All Right Reserved.
做最专业的设计服务网站,秀出自我,秀出精彩!中国设计秀,秀---无处不在!!
QQ:54292427  8208442 MSN:kingvisual#hotmail.com 交流群:9107036 3848215 8850631
粤ICP备05067046号 RSS