flash 方向箭头
前几天一个3D项目上要运用到 方向箭头(鼠标往哪移,箭头就转动一定的角度指向哪)!!
demo: http://6921.ggii.net/swf/ok.swf
操作是: 按下鼠标,并且移动鼠标观察效果!
下面将其代码贴出来:
MC是箭头影片剪辑 实例为arro
Circle 是一个转动的园 按下鼠标,固定在按下点处 实例 circle
代码是在时间轴上写的:
var arro:Sprite= Sprite(new MC());
var circle:MovieClip= MovieClip(new Circle());
arro.name="arro";
circle.name="circle";
stage.addEventListener(MouseEvent.MOUSE_DOWN,onDown,false,1,true);
stage.addEventListener(MouseEvent.MOUSE_UP,onUp,false,1,true);
stage.addEventListener(MouseEvent.MOUSE_MOVE,onMove,false,1,true);
addEventListener(Event.ENTER_FRAME,onFrame,false,1,true);
var tx,ty,gx,gy:int;
var isDown:Boolean;
function onDown(e:MouseEvent) {
isDown=true;
tx=e.stageX;
ty=e.stageY;
Mouse.hide();
addChild(circle);
positionCircle(tx,ty);
}
function onUp(e:MouseEvent) {
graphics.clear();
isDown=false;
Mouse.show();
if (getChildByName(circle.name)!=null) {
removeChild(circle);
}
if (getChildByName(arro.name)!=null) {
removeChild(arro);
}
}
function onMove(e:MouseEvent) {
gx=e.stageX;
gy=e.stageY;
if (isDown) {
addChild(arro);
arro.x=gx;
arro.y=gy;
}
}
function positionCircle(tx:int,ty:int) {
circle.x=tx;
circle.y=ty;
}
function onFrame(e:Event) {
// 处理鼠标旋转
var disX:int=gx-tx;
var disY:int=gy-ty;
var angle:Number=Number(Math.atan(disY/disX)*180/Math.PI);// atan返回的是弧度值,要转换为角度值
//if (disX == 0) { 这里不需要处理 这点是特殊点 可以忽略不计
//if(disY>=0){
//
//angle=90}else{
//
//angle=270
//
//
//
//}
//}
//
if (disX>0) {
//do nothing
}
if (disX<0) {
 
相关文档:
All metal heart shaped necklace containing an 8 GB USB flash drive.
These days a
USB flash drive
is as necessary as your house keys. Whether you are
taking large work files back and forth from the office or are sharing pictures
and music with friends, nothing beats the convenience of a USB ......
function getFlashVer() {//获得flashplayer的版本 google
var f="",n=navigator;
if (n.plugins && n.plugins.length) {
for (var ii=0;ii<n.plugins.length;ii++) {
if (n.plugins[ii].name.indexOf('Shockwave Flash')!=-1) {
f=n.plu ......
做了一个弹出窗口,点击后发现它和flash重合的部分,被flash盖住了,查了一下解决方法:
原代码如下:
<object classid='clsid:D27CDB6E-AE6D-11CF-96B8-444553540000' id='obj6' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0' border='0' width='266' height='1 ......
NOR和NAND是现在市场上两种主要的非易失闪存技术。Intel于1988年首先开发出NOR flash技术,彻底改变了原先由EPROM和EEPROM一统天下的局面。紧接着,1989年,东芝公司发表了NAND flash结构,强调降低每比特的成本,更高的性能,并且象磁盘一样可以通过接口轻松升级。但是经过了十多年之后,仍然有相当多的硬件工程师分不清 ......