仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 722|回复: 8
打印 上一主题 下一主题

[学习教程] 给大家带来Flash AS3教程:随图片巨细而静态改动的图框-Flash actionscript

[复制链接]
再现理想 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-15 20:39:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
另外在属性面板中还增加了一个“设备”设置选项,需要说明的是“设备”设置功能在FlashPlayer环境中不能使用,需要FlashLite1.0或FlashLite1.1的支持才可以。
Poluoluo中心提醒:这是一个为图片加框的效果,画框根据图片的巨细而静态改动。
 这是一个为图片加框的效果,画框根据图片的巨细而静态改动。(单击上面能够看到效果)

演示:
[media=wmv,550,420][/media]

1、新建一个Flash文件,宽、高设置为550*420,背景玄色。

2、筹办4张巨细分歧规格的图片,最年夜的宽、高不要凌驾530*380。

3、导进图片:在文件菜单选导进=>导进到库。如:

4、图层1,更名为图片。拖第一个图片到舞台将它转换成影片剪辑。定名”Image1″设定注册点居中。如:

5、反复第4步,拖进别的的3张图片到舞台,恣意摆放。定名”Image2″,”Image3″,”Image4″,库面板如:

6、给舞台上的实例定名“image1”至“image4”。

7、埋没图层1,增加图层2。:

8、图层2更名为边框,用矩形工具,添补色克制,笔触红色,高度为4像素,画一个长方形边框。

9、将长方形转换为影片剪辑,设置注册点居中。舞台实例定名为“imageBorder”。:

10、增加图层3,定名为as,输出代码:
//ImportTweenMax(weuseitforanimation)

importgs.*;



//Savethecentercoordinatesofthestage

varcenterX:uint=stage.stageWidth/2;

varcenterY:uint=stage.stageHeight/2;



//Let’saddtheimagestoanarray

varimagesArray:Array=newArray(image1,image2,image3,image4);



//Thisvariablewillstorethecurrentimagedisplayed

varcurrentImage:MovieClip=null;



//Maketheborderinvisibleatfirst

imageBorder.alpha=0;



//Loopthroughthearrayelements

for(vari:uint=0;i<imagesArray.length;i++){



//Wewantalltheimagestobeinvisibleatthebeginning

imagesArray.alpha=0;



//Savetheindexoftheimagetoavariablecalled"imageIndex"

imagesArray.imageIndex=i;

}



//Welistenwhentheuserclicksthemouseonthestage

stage.addEventListener(MouseEvent.CLICK,stageClicked);



//Thisfunctioniscalledwhentheuserclicksthestage

functionstageClicked(e:MouseEvent):void{



//Checkthatthecurrentimageisnotnull

if(currentImage!=null){



//Animatethecurrentimageaway

TweenMax.to(currentImage,1,{alpha:0});



//ChecktoseeifweareattheendoftheimagesArray

if(currentImage.imageIndex==imagesArray.length-1){



//SetthefirstimageofthearraytobeourcurrentImage

currentImage=imagesArray[0];



}else{

//Wearenotattheendofthearray,sogetthenextimagefromthearray

currentImage=imagesArray[currentImage.imageIndex+1];

}



}else{

//IfthecurrentImageisnull(=wejuststartedthemovie),wesetthefirstimageinthearray

//tobeourcurrentimage.

currentImage=imagesArray[0];



//Settheborder’salphato0.5

imageBorder.alpha=0.5;

}



//Positionthecurrentimageandthebordertothecenterofthestage

currentImage.x=imageBorder.x=centerX;

currentImage.y=imageBorder.y=centerY;



//Animatetheborder’swidthandheightaccordingtothecurrentimage’sdimensions.

//Wealsoanicegloweffecttotheimageborder

TweenMax.to(imageBorder,0.5,{width:currentImage.width+8,height:currentImage.height+8,

glowFilter:{color:Math.random()*0xffffff,alpha:1,blurX:20,blurY:20,strength:100,quality:1}});



//AnimatethecurrentImage’salpha

TweenMax.to(currentImage,1,{alpha:1});

}
11、全体竣工,测试影片。注重:把gs类库保留在fla统一目次下。

源文件、gs类库.rar
与位图图形相比,矢量图形需要的内存和存储空间小很多,因为它们是以数学公式而不是大型数据集来表示的。位图图形之所以更大,是因为图像中的每个像素都需要一组单独的数据来表示。
山那边是海 该用户已被删除
沙发
发表于 2015-1-17 13:34:44 来自手机 | 只看该作者
Flash流行的主要原因是它使用了矢量图形(与位图相反)。因为这种图形格式比位图小得多,而且在缩放时对图形质量影响不大,所以很适合对带宽要求很高的Web。
透明 该用户已被删除
板凳
发表于 2015-1-25 09:35:29 | 只看该作者
商业上的优势——品牌flash的创造;公司企业的flash宣传;flash技术在电视的应用
小魔女 该用户已被删除
地板
发表于 2015-2-2 21:48:56 | 只看该作者
还有,艺术上的优势——各异的风格;创作手法独特;独立性和原创性;拓展出新的表达空间;
莫相离 该用户已被删除
5#
发表于 2015-2-8 08:15:00 | 只看该作者
一个物体从一个角(关键祯1)移动到另一个角(关键祯2)。然后tweening在关键祯之间填充祯,从而使物体可以在屏幕上优雅地运动。
爱飞 该用户已被删除
6#
发表于 2015-2-25 08:57:46 | 只看该作者
考虑到实际的效果,这些专业的网站并不会去单纯追求技术本身,广告设计是否FLASH不是目的,关键是获得最好的宣传效果。
只想知道 该用户已被删除
7#
发表于 2015-3-7 21:55:48 | 只看该作者
不能制作色彩丰富变化的图像,核心竞争力小,而且有一定的局限性。要想制作优秀的动画,就要充分了解软件的优点和缺陷。
若天明 该用户已被删除
8#
发表于 2015-3-15 19:37:43 | 只看该作者
关于位图和矢量图形的区别,可参看Flash教程。
柔情似水 该用户已被删除
9#
发表于 2015-3-22 04:41:47 | 只看该作者
广告本身无法看到网址链接,不利于网站本身的搜索引擎优化,对增加网站排行的权重没有意义。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-12 23:30

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表