探索AS3.0中精灵对象的属性操作与效果实现
在AS3.0编程中,操作精灵(Sprite)对象的属性可以实现各种各样有趣的效果。下面我们将详细介绍如何通过修改精灵对象的不同属性,如大小、可见性、旋转等,来实现不同的交互效果。
1. 调整精灵大小
我们可以使用 scaleX 和 scaleY 属性来使角色变大或变小,就像《爱丽丝梦游仙境》里的情节一样。具体操作步骤如下:
1. 在 GameWorld.as 文件中添加以下新代码:
package
{
import flash.net.URLRequest;
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.MouseEvent;
[SWF(width="550", height="400",
backgroundColor="#FFFFFF", frameRate="60")]
public class GameWorld extends Sprite
{
//All the variable declarations...
public function GameWorld()
{
//All the code that creates, displays
//and positions the objects...
//
超级会员免费看
订阅专栏 解锁全文
1927

被折叠的 条评论
为什么被折叠?



