addFrameScript用法
如何判断一个mc播放完毕之后remove掉他呢,
目前我发现的两种做法,一种是:
var boomMc:MovieClip = LoadResource.getMC("boom",LoadResource.resourceDm);
boomMc.id = x+":"+y;
gameManager.gameWord.uiLayer.addChild(boomMc);
var nxy:Point = Node.getPostionByXY(x,y);
var p:Point = this.localToGlobal(nxy);
boomMc.x = p.x;
boomMc.y = p.y;
boomMc.addEventListener(Event.ENTER_FRAME,_enterFrame);
}
private function _enterFrame(evt:Event):void
{
var boom:MovieClip = evt.target as MovieClip;
if(boom.currentFrame == boom.totalFrames)
{
boomsPlayFinishedNo ++;
boom.parent && boom.parent.removeChild(boom);
boom.removeEventListener(Event.ENTER_FRAME,_enterFrame);
}
}
另一种高大上的方法是:
/**
* NodeView 点击函数
*/
public function nodeClickHandler(node:Node):void
{
if(node.type == Node.TYPE_BOMBSHELL)
{
BattleEffectUtil.vibrationScreen(gameManager.gameWord);
var boomAll:MovieClip = LoadResource.getMC("boomAll",LoadResource.resourceDm);
function _remove():void
{
boomAll.parent && boomAll.parent.removeChild(boomAll);
}
boomAll.addFrameScript(boomAll.totalFrames-,_remove);
gameManager.gameWord.uiLayer.addChild(boomAll);
var nxy:Point = Node.getPostionByXY(node.x,node.y);
var p:Point = gameManager.uiManager.gridView.localToGlobal(nxy);
boomAll.x = p.x;
boomAll.y = p.y;
}
}
addFrameScript用法的更多相关文章
- EditText 基本用法
title: EditText 基本用法 tags: EditText,编辑框,输入框 --- EditText介绍: EditText 在开发中也是经常用到的控件,也是一个比较必要的组件,可以说它是 ...
- jquery插件的用法之cookie 插件
一.使用cookie 插件 插件官方网站下载地址:http://plugins.jquery.com/cookie/ cookie 插件的用法比较简单,直接粘贴下面代码示例: //生成一个cookie ...
- Java中的Socket的用法
Java中的Socket的用法 Java中的Socket分为普通的Socket和NioSocket. 普通Socket的用法 Java中的 ...
- [转载]C#中MessageBox.Show用法以及VB.NET中MsgBox用法
一.C#中MessageBox.Show用法 MessageBox.Show (String) 显示具有指定文本的消息框. 由 .NET Compact Framework 支持. MessageBo ...
- python enumerate 用法
A new built-in function, enumerate() , will make certain loops a bit clearer. enumerate(thing) , whe ...
- [转载]Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法总结
本文对Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法进行了详细的总结,需要的朋友可以参考下,希望对大家有所帮助. 详细解读Jquery各Ajax函数: ...
- 【JavaScript】innerHTML、innerText和outerHTML的用法区别
用法: <div id="test"> <span style="color:red">test1</span> tes ...
- chattr用法
[root@localhost tmp]# umask 0022 一.chattr用法 1.创建空文件attrtest,然后删除,提示无法删除,因为有隐藏文件 [root@localhost tmp] ...
- 萌新笔记——vim命令“=”、“d”、“y”的用法(结合光标移动命令,一些场合会非常方便)
vim有许多命令,网上搜有一堆贴子.文章列举出各种功能的命令. 对于"="."d"."y",我在无意中发现了它们所具有的相同的一些用法,先举 ...
随机推荐
- Linux /python --- zipinfo命令
Linux zipinfo命令用于列出压缩文件信息. 执行zipinfo指令可得知zip压缩文件的详细信息. zipinfo [-12hlmMstTvz][压缩文件][文件...][-x <范本 ...
- Django使用本地css/js文件
Django使用本地css/js文件 在manager.py同层级下创建static文件夹, 里面放上css , js, images等文件或者文件夹 我的文件夹层级 然后只需在settings.py ...
- Windows10系统远程桌面连接出现卡顿如何解决
最新的windows10系统下,用户只要开启远程桌面连接,就能够轻松地操控其他电脑.但是,最近部分用户在win10中启用远程连接时,发现电脑窗口变得非常缓慢卡顿,这是怎么回事呢?其实,该问题与系统的设 ...
- git如何自动打补丁
答:git am --reject jello.patch (如果打补丁失败,会自动生成rej文件)
- Vim编程常用命令
1.全文覆盖 程序发布到测试.开发环境后,经常需要远程登录Linux更改代码.平时在IDE中直接Ctrl+A.Ctrl+V覆盖整个文档,在vim中需要这样做 vim filename gg --跳到首 ...
- String StringBuilder StringBuffer 对比 总结得非常好
转自:http://www.iteye.com/topic/522167 作者:每次上网冲杯Java时,都能看到关于String无休无止的争论.还是觉得有必要让这个讨厌又很可爱的String美眉,赤裸 ...
- JQuery Ajax jsonp
JQuery ajax jsonp $.ajax({ method:"POST", url:"http://localhost:8081/ChenLei/PeopleSe ...
- 51nod 1289 大鱼吃小鱼
#include<bits/stdc++.h> using namespace std; ; int a[maxn],b[maxn]; stack<int>s; int mai ...
- Redis之Sorted Set 有序集合
Redis Sorted Set 有序集合 Redis 有序集合和集合一样也是string类型元素的集合,且不允许重复的成员. 不同的是每个元素都会关联一个double类型的分数.redis正是通过分 ...
- Binary Tree Zigzag Level Order Traversal,z字形遍历二叉树,得到每层访问的节点值。
问题描述: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from l ...