flash action实例学习笔记.doc_第1页
flash action实例学习笔记.doc_第2页
flash action实例学习笔记.doc_第3页
flash action实例学习笔记.doc_第4页
flash action实例学习笔记.doc_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

css属性:动作脚本属性:是在flash内部创建的样式表属性textAlignfontSizetextDecorationmarginLeftmarginRightfontWeightfontStyletextindentfontFamily colordisplay定义的外部css属性需要加上-号例如:text-align align 的a 不需要大写 实例:mycar.play() 播放电影剪辑_width 宽度、事件处理函数:对事件作出响应的程序段 on(realse) /单击按钮时播放动画play(); _x _y _alpha 横坐标纵坐标 透明度Date.getHours() Math.abs() 常数Math.PI 常数:Key.HOME Key.CONTROLKey.ENTER 分别表示home, ctrl键 enter 键Ationscript 的关键字Break case class continue default delete If implements import in instanceof interface Dynamic else extends for function get Intrinsic new private public return set Static switch this typeof var void While with f 换页符n 换行符r 回车符var a=99;var b=88;If (ab) trace(“ab”);else if trace(“ab”); 计算绝对值var x= Math.abs(“-4”); 影片剪)myMovieClip.startDrag(true)将影片剪辑设置为可拖动myMovieClip._x 可获取横坐标属性值TextFiled.StyleSheet类getStyle()getStyleNames()load()parseCSS()setStyle()gotoAndStopgotoAndPlay(9);gotoAndPlay(“scene2”,2)场景 2的第二帧nextFrame prevFramenextScene prevScene按钮对事件作出的反应pressreleaserollOverrollOutdragOverdragOutkeyPress(“key”)on (release,keyPress “”)_root.car.gotoAndPlay(12);_root.bus.nextFrame();car._x +=5;for (var I in _root)_rooti._rotation +=35;指路行驶:on (keyPress ) car._x -= 5;on (keyPress )car._x +=5; on (keyPress ) car._y -=5;on (keyPress ) car._y +=5;还可加入方向 car. rotation -=90;小球回旋影片剪辑onClipEvent (load) var width = _root._width;var height = _root._height;var deltaX = deltaY=10;_x = _root._width/100;_y = _root._height/100;onClipEvent (enterFrame) _x += deltaX;_y += deltaY;if (_x=width-10 | _x=height-10 | _y=430) this._y = -30;this._xscale = this._yscale=this._alpha=100;鼠标右键错误:var my_cm = new ContextMenu();my_cm.customItems.push(new ContextMenuItem()(旋转, rotate);my_cm.customItems.push(new ContextMenuItem()(下落, drop);my_cm.customItems.push(new ContextMenuItem()(缩放, zoom);my_cm.hideBuiltInItems();function rotate(obj, item) obj.onEnterFrame = function() this._rotation += 15;function drop(obj, item) obj.onEnterFrame = function() this._y = (this._y+8)%400;function zoom(obj, item) obj.onEnterFrame = function() this._xscale = this._yscale -= 5;if (this._xscale=-100) this._xscale = this._yscale=100;for (var i in _root) _rooti.menu = my_cm;游动的死鱼:total = 100;var headVel = 13;var bodyVel = 1.1;var scaleDelta = 3;var xpos = new Array();var ypos = new Array();for (i=1; i=total; i+) if (i = 1) attachMovie(head, fish+i, total+1-i); else if (i = 2) | (i = 13) attachMovie(fin, fish+i, total+1-i); else attachMovie(body, fish+i, total+1-i);with (_rootfish+i) _xscale -= scaleDelta*i;_yscale -= scaleDelta*i;_alpha = 100-(100/total)*i;_root.onEnterFrame = function() xpos0 += (_xmouse-xpos0)/headVel;ypos0 += (_ymouse-ypos0)/headVel;for (i=1; i=total; i+) xposi += (xposi-1-xposi)/bodyVel;yposi += (yposi-1-yposi)/bodyVel;for (i=1; i=total; i+) with (_rootfish+i) _x = (xposi-1+xposi)/2;_y = (yposi-1+yposi)/2;_rotation = 90+180/Math.PI*Math.atan2(yposi-yposi-1), (xposi-xposi-1);删除动态生成的实例;var i = j=0;_root.onMouseDown = function() attachMovie(star, star+i, i);_rootstar+i._x = _xmouse;_rootstar+i._y = _ymouse;i+;_root.onKeyDown = function() if (_rootstar+j._visible) removeMovieClip(_rootstar+j);j+;Key.addListener(_root);深度的应用:attchMovie getDepth getNextHighestDepthgetInstanceAtDepth()/返回指定深度的实例swapDepth()for (var i=0;i6;i+)attachMovie(shape,shape+i,i);_rootshape+i._x=80*i;_rootshape+i._y=80*i;_rootshape+i.onRelease=function()while(this.getDepth()!=_root.getNextHighestDepth ()-1)for(var m=this.getDepth();/当前实例深度值m_root.getNextHighestDepth ()-1;m+)/依次比较当前深度与最大深度,并确保当前深度为最大 _root.getInstanceAtDepth (m).swapDepths(_root.getInstanceAtDepth (m+1);碰撞试验但不能完成所有操作:var vel = new Array();for (var i = 0; i3; i+) attachMovie(ball, 2*i+1, 2*i+1);attachMovie(ball, 2*i, 2*i);with (_root2*i) _x = _width/2;_y = _height/2;vel2*i = 5+i*5;_root2*i.onEnterFrame = function() var id = (this._y-50)/100;this._x += _root.vel2*id;this._rotation += 360*_root.vel2*id/(2*Math.PI*(this._width/2);if (this.hitTest(0, this._y, false) vel2*id *= -1;with (_root2*i+1) _x = 400-_width/2;_y = 50+i*100;vel2*i+1 = 10+i*2;_root2*i+1.onEnterFrame = function() var id = (this._y-50)/100;this._x -= _root.vel2*id+1;this._rotation -= 360*_root2*id+1/(2*Math.PI*(2*this._width/2);if (this.hitTest(_root2*id) | this.hitTest(400, this._y, false) vel2*id+1 *= -1;startDrag(true,left,top,right,bottom)stopDrag()的用法onClipEvent(load)x=_x;y=_y;on(press )this.startDrag(true,x,y,x,y+300);on(release, releaseOutside)this.stopDrag(); 动态遮罩的应用:this.removeMovieClip()_.setMask(-)_root.createEmptyMovieClip(mask, 1);picture.setMask(mask);_root.mask.onMouseMove = function() var i = this.getNextHighestDepth();this.attachMovie(circle, i, i);thisi._x = this._xmouse;thisi._y = this._ymouse;mc的绘图功能:var drag = false;_root.createEmptyMovieClip(square, 0);with (square) lineStyle(0, 0xFF0000, 100);moveTo(-5, -5);beginFill(0xDDDDDD);lineTo(-5, 5);lineTo(5, 5);lineTo(5, -5);lineTo(-5, -5);endFill();square._visible = false;for (var i = 1; i=5; i+) _root.square.duplicateMovieClip(square+i, i);_rootsquare+i._x = 550*Math.random();_rootsquare+i._y = 400*Math.random();_rootsquare+i.onPress = function() this.startDrag(true);drag = true;_rootsquare+i.onRelease = function() this.stopDrag();drag = false;drawlines();function drawlines() for (var i =1; i5; i+) _root.createEmptyMovieClip(line+i, i+5);with (_rootline+i) _x = _rootsquare+5._x;_y = _rootsquare+5._y;lineStyle(1, 0xffff00, 50);lineTo(_rootsquare+i._x-_rootsquare+5._x, _rootsquare+i._y-_rootsquare+5._y);drawlines();_root.onMouseMove = function() if (drag = true) drawlines();updateAfterEvent();html标签的使用_root.createTextField(myTxt,0,50,50,400

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论