2012-12-28 43 views
-1

我對CCMenu有一個操作,該操作是CCLayer的子操作 - 他是scroller的孩子。 (cocos2d的滾動層類)無法在cocos2d中停止操作

有一個動作在此CCMenu上運行,它有一個名稱和一個標記。

我只是不能阻止它。當我試圖去它,我看到空值。 我試過了:

[[[CCDirector sharedDirector].runningScene getChildByTag:600] stopAction:repeat]; 
[[[[CCDirector sharedDirector].runningScene getChildByTag:600]getChildByTag:800 ]stopAction:repeat]; 
[[[CCDirector sharedDirector].runningScene getChildByTag:600] stopAllActions]; 

[self stopAllActions]; 

什麼都沒有。 無法停止該操作。 如何停止我的CCScene中的所有操作?

+0

您只查看當前正在運行的場景的子項,這將是其中一個圖層(滾動條?)。我認爲您需要深入到節點層次結構中才能進入CCMenu。據我所知,「getChildByTag:」只能傳給直接的孩子,而不是孩子的孩子。 – Sylvan

回答

0

您可能會嘗試如下操作:

// 1。將標籤分配到你的動作如:

id action = [CCRotateBy actionWithDuration:10.0f angle:90.0f]; 
[action setTag:1001]; 

運行動作:

[menu runAction:action]; 

,當你想停止它在的地方ccmenu的調用

[menu stopActionByTag: 1001]; 
-1

使用的菜單名稱

ccmenu-> stopAllAction();