<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Tag: button - Recent Posts</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/button</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 02:23:10 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/tags/button" rel="self" type="application/rss+xml" />

		<item>
			<title>YannickL on "CCControl for Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19915#post-141779</link>
			<pubDate>Sun, 29 Jan 2012 21:12:00 +0000</pubDate>
			<dc:creator>YannickL</dc:creator>
			<guid isPermaLink="false">141779@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi folks! ;)</p>
<p>I just wanted to tell you that I updated the CCControlExtension repo (<a href="https://github.com/YannickL/CCControlExtension" rel="nofollow">https://github.com/YannickL/CCControlExtension</a>) to add the CCControlColourPicker with the permission of @<a href='http://www.cocos2d-iphone.org/forum/profile/74476'>creativewax</a> and @<a href='http://www.cocos2d-iphone.org/forum/profile/1222'>abitofcode</a>. ;)<br />
I also re-designed the project and added the blocks management in addition to the target-pair action. You can see some screenshots here:</p>
<p><img src="http://github.com/YannickL/CCControlExtension/raw/master/screenshots/slider.png" alt="CCControlSlider" /><br />
<img src="http://github.com/YannickL/CCControlExtension/raw/master/screenshots/colorpicker.png" alt="CCControlColourPicker" /><br />
<img src="http://github.com/YannickL/CCControlExtension/raw/master/screenshots/button.png" alt="CCControlButton" /></p>
<p>I hope it'll useful for other people. ;)</p>
<p>(I made a lot of refactoring since the last time and I can't edit my first post to update the links. :!)<br />
Thank you for your support!
</p></description>
		</item>
		<item>
			<title>MartineC on "Frame not found? Console isn&#039;t updating?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28172#post-138668</link>
			<pubDate>Sun, 08 Jan 2012 20:04:44 +0000</pubDate>
			<dc:creator>MartineC</dc:creator>
			<guid isPermaLink="false">138668@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Great!!! I'll try that, thanks a lot!!!
</p></description>
		</item>
		<item>
			<title>knightkrows on "Frame not found? Console isn&#039;t updating?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28172#post-138594</link>
			<pubDate>Sun, 08 Jan 2012 06:00:02 +0000</pubDate>
			<dc:creator>knightkrows</dc:creator>
			<guid isPermaLink="false">138594@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>You need to add button_s.png and button_b.png in frame cache first.</p>
<p>It should be something like this:</p>
<pre><code>CCTexture2D *tex = [[CCTextureCache sharedTextureCache] addImage:@&#34;button_s.png&#34;];

    CCSpriteFrame *frame = [CCSpriteFrame frameWithTexture:tex rect:CGRectMake(0, 0, tex.contentSize.width, tex.contentSize.height)];
    [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFrame:frame name:@&#34;button_s.png&#34;];</code></pre>
<p>then you can use</p>
<p><code>[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@&#34;button_s.png&#34;]</code></p>
<p>A better approach would be, using texture packer tool.</p>
<p>Thanks,<br />
knightkrows
</p></description>
		</item>
		<item>
			<title>MartineC on "Frame not found? Console isn&#039;t updating?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28172#post-138582</link>
			<pubDate>Sun, 08 Jan 2012 00:44:01 +0000</pubDate>
			<dc:creator>MartineC</dc:creator>
			<guid isPermaLink="false">138582@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm following a great tutorial by Todd Perkins. </p>
<p>The build succeeded, but the simulator doesn't show everything. The buttons for the menu doesn't show up.</p>
<p> I looked in the console and this is the error:</p>
<p>1-2012-01-07 18:26:57.507 GameTest[2043:207] cocos2d: CCSpriteFrameCache: Frame 'button_b.png' not found<br />
2-2012-01-07 18:26:57.509 GameTest[2043:207] I'm in the super initwithtext method<br />
3-2012-01-07 18:26:57.510 GameTest[2043:207] cocos2d: CCSpriteFrameCache: Frame 'button_b.png' not found<br />
4-2012-01-07 18:26:57.513 GameTest[2043:207] I'm in the super initwithtext method<br />
5-2012-01-07 18:26:57.516 GameTest[2043:207] cocos2d: CCSpriteFrameCache: Frame 'button_b.png' not found<br />
6-2012-01-07 18:26:57.517 GameTest[2043:207] I'm in the super initwithtext method<br />
7-2012-01-07 18:26:57.518 GameTest[2043:207] cocos2d: CCSpriteFrameCache: Frame 'button_b.png' not found<br />
8-2012-01-07 18:26:57.519 GameTest[2043:207] I'm in the super initwithtext method<br />
9-2012-01-07 18:26:57.536 GameTest[2043:207] cocos2d: Frame interval: 1<br />
Terminating in response to SpringBoard's termination.</p>
<p>I tried to change the NSLog for "I'm in", I added a button called "button_s.png" but it's not<br />
updating anything. I tried to close and reopen my project but the same error is showing up.</p>
<p>In GameButton.h, it's this:</p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;

@interface GameButton : CCSprite{

}

+(id)buttonWithText: (NSString *)buttonText isBig:(BOOL)big;
+(id)buttonWithText: (NSString *)buttonText;

-(id)initWithText:(NSString*) buttonText isBig:(BOOL)big;

@end</code></pre>
<p>The code in GameButton.m</p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;GameButton.h&#34;

@implementation GameButton

+(id)buttonWithText:(NSString *)buttonText isBig:(BOOL)big
{
	return[[[GameButton alloc]initWithText:buttonText isBig:big] autorelease];
}

+(id)buttonWithText:(NSString *)buttonText
{
	return [[[GameButton alloc]initWithText:buttonText isBig:NO] autorelease];
}

-(id)initWithText:(NSString *)buttonText isBig:(BOOL)big

{
	if((self== [super init]))
	   {
		   NSString *btnFrame = (big) ? @&#34;button_b.png&#34; : @&#34;button_s.png&#34;;
		   int fSize = 12;
		   [self setDisplayFrame:[[CCSpriteFrameCache sharedSpriteFrameCache]
								  spriteFrameByName:btnFrame]];
		   CCLabelTTF *label =[CCLabelTTF labelWithString:buttonText fontName:@&#34;Arial&#34;
												 fontSize:fSize +big * fSize];
		   label.position = ccp(self.contentSize.width/2, self.contentSize.height/2);
		   [self addChild:label z:1];
		   CCLabelTTF *labelShadow = [CCLabelTTF labelWithString:buttonTextfontName:@&#34;Arial&#34; fontSize:fSize + big *fSize];
		   labelShadow.position = ccp(self.contentSize.width/2 - (2 + big *2),self.contentSize.height/2);
		   labelShadow.color = ccBLACK;
		   labelShadow.opacity = 150;
		   [self addChild:labelShadow];
		   NSLog(@&#34;I&#039;m in&#34;);
		}
	   return self;
}

@end</code></pre>
<p>I already checked in the target folder if the button.s and button.b are there and they are.</p>
<p>I really don't know where to look now. You have an idea? Maybe it's the xcode version I have, 3.2.6?<br />
The tutorial I'm following is version 4, does it make a big difference?  I can't have version 4 because my mac is 10.6.8 snow leopard.
</p></description>
		</item>
		<item>
			<title>craftyAct on "CCMenuItemImage button is not responding."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27963#post-137498</link>
			<pubDate>Sun, 01 Jan 2012 08:07:47 +0000</pubDate>
			<dc:creator>craftyAct</dc:creator>
			<guid isPermaLink="false">137498@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Not sure if I'm following you on this.  menuGoodByeT is a background for the buttons?  Do the other buttons work if you remove it from the menu?<br />
If it's a background for the buttons, why don't you just add it as a sprite behind the menu using the z-order property.  I'm not sure you can vary the z-order within a menu so there could be a conflict when you have overlapping CGRect receiving touches.
</p></description>
		</item>
		<item>
			<title>efutoran on "Bug: SMS in Landscape mode is showing a black line where cancel button should be"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27972#post-137408</link>
			<pubDate>Sat, 31 Dec 2011 02:28:50 +0000</pubDate>
			<dc:creator>efutoran</dc:creator>
			<guid isPermaLink="false">137408@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>When you go to send a SMS message in landscape mode, the bar containing the "Cancel" button is pushed up and off the screen and a black line is showing in its place.  Not so good if people cant cancel!</p>
<p>Help!</p>
<p>A picture to help!<br />
[IMG]http://i40.tinypic.com/25iu9o8.png[/IMG]</p>
<p><a href="http://tinypic.com/r/25iu9o8/5" rel="nofollow">http://tinypic.com/r/25iu9o8/5</a>
</p></description>
		</item>
		<item>
			<title>ranT4 on "CCMenuItemImage button is not responding."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27963#post-137360</link>
			<pubDate>Fri, 30 Dec 2011 17:29:23 +0000</pubDate>
			<dc:creator>ranT4</dc:creator>
			<guid isPermaLink="false">137360@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>anyone ?</p>
<p>any idea of how do display the menu sheet that behinds the buttons, But not as a sprite ?</p>
<p>if i add it as a menuItem, it is above my buttons and i cant see them OR i cant push them- as i wrote here .</p>
<p>this is very strange that there is no menu instance to the menu sheet that behinds the buttons.
</p></description>
		</item>
		<item>
			<title>ranT4 on "CCMenuItemImage button is not responding."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27963#post-137332</link>
			<pubDate>Fri, 30 Dec 2011 12:47:08 +0000</pubDate>
			<dc:creator>ranT4</dc:creator>
			<guid isPermaLink="false">137332@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>i know what the problem is now , but cant understand how to solve that.</p>
<p>the menuGoodByeT is the image sheet which all the buttons is setting on- and they are in the same position.<br />
menuB,tryAgainB are the buttons.</p>
<p>if i do:</p>
<p>menu = [CCMenu menuWithItems:menuGoodByeT,menuB,tryAgainB, nil];</p>
<p>i can see the buttons and the image that under them but they dont work.</p>
<p>if i do :</p>
<p>menu = [CCMenu menuWithItems:menuB,tryAgainB, menuGoodByeT,nil];</p>
<p>so the buttons are under the menuGoodByeT image BUT THEY ARE WORKING ! (but i cant see them)</p>
<p>so what can i do to add an image menu , which above it will be the button ???</p>
<p>every menu have an image under the buttons, and cocos just doesnt let me put an image under them because then they are not working !</p>
<p>how can i do that ?</p>
<p>thanks .
</p></description>
		</item>
		<item>
			<title>JanuszNSG on "CCMenuItemImage button is not responding."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27963#post-137328</link>
			<pubDate>Fri, 30 Dec 2011 11:43:37 +0000</pubDate>
			<dc:creator>JanuszNSG</dc:creator>
			<guid isPermaLink="false">137328@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello<br />
1:<br />
menu = [CCMenu menuWithItems: menuB,tryAgainB, menuGoodByeT, nil];<br />
(no menu object in list and all elements on it), but you correct it in second post.<br />
2:<br />
Just for test replace in one element selectedImage with different file, and check if even touch is received by menu object (maybe is covered by other layer)<br />
3:<br />
You call methods with parameters (: - after name) can you post code of one of method witch is used as selector for menu item?
</p></description>
		</item>
		<item>
			<title>ranT4 on "CCMenuItemImage button is not responding."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27963#post-137326</link>
			<pubDate>Fri, 30 Dec 2011 11:26:27 +0000</pubDate>
			<dc:creator>ranT4</dc:creator>
			<guid isPermaLink="false">137326@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>on the menu i wasnt copy it right , and i have:</p>
<p>menu = [CCMenu menuWithItems:menuGoodByeT,menuB,tryAgainB, nil];</p>
<p>still doesnt work.
</p></description>
		</item>
		<item>
			<title>ranT4 on "CCMenuItemImage button is not responding."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27963#post-137324</link>
			<pubDate>Fri, 30 Dec 2011 11:24:14 +0000</pubDate>
			<dc:creator>ranT4</dc:creator>
			<guid isPermaLink="false">137324@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>buttons and menu are on screen but nothing happen when buttons pushed:</p>
<p>'<br />
   CCMenuItemImage *menuB = [CCMenuItemImage itemFromNormalImage:@"menuB.png" selectedImage:@"menuB.png" target:self selector:@selector(goMenu:)];<br />
    CCMenuItemImage *tryAgainB = [CCMenuItemImage itemFromNormalImage:@"tryAgainB.png" selectedImage:@"tryAgainB.png" target:self selector:@selector(tryAgain:)];<br />
    CCMenuItemImage *menuGoodByeT = [CCMenuItemImage itemFromNormalImage:@"menu.png" selectedImage:@"menu.png" target:self selector:@selector(nothing:)];</p>
<p>    menuB.position=ccp(-65,-40);<br />
    tryAgainB.position=ccp(15,-40);</p>
<p>    menu = [CCMenu menuWithItems:menu,menuB,tryAgainB, nil];<br />
     menu.isTouchEnabled = YES;<br />
    [self addChild: menu];<br />
'</p>
<p>yes, the method is having : id sender .<br />
whats wrong with this menus ?? it some how always has problems.
</p></description>
		</item>
		<item>
			<title>Ricardo on "How to get touch position on the CCMenuItemImage?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/14150#post-129423</link>
			<pubDate>Mon, 28 Nov 2011 02:02:35 +0000</pubDate>
			<dc:creator>Ricardo</dc:creator>
			<guid isPermaLink="false">129423@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>roko, I had the same problem because I wanted to detect not only the clicked menu items but also swipes with origin on that items (via <code>ccTouchesMoved:</code>).<br />
To be able to detect the touch events:</p>
<ul>
<li>ccTouchesBegan:</li>
<li>ccTouchesMoved:</li>
<li>ccTouchesEnded:</li>
</ul>
<p>I had to extend <code>CCMenu</code> and override <code>registerWithTouchDispatcher:</code> since it was "swalling" all events!<br />
Here you have the code:</p>
<pre><code>// Configures menu to keep trowing touch events BUT not swallow them.
  -(void) registerWithTouchDispatcher
  {
  	[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:kCCMenuTouchPriority swallowsTouches:NO];
  }</code></pre>
<p>I've started by just changing "<code>swallowsTouches:YES</code>" to "<code>swallowsTouches:NO</code>" in the "<code>CCMenu.m</code>" source code, but I recommend you to do not change the Cocos2d sources, since that can generate other side effects if you have other menus.
</p></description>
		</item>
		<item>
			<title>cocos on "CCMenuItem unselected &#039;EXC_BAD_ACCESS&#039; and CCCallFunc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23729#post-128956</link>
			<pubDate>Sun, 27 Nov 2011 04:18:30 +0000</pubDate>
			<dc:creator>cocos</dc:creator>
			<guid isPermaLink="false">128956@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Ok. Very cosmetic change should make CCScrollLayer extension work again:</p>
<p>Just by looking at the CCScrollLayer:</p>
<pre><code>@interface CCTouchDispatcher (targetedHandlersGetter)

//- (NSMutableArray *) targetedHandlers;
- (CCArray	 *) targetedHandlers;

@end

@implementation CCTouchDispatcher (targetedHandlersGetter)

//- (NSMutableArray *) targetedHandlers
- (CCArray	 *) targetedHandlers
{
	return targetedHandlers;
}

@end</code></pre>
<pre><code>// and the only place when internal array is used:

//	for ( CCTargetedTouchHandler *handler in [[CCTouchDispatcher sharedDispatcher] targetedHandlers] )

    CCTargetedTouchHandler *handler;
    CCArray array = [[CCTouchDispatcher sharedDispatcher] targetedHandlers];
    CCARRAY_FOREACH(array, handler) {
   //...
   }</code></pre></description>
		</item>
		<item>
			<title>principe on "CCMenuItem unselected &#039;EXC_BAD_ACCESS&#039; and CCCallFunc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23729#post-128951</link>
			<pubDate>Sun, 27 Nov 2011 03:39:23 +0000</pubDate>
			<dc:creator>principe</dc:creator>
			<guid isPermaLink="false">128951@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I found the issue. The CCScrollLayer extension uses NSMutableArrays instead of CCArrays.
</p></description>
		</item>
		<item>
			<title>cocos on "CCMenuItem unselected &#039;EXC_BAD_ACCESS&#039; and CCCallFunc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23729#post-128948</link>
			<pubDate>Sun, 27 Nov 2011 03:20:34 +0000</pubDate>
			<dc:creator>cocos</dc:creator>
			<guid isPermaLink="false">128948@http://www.cocos2d-iphone.org/forum/</guid>
			<description><pre><code>Pasting the new CCTouchDispatchers disables sliding for the CCScrollLayer</code></pre>
<p>Hm, strange. It should be 100% compatible with old one minus bugs.</p>
<p>One can always check the dispatcher arrays content using debug functionality:</p>
<p>//--------------------------------------------<br />
//		debug<br />
//--------------------------------------------</p>
<p>/** prints debug info about handlers. If format = 1, info about delegate is added.<br />
 If 'after' = YES, the debug log is printed after all callback requests to the touch dispatcher<br />
 have been processed. In this case the return value is equal to -1.<br />
 If requested outside a touch callback it returns the number of the handlers' objects of the given type.<br />
 It is equal to the count of the printed handlers.<br />
   @since v1.1.0<br />
 */<br />
<pre><code>- (int) printDebugLog:(int)format afterEvents:(BOOL)after type:(ccDispatcherDelegateType)type;</code></pre>
<p>E.g:<br />
<pre><code>[[CCTouchDispatcher sharedDispatcher] printDebugLog:1 afterEvents:NO type:kCCTargeted];
[[CCTouchDispatcher sharedDispatcher] printDebugLog:1 afterEvents:NO type:kCCStandard];</code></pre></description>
		</item>
		<item>
			<title>principe on "CCMenuItem unselected &#039;EXC_BAD_ACCESS&#039; and CCCallFunc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23729#post-128947</link>
			<pubDate>Sun, 27 Nov 2011 03:13:11 +0000</pubDate>
			<dc:creator>principe</dc:creator>
			<guid isPermaLink="false">128947@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thank you so much for the reply!</p>
<p>Pasting the new CCTouchDispatchers disables sliding for the CCScrollLayer. Any idea about this? It looks like this may be the solution though.
</p></description>
		</item>
		<item>
			<title>cocos on "CCMenuItem unselected &#039;EXC_BAD_ACCESS&#039; and CCCallFunc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23729#post-128941</link>
			<pubDate>Sun, 27 Nov 2011 01:39:09 +0000</pubDate>
			<dc:creator>cocos</dc:creator>
			<guid isPermaLink="false">128941@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/20033'>principe</a> You may try this new files for the dispatcher and see if it helps:</p>
<p><a href="http://dl.dropbox.com/u/31198855/CCTouchDispatcher.m" rel="nofollow">http://dl.dropbox.com/u/31198855/CCTouchDispatcher.m</a><br />
<a href="http://dl.dropbox.com/u/31198855/CCTouchDispatcher.h" rel="nofollow">http://dl.dropbox.com/u/31198855/CCTouchDispatcher.h</a><br />
<a href="http://dl.dropbox.com/u/31198855/CCTouchHandler.m" rel="nofollow">http://dl.dropbox.com/u/31198855/CCTouchHandler.m</a><br />
<a href="http://dl.dropbox.com/u/31198855/CCTouchHandler.h" rel="nofollow">http://dl.dropbox.com/u/31198855/CCTouchHandler.h</a></p>
<p>(The files go to: /cocos2d/Platforms/iOS directory)</p>
<p>You may have a race condition. Try this to protect your touch callbacks:</p>
<pre><code>if ([_sender isKindOfClass:[CCMenuItemSprite class]]) {
    sender = _sender;

    [[CCTouchDispatcher sharedDispatcher] disableDelegate:sender disable:YES type:kCCTargeted]; // disable the delegate
    [[CCTouchDispatcher sharedDispatcher] removeDelegate:sender delay:NO type:kCCTargeted];  // remove it

    [sender removeFromParentAndCleanup: YES];
}</code></pre></description>
		</item>
		<item>
			<title>baris on "CCMenuItem unselected &#039;EXC_BAD_ACCESS&#039; and CCCallFunc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23729#post-128940</link>
			<pubDate>Sun, 27 Nov 2011 01:35:02 +0000</pubDate>
			<dc:creator>baris</dc:creator>
			<guid isPermaLink="false">128940@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Could you be overriding the enter or exit methods (can't remember their exact names right now) in a scene or a layer, and forgetting to call the super's method?</p>
<p>I once had a very similar crash issue driving me nuts, and realized this was what I was doing wrong after a week or so :/
</p></description>
		</item>
		<item>
			<title>principe on "CCMenuItem unselected &#039;EXC_BAD_ACCESS&#039; and CCCallFunc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23729#post-128939</link>
			<pubDate>Sun, 27 Nov 2011 01:27:56 +0000</pubDate>
			<dc:creator>principe</dc:creator>
			<guid isPermaLink="false">128939@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Any tips? I've tested on a few devices, it's random on all devices. Is this an internal issue with cocos2d?
</p></description>
		</item>
		<item>
			<title>principe on "CCMenuItem unselected &#039;EXC_BAD_ACCESS&#039; and CCCallFunc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23729#post-128284</link>
			<pubDate>Wed, 23 Nov 2011 05:14:00 +0000</pubDate>
			<dc:creator>principe</dc:creator>
			<guid isPermaLink="false">128284@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey guys, I've been having problems with CCMenuItem and its timing with CCCallFunc.</p>
<p>Basically I'm getting 'EXC_BAD_ACCESS'</p>
<p>@ this line of the CCMenuItem class</p>
<pre><code>-(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event
{
    ...
    [selectedItem_ unselected]; // EXC_BAD_ACCESS
    [selectedItem_ activate];
    ...
}</code></pre>
<p>It seems the menu item is deallocated before the touch ends. I'm using CCCallFunc to call a 'removeThisSprite' method that removes it from the parent</p>
<p>so the last action of the CCMenuItem sequence I call:<br />
<pre><code>[CCCallFuncO actionWithTarget:self selector:@selector(removeThisSprite:) object: _currentButton]</code></pre>
<p>The removeThisSprite method is like this:</p>
<pre><code>CCMenuItemSprite2 *sender = nil;
sender.isEnabled = NO;

if ([_sender isKindOfClass:[CCMenuItemSprite class]]) {
    sender = _sender;
    [sender removeFromParentAndCleanup: YES];
}</code></pre>
<p>This generally happens when the player 'spams' the screen with taps, but doesn't happen unless the taps are rapid. Which is likely to occur with a game I'm making.
</p></description>
		</item>
		<item>
			<title>razvan_b on "[code] Button from sprite class"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22552#post-125174</link>
			<pubDate>Wed, 09 Nov 2011 11:07:49 +0000</pubDate>
			<dc:creator>razvan_b</dc:creator>
			<guid isPermaLink="false">125174@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello,<br />
Here is one of the classes i wrote yesterday and i plan to use it trough out the menus in the future games. It is not yet fully tested, so it might have some bugs. Also it can be greatly improved upon.<br />
<pre><code>//
//  ButtonsLayer.h
//

#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#60;Foundation/Foundation.h&#62;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;SimpleAudioEngine.h&#34;

@class WHButton;
/**
 @brief ButtonsLayer class is a class designed to handle a collection of WHButton.

 It provides a compact method for the creation of buttons from sprites.
 It also handles creation, handeling and memory moping.
 */
@interface ButtonsLayer : CCLayer
{
    /**
     The array containg all the WHButtons from this layer
     */
    NSMutableArray *m_ButtonsArray;
}
/**
 @brief This method creates a new WHButton from a sprite

 The button created by this method get&#039;s automaticaly added to this layer. 

 @param _sprite The sprite from wich the button is created. Must not be nil.
 @param _target The object whos methods are to be executed for OnTap and OnRelease events. Can be nil but renders the button useless as functionality.
 @param _onTap A selector for the OnTap event. Can be nil but renders the button useless
 @param _actionTap A CCAction to be ran on the _sprite for the tap event. Can be nil.
 @param _tapSound The name of the ressource file containing the sound effect to be played on the OnTap. Must be preloaded. Can be nil.
 @param _onRelease A selector for the OnRelease event. Can be nil
 @param _actionRelease A CCAction to be ran on the _sprite for the release event. Can be nil.
 @param _releaseSound The name of the ressource file containing the sound effect to be played on the OnRelease. Must be preloaded. Can be nil.
 @return void
*/
- (id) MakeButtonFromSprite:(CCSprite *)_sprite withTarget:(id)_target onTap:(SEL)_onTap tapAction:(CCAction*)_actionTap soundFile:(NSString*)_tapSound onRelease:(SEL)_onRelease releaseAction:(CCAction*)_actionRelease soundFile:(NSString*)_releaseSound;
@end

/**
 @brief WHButton class is a generic button class.

 Use like this:

 \&#60;declaration\&#62;
 FGButton *_myButton;

 \&#60;initialisation\&#62;
 _myButton = [[FGButton alloc] init];

 \&#60;setup\&#62;
 [_myButton SetSprite:_Sprite]; _Sprite - a valid sprite for the button

 \&#60;optional setup\&#62;
 [_myButton SetTarget:_Object];_object is the class who handels the events

 [_myButton SetOnTap:_OnTapSelector];_OnTapSelector a method of the _object who handles the on tap

 [_myButton SetOnTapAction:_Action];_Action is a CCAction to be run on the button sprite on the tap event

 [_myButton SetTapSoundFile:_file];_file filename of the soundfile effect to be played on tap

 [_myButton SetOnRelease:_OnReleaseSelector];_OnReleaseSelector a method of the _object who handles the on release

 [_myButton SetOnReleaseAction:_Action];_Action is a CCAction to be run on the button sprite on the release event

 [_myButton SetReleaseSoundFile:_file];_file filename of the soundfile effect to be played on release

 \&#60;usage\&#62;
 ...
 [_myButton CaptureTap:p]; for the ccTouchesBegin;

 [_myButton CaptureRelease:p]; For the ccTouchesEnd;

 \&#60;clean\&#62;
 [_myButton release];

 */

@interface WHButton  : CCNode &#60;CCTargetedTouchDelegate&#62;
{
    /**
     The target object for which the OnTap &#38;&#38; OnRelease functions is called.
     */
    id m_oTarget;
    SEL OnTap,/**&#60; The function (method of the target) to be called on the target for the TAP event. */
    OnRelease; /**&#60; The function (method of the target) to be called on the target for the RELEASE event. */
    /** The sprite of the button. */
    CCSprite *m_ButtonSprite;
    int m_nWidth, /**&#60; The Width of the button tap area. It gets automaticaly set with the button sprite, and is equal to the button&#039;s sprite width */
    m_nHeight, /**&#60; The Height of the button tap area. It gets automaticaly set with the button sprite, and is equal to the button&#039;s sprite height */
    m_nXPos, /**&#60; The X axis position of the button tap area. It gets automaticaly set with the button sprite, and is equal to the button&#039;s sprite x position */
    m_nYpos;/**&#60; The Y axis position of the button tap area. It gets automaticaly set with the button sprite, and is equal to the button&#039;s sprite Y axis position */
    id m_oOnTapAction, /**&#60;The CCAction to be executed on the button sprite for TAP Action */
    m_oOnReleaseAction;/**&#60;The CCAction to be executed on the button sprite for RELEASE Action */
    NSString *m_szTapSoundFile, /**&#60;The sound file name of the effect to be played on TAP*/
    *m_szReleaseSoundFile;/**&#60;The sound file name of the effect to be played on RELEASE*/
    /** Used to flag the tag display for the button ON/OFF*/
    BOOL m_bTagDisplay;
    CCLabelTTF *m_label;
    int m_FontSize;
}
/**
 If the tap has been done on the surface of the button then this returns YES. Also fires the action, sound etc.
 @param (UITouch *)t the touch event to be tested
 @returns YES or NO
 */
- (BOOL) CaptureTap:(UITouch *)t;
/**
 Fires the action, sound etc. for the release event
 @returns YES
 */
- (BOOL) CaptureRelease;

- (void) SetTag:(NSString *)text fontName:(NSString*)font fontColor:(ccColor3B)f_color fontSize:(int)size;
- (void) ShowTag;
- (void) HideTag;
/**
 Getter method
 */
- (id) Target;
/**
 Setter method
 */
- (void) SetTarget: (id) newValue;
/**
 Getter method
 */
- (CCSprite *) Sprite;
/**
 Setter method
 */
- (void) SetSprite: (CCSprite *) newValue;
/**
 Getter method
 */
- (int) Width;
/**
 Setter method
 */
- (void) SetWidth: (int) newValue;
/**
 Getter method
 */
- (int) Height;
/**
 Setter method
 */
- (void) SetHeight: (int) newValue;
/**
 Getter method
 */
- (int) XPos;
/**
 Setter method
 */
- (void) SetXPos: (int) newValue;
/**
 Getter method
 */
- (int) Ypos;
/**
 Setter method
 */
- (void) SetYpos: (int) newValue;
/**
 Getter method
 */
- (id) OnTapAction;
/**
 Setter method
 */
- (void) SetOnTapAction: (id) newValue;
/**
 Getter method
 */
- (id) OnReleaseAction;
/**
 Setter method
 */
- (void) SetOnReleaseAction: (id) newValue;
/**
 Getter method
 */
- (NSString *) TapSoundFile;
/**
 Setter method
 */
- (void) SetTapSoundFile: (NSString *) newValue;
/**
 Getter method
 */
- (NSString *) ReleaseSoundFile;
/**
 Setter method
 */
- (void) SetReleaseSoundFile: (NSString *) newValue;
/**
 Getter method
 */
- (SEL) OnRelease;
/**
 Setter method
 */
- (void) SetOnRelease: (SEL) newValue;
/**
 Getter method
 */
- (SEL) OnTap;
/**
 Setter method
 */
- (void) SetOnTap: (SEL) newValue;
@end</code></pre>
<pre><code>//
//  ButtonsLayer.m
//

#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;ButtonsLayer.h&#34;

@implementation ButtonsLayer
- (id) init {
    self = [super init];
    if (self)
    {
        m_ButtonsArray = [[NSMutableArray alloc] init];
    }
    return self;
}
- (void) dealloc {
    [self removeAllChildrenWithCleanup:YES];//removing the sprites from the screen
    [m_ButtonsArray removeAllObjects];
    [m_ButtonsArray release];
    [super dealloc];
}
- (id) MakeButtonFromSprite:(CCSprite *)_sprite withTarget:(id)_target onTap:(SEL)_onTap tapAction:(CCAction*)_actionTap soundFile:(NSString*)_tapSound onRelease:(SEL)_onRelease releaseAction:(CCAction*)_actionRelease soundFile:(NSString*)_releaseSound
{
    WHButton *_myButton;

    _myButton = [[WHButton alloc] init];
#ifdef DEBUG
    assert(_sprite != nil);
#endif
    if(_sprite != nil)
    {
        [_myButton SetSprite:_sprite];

        [_myButton SetTarget:_target];
        [_myButton SetOnTap:_onTap];
        [_myButton SetOnTapAction:_actionTap];
        [_myButton SetTapSoundFile:_tapSound];
        [_myButton SetOnRelease:_onRelease];
        [_myButton SetOnReleaseAction:_actionRelease];
        [_myButton SetReleaseSoundFile:_releaseSound];

        [m_ButtonsArray addObject:_myButton];
        [self addChild:_myButton z:1];
    }
    [_myButton release];
    return _myButton;
}

@end
//################################################################################################################################//
@implementation WHButton
-(void) onEnter
{
#ifdef DEBUG
    NSLog(@&#34;onEnter&#34;);
#endif
    [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
    [super onEnter];
}
-(void) onExit
{
#ifdef DEBUG
    NSLog(@&#34;onExit&#34;);
#endif
    [[CCTouchDispatcher sharedDispatcher] removeDelegate:self];
    [super onExit];
}
- (id)init {
    self = [super init];
    if (self)
    {
        m_oTarget = nil;
        m_ButtonSprite = nil;
        m_nWidth = 0;
        m_nHeight = 0;
        m_nXPos = 0;
        m_nYpos = 0;
        m_oOnTapAction = nil;
        m_oOnReleaseAction = nil;
        m_szTapSoundFile = nil;
        m_szReleaseSoundFile = nil;
        OnTap = nil;
        OnRelease = nil;
        m_bTagDisplay = NO;
        m_FontSize = 0;
        m_label = nil;
    }
    return self;
}
- (void)dealloc
{
    [self SetTarget:nil];
    [self SetSprite:nil];
    [self SetOnTapAction:nil];
    [self SetOnReleaseAction:nil];
    [self SetTapSoundFile:nil];
    [self SetReleaseSoundFile:nil];
    [m_label release];
    [super dealloc];
}
- (void) SetTag:(NSString *)text fontName:(NSString*)font fontColor:(ccColor3B)f_color fontSize:(int)size
{
    if(text != nil)
    {
        m_bTagDisplay = YES;
        if (m_label != nil) {
            [self removeChild:m_label cleanup:YES];
            [m_label release];
        }
        m_label = [[CCLabelTTF labelWithString:text fontName:font fontSize:size] retain];
    }
}
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
    BOOL bRet = NO;
    bRet = [self CaptureTap:touch];

    return bRet;
}
-(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event
{
    [self CaptureRelease];
}
-(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
    ;
}
- (void) ShowTag
{
    //compute the position
    if(m_ButtonSprite != nil)
    {
        CGRect frame = [m_ButtonSprite boundingBox];
        //above the sprite
        CGPoint p = CGPointMake(frame.origin.x + frame.size.width/2, frame.origin.y + frame.size.height + 2 * m_FontSize);

        if (m_label != nil) {
            [m_label setPosition:p];
            [self addChild:m_label];
        }
    }

}
- (void) HideTag
{
    if(m_label != nil)
        [self removeChild:m_label cleanup:YES];
}
- (BOOL) CaptureTap:(UITouch *)t
{
    BOOL bRet = NO;
#ifdef DEBUG
    assert(m_ButtonSprite != nil);
#endif
    if(m_ButtonSprite == nil)
    {
        return bRet;
    }
    CGRect rect = [m_ButtonSprite textureRect];
    CGPoint p = [m_ButtonSprite convertTouchToNodeSpace:t];
    bRet = CGRectContainsPoint(rect, p);

    if(bRet)
    {
        if (m_bTagDisplay) {
            [self ShowTag];
        }
        if(m_oOnTapAction != nil)
            [m_ButtonSprite runAction:m_oOnTapAction];
#ifdef DEBUG
        assert(m_oTarget != nil &#38;&#38; OnTap != nil);
#endif
        if (m_oTarget != nil &#38;&#38; OnTap != nil) {

            [m_oTarget performSelector:OnTap];
        }
        if (m_szTapSoundFile != nil) {
            [[SimpleAudioEngine sharedEngine] playEffect:m_szTapSoundFile];
        }
    }
    return bRet;
}
- (BOOL) CaptureRelease
{
    BOOL bRet = NO;
#ifdef DEBUG
    assert(m_ButtonSprite != nil);
#endif
    if(m_ButtonSprite == nil)
    {
        return bRet;
    }
    bRet = YES;//The touch began in this button, it will be treated here no matter where it is released!!!
    if(bRet)
    {
        if(m_bTagDisplay)
        {
            [self HideTag];
        }
        if(m_oOnReleaseAction != nil)
            [m_ButtonSprite runAction:m_oOnReleaseAction];
#ifdef DEBUG
        assert(m_oTarget != nil);
#endif
        if (m_oTarget != nil &#38;&#38; OnRelease != nil) {

            [m_oTarget performSelector:OnRelease];
        }
        if (m_szTapSoundFile != nil) {
            [[SimpleAudioEngine sharedEngine] playEffect:m_szReleaseSoundFile];
        }
    }
    return bRet;
}
- (id) Target {
  return m_oTarget;
}

- (void) SetTarget: (id) newValue {
  [m_oTarget autorelease];
  m_oTarget = [newValue retain];
}

- (CCSprite *) Sprite {
  return m_ButtonSprite;
}

- (void) SetSprite: (CCSprite *) newValue {
    if (m_ButtonSprite != nil) {
        [self removeChild:m_ButtonSprite cleanup:YES];
    }
    [m_ButtonSprite autorelease];
    m_ButtonSprite = [newValue retain];
    if (m_ButtonSprite == nil) {
        return;
    }
    m_nXPos = [m_ButtonSprite position].x;
    m_nYpos = [m_ButtonSprite position].y;
    m_nHeight = [m_ButtonSprite boundingBox].size.height;
    m_nWidth = [m_ButtonSprite boundingBox].size.width;
    [self addChild:m_ButtonSprite];
}

- (int) Width {
  return m_nWidth;
}

- (void) SetWidth: (int) newValue {
  m_nWidth = newValue;
}

- (int) Height {
  return m_nHeight;
}

- (void) SetHeight: (int) newValue {
  m_nHeight = newValue;
}

- (int) XPos {
  return m_nXPos;
}

- (void) SetXPos: (int) newValue {
  m_nXPos = newValue;
}

- (int) Ypos {
  return m_nYpos;
}

- (void) SetYpos: (int) newValue {
  m_nYpos = newValue;
}

- (id) OnTapAction {
  return m_oOnTapAction;
}

- (void) SetOnTapAction: (id) newValue {
  [m_oOnTapAction autorelease];
  m_oOnTapAction = [newValue retain];
}

- (id) OnReleaseAction {
  return m_oOnReleaseAction;
}

- (void) SetOnReleaseAction: (id) newValue {
  [m_oOnReleaseAction autorelease];
  m_oOnReleaseAction = [newValue retain];
}

- (NSString *) TapSoundFile {
  return m_szTapSoundFile;
}

- (void) SetTapSoundFile: (NSString *) newValue {
  [m_szTapSoundFile autorelease];
  m_szTapSoundFile = [newValue retain];
}

- (NSString *) ReleaseSoundFile {
  return m_szReleaseSoundFile;
}

- (void) SetReleaseSoundFile: (NSString *) newValue {
  [m_szReleaseSoundFile autorelease];
  m_szReleaseSoundFile = [newValue retain];
}

- (SEL) OnRelease {
  return OnRelease;
}

- (void) SetOnRelease: (SEL) newValue {
  OnRelease = newValue;
}

- (SEL) OnTap {
  return OnTap;
}

- (void) SetOnTap: (SEL) newValue {
  OnTap = newValue;
}

@end</code></pre>
<p>and example of how to use it:<br />
<pre><code>//
//  HelloWorldLayer.m
//
[...]
-(id) init
{
	// always call &#34;super&#34; init
	// Apple recommends to re-assign &#34;self&#34; with the &#34;super&#34; return value
	if( (self=[super init]))
        {
        m_btns = [[ButtonsLayer alloc] init];
        [self addChild: m_btns z:10];
        [m_btns release];

        //Load Texture Section
        [[CCTextureCache sharedTextureCache] addImage:@&#34;button_play.png&#34;];

        //Add Graphic Content Section

        CCSprite * _sprite;

        _sprite = [CCSprite spriteWithTexture:[[CCTextureCache sharedTextureCache] textureForKey:@&#34;button_play.png&#34;]];
        [_sprite setPosition:ccp(432, 47)];
        id moveDown, moveUp;
        moveDown = [CCMoveTo actionWithDuration:0.1f position:ccp([_sprite position].x,[_sprite position].y - 2 )];
        moveUp = [CCMoveTo actionWithDuration:0.1f position:ccp([_sprite position].x,[_sprite position].y)];
        WHButton *btn = [m_btns MakeButtonFromSprite:_sprite withTarget:self onTap:@selector(PlayTap) tapAction:moveDown soundFile:nil onRelease:@selector(PlayRelease) releaseAction:moveUp soundFile:nil];
        [btn SetTag:@&#34;test&#34; fontName:@&#34;Arial&#34; fontColor:ccc3(0, 0, 0) fontSize:25];
     }
     return self;
}
[...]
- (void) PlayTap
{
    NSLog(@&#34;Tap Play&#34;);
}

- (void) PlayRelease
{
    NSLog(@&#34;Release Play&#34;);
}</code></pre></description>
		</item>
		<item>
			<title>Dynex on "How to retrieve which button was pressed?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22187#post-123216</link>
			<pubDate>Thu, 27 Oct 2011 03:19:03 +0000</pubDate>
			<dc:creator>Dynex</dc:creator>
			<guid isPermaLink="false">123216@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Found it! </p>
<pre><code>grapeDD.tag = 2;
rockDD.tag = 3;</code></pre>
<p>Then just check tags.
</p></description>
		</item>
		<item>
			<title>Dynex on "How to retrieve which button was pressed?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22187#post-123210</link>
			<pubDate>Thu, 27 Oct 2011 02:24:42 +0000</pubDate>
			<dc:creator>Dynex</dc:creator>
			<guid isPermaLink="false">123210@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Say I have 2 buttons, and they both call highlightAmmo:<br />
How would I check to see which button was pressed?<br />
<pre><code>grapeDD = [CCMenuItemSprite
				 itemFromNormalSprite:[CCSprite spriteWithSpriteFrameName:@&#34;grapeDD.png&#34;]
				 selectedSprite:[CCSprite spriteWithSpriteFrameName:@&#34;grapeDD.png&#34;]
				 target:self
				 selector:@selector(highlightAmmo:)];

rockDD = [CCMenuItemSprite
				 itemFromNormalSprite:[CCSprite spriteWithSpriteFrameName:@&#34;rockDD.png&#34;]
				 selectedSprite:[CCSprite spriteWithSpriteFrameName:@&#34;rockDD.png&#34;]
				 target:self
				 selector:@selector(highlightAmmo:)];

- (void) highlightAmmo: (CCMenuItem  *) menuItem {
NSLog(@&#34;Ammo highlighted&#34;);
}</code></pre></description>
		</item>
		<item>
			<title>davidthecoder on "Moving B2Body&#039;s?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21620#post-120578</link>
			<pubDate>Tue, 11 Oct 2011 04:26:12 +0000</pubDate>
			<dc:creator>davidthecoder</dc:creator>
			<guid isPermaLink="false">120578@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>thank you once again iforce2d
</p></description>
		</item>
		<item>
			<title>iforce2d on "Moving B2Body&#039;s?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21620#post-120570</link>
			<pubDate>Tue, 11 Oct 2011 03:14:55 +0000</pubDate>
			<dc:creator>iforce2d</dc:creator>
			<guid isPermaLink="false">120570@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Kinematic bodies have infinite mass, so impulses and forces will have no effect.<br />
You can only move them with: SetTransform, SetLinearVelocity, SetAngularVelocity
</p></description>
		</item>
		<item>
			<title>davidthecoder on "Moving B2Body&#039;s?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21620#post-120506</link>
			<pubDate>Mon, 10 Oct 2011 20:00:31 +0000</pubDate>
			<dc:creator>davidthecoder</dc:creator>
			<guid isPermaLink="false">120506@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>bump*<br />
 i need help?
</p></description>
		</item>
		<item>
			<title>greamer on "How to repeat an action while MenuItem button is held down?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19163#post-120438</link>
			<pubDate>Mon, 10 Oct 2011 13:37:18 +0000</pubDate>
			<dc:creator>greamer</dc:creator>
			<guid isPermaLink="false">120438@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>you don't need to subclass CCMenuItemImage to do that<br />
in you layer or scene update: or scheduling method, do this</p>
<p>if( menuitem.isSelected )<br />
  [menuitem activate];</p>
<p>// it will fire your upButtonTapped as long as it is held down
</p></description>
		</item>
		<item>
			<title>FGringo on "How to repeat an action while MenuItem button is held down?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19163#post-120430</link>
			<pubDate>Mon, 10 Oct 2011 12:30:27 +0000</pubDate>
			<dc:creator>FGringo</dc:creator>
			<guid isPermaLink="false">120430@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi.</p>
<p>Well the best way i found out was making a timer, and when i hitter the button and held it it verified witch button was pressed.<br />
Here's how it works:</p>
<p>//.M file</p>
<p>@synthesize refreshTimer;</p>
<p>//INIT METHOD<br />
-(void)init{<br />
        minutes = 0;<br />
        seconds = 0;<br />
        refreshTimer = [NSTimer scheduledTimerWithTimeInterval:0.25f target:self selector:@selector(targetMethod:) userInfo:nil repeats:YES];</p>
<p>}</p>
<p>//THIS IS THE METHOD THAT WILL INCREASE THE TIME<br />
-(void)targetMethod:(NSTimer *)theTimer{</p>
<p>    //INCREASE OF THE TIMER AND SECONDS<br />
    elapsedTime+=0.25;<br />
    seconds+=0.25;</p>
<p>    //THIS FIRST 4 IF ARE VERIFYING IF THE ITEM I'M SELECTING IS SELECTED</p>
<p>    //increasing bpm<br />
    if ([iINCREASEB isSelected]){<br />
        [self increaseTempo];<br />
        [self performSelector:@selector(increaseTempo) withObject:self afterDelay:0.125];<br />
        NSLog(@"INC BEAT");<br />
    }</p>
<p>    //decreasing bpm<br />
    if ([iDECREASEB isSelected]){<br />
        [self decreaseTempo];<br />
        [self performSelector:@selector(decreaseTempo) withObject:self afterDelay:0.125];<br />
        NSLog(@"DEC BEAT");<br />
    }</p>
<p>    //increasing volume<br />
    if ([iINCREASEV isSelected]){<br />
        [self increaseVolume];<br />
        [self performSelector:@selector(increaseVolume) withObject:self afterDelay:0.125];<br />
        NSLog(@"INC VOL");<br />
    }</p>
<p>    //decreasing volume<br />
    if ([iDECREASEV isSelected]){<br />
        [self decreaseVolume];<br />
        [self performSelector:@selector(decreaseVolume) withObject:self afterDelay:0.125];<br />
        NSLog(@"DEC VOL");<br />
    }</p>
<p>    //INCREASE OF THE MINUTOS EACH 60 SECONDS<br />
    if (seconds&#62;=30) {<br />
        seconds=0; minutes++;<br />
        [self displayOurAds];<br />
        [self removeSubviews];<br />
        if (![defaultz boolForKey:@"isLevelUpgradePurchased"])<br />
            [self AdMob];<br />
    }<br />
    //NSLog(@"TIME: %02d:%02d", minutes, seconds);<br />
}
</p></description>
		</item>
		<item>
			<title>davidthecoder on "Moving B2Body&#039;s?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21620#post-120417</link>
			<pubDate>Mon, 10 Oct 2011 10:12:36 +0000</pubDate>
			<dc:creator>davidthecoder</dc:creator>
			<guid isPermaLink="false">120417@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>i have this to move the b2_kinetic body, but the body does not move?<br />
<pre><code>b2Vec2 Impulse = b2Vec2(10, 0);
body-&#62;ApplyLinearImpulse(Impulse, body-&#62;GetWorldCenter());</code></pre>
<p>any body know why?
</p></description>
		</item>
		<item>
			<title>davidthecoder on "Moving B2Body&#039;s?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21620#post-120270</link>
			<pubDate>Sun, 09 Oct 2011 05:02:11 +0000</pubDate>
			<dc:creator>davidthecoder</dc:creator>
			<guid isPermaLink="false">120270@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Okay thanks for the help :) I'm going to use kinematic body
</p></description>
		</item>

	</channel>
</rss>

