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) {
 
相关文档:
声明:本文以MSP430F2122为例说明Flash读写操作。
一、MSP430F2122的FLASH结构
FLASH模块结构图如图一
图一
MSP430 FLASH型单片机的FLASH存储器分为主存储器和信息存储器。主存储器根据 ......
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 ......
做了一个弹出窗口,点击后发现它和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 flash的区别没有什么概念,看了这篇文章,有了一个大要的了解,我的板子上的是NOR
falsh和DRAM,到于DRAM是什么东西,和flash的区别,在另一篇文章中有说明,很基础的东西,了解一下很有好处。个人理解,NOR类型的
flash一般来相当于计算机的内存,不过是可以存储数据的,而 ......
转自:http://www.laolang.cn/back-end-develop/flash-builder-4-blazeds-db-application.html
1.使用Eclipse 建立一个Java Project。编写好远程服务类(如附件)。
2.下载Download the BlazeDS binary distribution,解压到tomcat的webapps目录下。下载flex-rds-server.jar,它是BlazeDS 4(开发中)中的一个包,是Bl ......