<?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 Topics</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 04:01:03 +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/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>YannickL on "CCControl for Cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19915#post-111247</link>
			<pubDate>Thu, 18 Aug 2011 17:00:19 +0000</pubDate>
			<dc:creator>YannickL</dc:creator>
			<guid isPermaLink="false">111247@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi everybody!</p>
<p>I have written a small class to help me in the design of control objects (like special buttons, sliders, drag&#38;drop object, etc.) into Cocos2d. I was inspired by the UIControl API from the UIKit framework. I would share it with you in order to see if this could have any utility and why not improved it in order to better meet the needs of everyone.</p>
<p>You can find the file to my github here: <a href="https://github.com/YannickL/CCControl" rel="nofollow">https://github.com/YannickL/CCControl</a></p>
<p>To illustrate how to use it I have modified the CCSlider from the cocos2d-iphone-extensions. You can download it here: <a href="https://github.com/YannickL/CCControl-Examples" rel="nofollow">https://github.com/YannickL/CCControl-Examples</a></p>
<p>A quick example to show you how we use the CCSlider after integrating the CCControl here:<br />
<pre><code>- (id)init
{
    if((self=[super init]))
    {
        CGSize screenSize = [[CCDirector sharedDirector] winSize];

        // Add a label in which the slider value will be display
        self.displayValueLabel = [CCLabelTTF labelWithString:@&#34;Move the slider thumb!&#34; fontName:@&#34;Marker Felt&#34; fontSize:32];
        displayValueLabel.anchorPoint = ccp(0.5f, -1);
        displayValueLabel.position = ccp(screenSize.width / 2.0f, screenSize.height / 2.0f);
        [self addChild:displayValueLabel];

        CCSlider *slider = [CCSlider sliderWithBackgroundFile:@&#34;sliderBG.png&#34; thumbFile:@&#34;sliderThumb.png&#34;];
        slider.anchorPoint = ccp(0.5f, 1);
        slider.position = ccp(screenSize.width / 2.0f, screenSize.height / 2.0f);

        // When the value of the slider will change, the given selector will be call
        [slider addTarget:self action:@selector(valueChanged:) forControlEvents:CCControlEventValueChanged];

        [self addChild:slider];
    }
    return self;
}

- (void)valueChanged:(CCSlider *)sender
{
    // Change value of label.
    displayValueLabel.string = [NSString stringWithFormat:@&#34;Slider value = %.02f&#34;, sender.value];
}</code></pre>
<p>For more details/documentation you can check this blog post: <a href="http://yannickloriot.com/2011/08/create-a-control-object-with-cocos2d-for-iphone/" rel="nofollow">http://yannickloriot.com/2011/08/create-a-control-object-with-cocos2d-for-iphone/</a></p>
<p>Best,<br />
Yannick
</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>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>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>roko on "How to get touch position on the CCMenuItemImage?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/14150#post-79875</link>
			<pubDate>Thu, 03 Mar 2011 10:54:44 +0000</pubDate>
			<dc:creator>roko</dc:creator>
			<guid isPermaLink="false">79875@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all! Can anybody explain me how i can get touch position in a button(CCMenuItemImage) in the selector method?</p>
<p>for example i have this snippet of code:<br />
<pre><code>CCMenuItemImage *myMenuItem = [CCMenuItemImage itemFromNormalImage:imageNormal
							selectedImage:imageSelected
							disabledImage:imageDisable
								target:self
								selector:@selector(myMenuItemWasOn)];

	CCMenu *myMenu = [CCMenu menuWithItems:myMenuItem,nil];
	[self addChild:myMenu z:100];
	[myMenu setPosition:CGPointMake(200, 200)];</code></pre>
<p>then after i have pressed the button method "myMenuItemWasOn" will be called:</p>
<pre><code>- (void) myMenuItemWasOn
{
	CGPoint touchPos =  ?//how to get touch pos here?
}</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-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-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-120163</link>
			<pubDate>Sat, 08 Oct 2011 02:37:35 +0000</pubDate>
			<dc:creator>davidthecoder</dc:creator>
			<guid isPermaLink="false">120163@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>how would i go about moving a b2body up and down with a button?</p>
<p>what type of body should it be ?(b2_dynamicBody, b2_kinematicBody), etc..)
</p></description>
		</item>
		<item>
			<title>penandlim on "How to repeat an action while MenuItem button is held down?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19163#post-107399</link>
			<pubDate>Wed, 27 Jul 2011 17:52:40 +0000</pubDate>
			<dc:creator>penandlim</dc:creator>
			<guid isPermaLink="false">107399@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>How to repeat an action while MenuItem button is held down?<br />
I tried to make a subclass on CCMenuItemImage and made</p>
<pre><code>-(void) selected
{
	[super selected];
	buttonHeld = true;
}
-(void) unselected
{
	[super unselected];
	buttonHeld = false;
}</code></pre>
<p>and put this on my init</p>
<pre><code>CCMenuItem *upButtonItem = [CCMenuItemSpriteHoldable
                                itemFromNormalImage:@&#34;up.png&#34; selectedImage:@&#34;upsel.png&#34;
                                target:self selector:@selector(upButtonTapped:)];</code></pre>
<p>but it did nothing... :(<br />
it just loads the (void) upButtonTapped when I release the button.<br />
is there any way to make a button that allows u to hold down?</p>
<p>Thank you
</p></description>
		</item>
		<item>
			<title>Dakiu on "Buttons and Sprites"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1658#post-10377</link>
			<pubDate>Wed, 02 Sep 2009 05:13:28 +0000</pubDate>
			<dc:creator>Dakiu</dc:creator>
			<guid isPermaLink="false">10377@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello everyone, i made a class called "csprite" (character sprite) it's the class of the main character of my game, who you move, but for move it i wanna put in the screen buttons (up,down,left,right) for those i use the MenuItem, 4 items with their respectives selector.</p>
<p>Each time you press the button the character moves 10 pixels, but, the problem is the character moves only once, and for move again you need press again the button.<br />
How can i made, the character moves while you hold the button down??<br />
I mean, if you press the button and hold it, the character moves until you release.
</p></description>
		</item>
		<item>
			<title>phantomsri on "how do you disable a button based on a tag?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21478#post-119357</link>
			<pubDate>Mon, 03 Oct 2011 14:16:18 +0000</pubDate>
			<dc:creator>phantomsri</dc:creator>
			<guid isPermaLink="false">119357@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>i need help with this code. not sure how to write a code to disable/enable the button based on a tag.<br />
i tried to use "[levelMenu setIsEnabled:false];"  but all the buttons are disabled.</p>
<pre><code>//in my init method

        [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@&#34;texture.plist&#34;];
        CCSpriteBatchNode *colorSprites = [CCSpriteBatchNode batchNodeWithFile:@&#34;texture.png&#34;];
	[self addChild:colorSprites];

        CCMenu *myMenu = [CCMenu menuWithItems:nil];

        int rows = 2;
        int cols = 4;
        static int padding=20;

        for(int count=0; count &#60; (rows*cols); count++) {

        int index1 = count +1;
        NSString *spritefiles1 = [NSString stringWithFormat:@&#34;sprite%d.png&#34;, index1];
        random1 = [CCSprite spriteWithSpriteFrameName:spritefiles1];

            CCMenuItemSprite *levelMenu = [CCMenuItemSprite itemFromNormalSprite:random1 selectedSprite:[CCSprite spriteWithFile:@&#34;Iconselected.png&#34;]   disabledSprite:[CCSprite spriteWithFile:@&#34;Iconlocked.png&#34;] target:self selector:@selector(levelSelected:)];

            int yOffset = padding+(int)(random1.contentSize.width/2-((random1.contentSize.width+padding)*(count/rows))); // or /cols to fill cols first
            int xOffset = padding+(int)(random1.contentSize.width/2+((random1.contentSize.width+padding)*(count%rows))); // or %cols to fill cols first
            levelMenu.position = ccp(xOffset, yOffset);

            levelMenu.tag = count+1;
            myMenu.position =ccp(0,300);
            [myMenu addChild:levelMenu];

            //testing to disable the button
           // [levelMenu setIsEnabled:false];

        }

-(void) levelSelected:(CCMenuItemSprite*) sender {
    int level = sender.tag;
    NSLog(@&#34;test button number %d&#34;,level);
}</code></pre></description>
		</item>
		<item>
			<title>davidthecoder on "Jump button problem"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21038#post-116921</link>
			<pubDate>Tue, 20 Sep 2011 03:43:49 +0000</pubDate>
			<dc:creator>davidthecoder</dc:creator>
			<guid isPermaLink="false">116921@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>i have a jump action that plays when the jump button is pressed, the only problem is that every time the button is pressed he jumps even if it is in the middle of playing out the action, so i guess I'm asking for a way to make sure the entire action has completed before it is called to play again?
</p></description>
		</item>
		<item>
			<title>davidthecoder on "connecting buttons to character"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20953#post-116437</link>
			<pubDate>Sat, 17 Sep 2011 04:40:34 +0000</pubDate>
			<dc:creator>davidthecoder</dc:creator>
			<guid isPermaLink="false">116437@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>i am using sneakybuttons to make a jumpbutton and attackbutton,<br />
i have done research and i still can't connect the buttons to the character..<br />
this is what i have...<br />
<pre><code>-(void) initButtons {
    CGSize screenSize = [CCDirector sharedDirector].winSize;
    CGRect jumpButtonDimensions =CGRectMake(0, 0, 64.0f, 64.0f);
    CGRect attackButtonDimensions =CGRectMake(0, 0, 64.0f, 64.0f);
    CGPoint jumpButtonPosition;
    CGPoint attackButtonPosition;

    jumpButtonPosition = ccp(screenSize.width*0.93f,screenSize.height*0.11f);
    attackButtonPosition = ccp(screenSize.width*0.93f,screenSize.height*0.35f);

    SneakyButtonSkinnedBase *jumpButtonBase = [[[SneakyButtonSkinnedBase alloc] init] autorelease];
    jumpButtonBase.position = jumpButtonPosition;
    jumpButtonBase.defaultSprite =[CCSprite spriteWithFile:@&#34;JumphandUp.png&#34;];
    jumpButtonBase.activatedSprite = [CCSprite spriteWithFile:@&#34;JumphandDown.png&#34;];
    jumpButtonBase.pressSprite =[CCSprite spriteWithFile:@&#34;JumphandDown.png&#34;];
    jumpButtonBase.button = [[SneakyButton alloc]initWithRect:jumpButtonDimensions];
    jumpButton = [jumpButtonBase.button retain];
    jumpButton.isToggleable = NO;
    [self addChild:jumpButtonBase];

    SneakyButtonSkinnedBase *attackButtonBase = [[[SneakyButtonSkinnedBase alloc] init] autorelease];
    attackButtonBase.position = attackButtonPosition;
    attackButtonBase.defaultSprite = [CCSprite spriteWithFile:@&#34;attackhandUp.png&#34;];
    attackButtonBase.activatedSprite = [CCSprite spriteWithFile:@&#34;attackhandDown.png&#34;];
    attackButtonBase.pressSprite = [CCSprite spriteWithFile:@&#34;attackhandDown.png&#34;];
    attackButtonBase.button = [[SneakyButton alloc]initWithRect:attackButtonDimensions];
    attackButton = [attackButtonBase.button retain];
    attackButton.isToggleable = NO;
    [self addChild:attackButtonBase];
}

#pragma mark -
#pragma mark updated Method
-(void) update:(ccTime)deltaTime {

    for (GameCharacter *tempChar in listOfGameObjects) {
        [tempChar updateStateWithDeltaTime:deltaTime andListOfGameObjects:listOfGameObjects];

           }        

}    

- (id)init {

    self = [super init];

    if (self != nil) {      

        self.listOfGameObjects = [CCArray array];

        ninja = [[Ninja alloc] initWithFile:@&#34;proto01.png&#34;];

        [ninja setPosition:ccp(150,190)];

        [[self listOfGameObjects] addObject:ninja]; 

        [self
         addChild:ninja
         z:1000
         tag:kNinjaSpriteTagValue];
        [ninja setJumpButton:jumpbutton];
        [ninja setAttackButton:attackbutton];

        [self initButtons];

        [self scheduleUpdate];</code></pre>
<p>in my ninja.m file i have..<br />
<pre><code>-(void)updateStateWithDeltaTime:(ccTime)deltaTime
           andListOfGameObjects:(CCArray*)listOfGameObjects {

    if (jumpButton.active == YES) {
        CCLOG(@&#34;jump button has been pressed&#34;);
    }
    if (attackButton.active == YES) {
        CCLOG(@&#34;attack button has been pressed&#34;);

    }</code></pre>
<p>what am i missing???
</p></description>
		</item>
		<item>
			<title>milows on "random size buttons"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20749#post-115349</link>
			<pubDate>Sun, 11 Sep 2011 14:00:02 +0000</pubDate>
			<dc:creator>milows</dc:creator>
			<guid isPermaLink="false">115349@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,<br />
is there any way to generate random size buttons in cocos2d?
</p></description>
		</item>
		<item>
			<title>Juggernaut on "Shift like controls"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19578#post-109478</link>
			<pubDate>Mon, 08 Aug 2011 20:59:08 +0000</pubDate>
			<dc:creator>Juggernaut</dc:creator>
			<guid isPermaLink="false">109478@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all. I was wondering if anyone has an idea on the code to make a control scheme like SHIFT and SHIFT 2. Where the when you hold the left directional button the right button becomes a jump button and the same happens in reverse when you hold the right directional button to move in that direction the left button becomes a jump button. I'm working on a game with similar control concept.
</p></description>
		</item>
		<item>
			<title>dgtheman on "ccTouchedMoved with sneaky buttons"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18496#post-103726</link>
			<pubDate>Sat, 09 Jul 2011 02:31:36 +0000</pubDate>
			<dc:creator>dgtheman</dc:creator>
			<guid isPermaLink="false">103726@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I want to be able to swipe and change the sprite of a sneaky button. Can someone tell me how I can register a touch dispatcher without messing up the reading of the buttons, for it seems that when write return YES in the ccTouchesBegan the buttons will not be read properly. I really need help. Thanks in advance!!
</p></description>
		</item>
		<item>
			<title>mrtechgu2y3 on "Sound on and off button help"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18748#post-105208</link>
			<pubDate>Sat, 16 Jul 2011 01:26:40 +0000</pubDate>
			<dc:creator>mrtechgu2y3</dc:creator>
			<guid isPermaLink="false">105208@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I need help to create a sound on and off button in my game. </p>
<p>Explanation:</p>
<p>- When sound off/on is tapped, I want it to show sound off/on</p>
<p>- I have a different scene and I want that button to get rid of sound on both scenes.</p>
<p>Please reply
</p></description>
		</item>
		<item>
			<title>SiriusBlack on "[GAME] Button - New Chipmunk Physics Based Puzzle Platformer"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18056#post-101302</link>
			<pubDate>Mon, 27 Jun 2011 10:55:15 +0000</pubDate>
			<dc:creator>SiriusBlack</dc:creator>
			<guid isPermaLink="false">101302@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey guys this is my game that I have been working on for the last number of weeks. Hope you like it as much as I loved creating it..I loved the whole process (...besides the annoying memory issues that somehow evaded themselves from me for ages..Haha. - Though a huge huge thank you to Slembcke (Chipmunk) for not only the framework, but also the assistance that was given to me to sort out these memory problems.. and of course Riq also for the great framework)<br />
:) :)</p>
<p>iTunes AppStore Description:</p>
<p>This immersive and addictive indie physics puzzler takes you into the delightful world of a button, some chalk and a load of strangely obstructive masking tape. Using your finger you must chalk up a guide for the button to travel along, ushering it to reach the goal of each level, though along the way be careful to gain enough momentum else failure will ensue. Marinate yourself in the user experience of Button and free your imagination to expand out far and wide, like peach coloured gum stretched between two school desks. As you play feel free to think of nice things like: water ripples, cheesecake, fresh plums, half frozen cordial, juicy watermelons, a sideways cap upon an old man's head, cellar doors, two otters arguing, aqua blue aura's or the smooth forehead of a fish - of course you could simply just play thoughtlessly instead.</p>
<p>iTunes Link: <a href="http://itunes.apple.com/us/app/button/id444423425" rel="nofollow">http://itunes.apple.com/us/app/button/id444423425</a></p>
<p>And below here I have the initial preview/trailer, though the game is out NOW (not only from JULY as it states). Thank you, feel free to PM me or comment, and/or drop me any feedback, suggestions, random statements, kiss my hand, spit on me, hell...however you express yourself, etc.   </p>
<p>Trailer:</p>
<p><a href="http://www.youtube.com/watch?v=BsbEev9qeRc" rel="nofollow">http://www.youtube.com/watch?v=BsbEev9qeRc</a></p>
<p>Here are Screenshots:</p>
<p><img src="http://www.cocos2d-iphone.org/games/add/images/444423425/screenshot_1.png" alt="" /></p>
<p><img src="http://www.cocos2d-iphone.org/games/add/images/444423425/screenshot_4.png" alt="" /></p>
<p><img src="http://www.cocos2d-iphone.org/games/add/images/444423425/screenshot_3.png" alt="" /></p>
<p>Let me know your feedback dudes and dudettes.. :)
</p></description>
		</item>
		<item>
			<title>Karvus on "Menu from sprite sheet"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18017#post-101043</link>
			<pubDate>Sat, 25 Jun 2011 23:06:32 +0000</pubDate>
			<dc:creator>Karvus</dc:creator>
			<guid isPermaLink="false">101043@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello, i'm trying to create a Menu with image from sprite sheet, but i haven't find a way to do it, i did create a menu with images using<br />
<code>CCMenuItemImage *item = [CCMenuItemImage itemFromNormalImage:@&#34;pausebutton.png&#34; selectedImage:@&#34;pausebutton.png&#34; target:self selector:@selector(pause:)];</code> and adding it to a menu but when i use images from my sprite sheet this code doesn't work.</p>
<p>Hope someone can help me.
</p></description>
		</item>
		<item>
			<title>dgtheman on "Animation on a sprite with SneakyButton input?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/17720#post-99425</link>
			<pubDate>Thu, 16 Jun 2011 18:40:03 +0000</pubDate>
			<dc:creator>dgtheman</dc:creator>
			<guid isPermaLink="false">99425@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>So I have a holdable SneakyButton called leftMoveButton and when the user holds the button the sprite moves and rins an animation. However, if the user does not hold the button, but he presses the button again and agin really fast, the sprite moves but does not do any animation. What I want is to move the sprite and do a quick animation on it when the user keeps pressing the button really fast. I want to leave as is for when the button is held. Here is my code:<br />
<pre><code>if(leftMoveButton.active)
	{
		bear.flipX= NO;

		if(!actionIsRunning)
		{
			//this is a breathing action
			[bear stopAction:repeat2];
                        //this selector runs a CCRepeatForever action for animating the sprite.
                         // only works while holding the button
			[self performSelector:@selector(repeatAction)];
		}

 /*Need an if or something similar here to run the first animation.
I tried just running the first step by default but that would stop
the main animation from running and repeatedly
ran the first step even when holding the button.*/

                        //updates the position
			bear.position = CGPointMake(bear.position.x-100*0.02,bear.position.y);
                        //updates the layer position to be the bear position (pretty much)
			[self setCenterOfScreen:bear.position];

	}</code></pre></description>
		</item>
		<item>
			<title>diogorh on "2 animations in one schedule"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/17577#post-98712</link>
			<pubDate>Sun, 12 Jun 2011 23:10:30 +0000</pubDate>
			<dc:creator>diogorh</dc:creator>
			<guid isPermaLink="false">98712@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all,</p>
<p>I have 2 buttons that calls 2 animations, jump and push. Both are working but with a strange behavior. When I press push  and then jump, my character only jumps without the animation. The second time I press the jump button it works as it should.</p>
<p>This is what I call when the button is pressed:</p>
<pre><code>-(void)jump{
	yVel = 7;
	jumpDog = YES;
}

-(void)push{
	pushing = YES;
	yVel = 7;
}</code></pre>
<p>And this is the selector that is scheduled:<br />
<pre><code>-(void)check:(ccTime)delta{
	CCNode* dog = [self getChildByTag:GameSceneNodeTagDog];

	if (jumpDog &#124;&#124; yVel != 7) {

                if (dog.position.y &#62; 135) {
			yVel -= .30;
		}
		else  if(yVel != 7) {
			yVel = 0;
			...
			...
			//array to load the images and CCAnimation

                        [dog runAction:_jumpAction];
			jumpDog = NO;
		}
		dog.position = ccp(dog.position.x, dog.position.y + yVel);
	}

	if(pushing) {
			...
			...
			//array to load the images

                CCAnimation *pushAnim = [CCAnimation animationWithFrames:pushArray delay:0.05f];
		self.pushAction = [CCAnimate actionWithAnimation:pushAnim restoreOriginalFrame:NO];
                [dog runAction:_pushAction];
		pushing = NO;
	}
}</code></pre>
<p>The yVel is the variable I change to make the character jump. But if I don't put it on the push method, the character wont do the push action.</p>
<p>I tried to schedule 2 different selectors but wont work either.</p>
<p>How to call two different CCAnimation from 2 buttons?
</p></description>
		</item>
		<item>
			<title>Duckwit on "Error with CCMenuItem/MenuItemImage"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/17539#post-98539</link>
			<pubDate>Sat, 11 Jun 2011 09:39:18 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">98539@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Just setting up a simple button using CCMenuItemImage like this to create and initialize it -<br />
<pre><code>CCMenuItemImage* hudMenuItem = [CCMenuItemImage itemFromNormalImage:@&#34;ButtonOne_1.png&#34; selectedImage:@&#34;ButtonOne_2.png&#34; target:self selector:@selector(jumpButtonTouched:)];</code></pre>
<p>But for some reason I am getting this error - </p>
<pre><code>*** Terminating app due to uncaught exception &#39;NSInvalidArgumentException&#39;,
reason: &#39;+[NSInvocation invocationWithMethodSignature:]: method signature argument cannot be nil&#39;</code></pre>
<p>EDIT:<br />
This is the method being called when the button is pushed -<br />
<pre><code>-(void)jumpButtonTouched {
	CCLOG(@&#34;TAPPED&#34;);
}</code></pre></description>
		</item>
		<item>
			<title>davidthecoder on "help with animated button"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/17242#post-97083</link>
			<pubDate>Fri, 03 Jun 2011 12:28:08 +0000</pubDate>
			<dc:creator>davidthecoder</dc:creator>
			<guid isPermaLink="false">97083@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hey I'm a beginner at this and i was wondering if i could get a step by step walkthrough on how to add animation with 20 frames then make that animation into a button that plays the animation when it is touched, and send me to a new scene when it is selected, then add that button into a menu. </p>
<p>and reset the animation if it is touched while it is already running?</p>
<p>(i have been at this for weeks with little progress, i have made my animation into a button<br />
that plays the animation when it is touched, but i have a feeling that my coding is partially incorrect seeing that when i touch the button it moves to another position on the screen.) </p>
<p>here is my coding so far....</p>
<p>@synthesize playbutton = _playbutton;<br />
@synthesize moveAction = _moveAction;<br />
@synthesize walkAction = _walkAction;</p>
<p>+(CCScene *) scene<br />
{<br />
	// 'scene' is an autorelease object.<br />
	CCScene *scene = [CCScene node];</p>
<p>	// 'layer' is an autorelease object.<br />
	davie *layer = [davie node];</p>
<p>	// add layer as a child to scene<br />
	[scene addChild: layer];</p>
<p>	// return the scene<br />
	return scene;<br />
}</p>
<p>-(id) init {<br />
    if((self = [super init])) {</p>
<p>        [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"playbutton.plist"];        </p>
<p>        CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"playbutton.png"];<br />
        [self addChild:spriteSheet];</p>
<p>        NSMutableArray *walkAnimFrames = [NSMutableArray array];<br />
        for(int i = 1; i &#60;= 20; ++i) {<br />
            [walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"play_button%02d.png", i]]];<br />
        }<br />
        CCAnimation *walkAnim = [CCAnimation animationWithFrames:walkAnimFrames delay:0.03f];</p>
<p>        self.playbutton = [CCSprite spriteWithSpriteFrameName:@"play_button01.png"];<br />
        _playbutton.position = ccp(100,100);<br />
        self.walkAction = [CCRepeat actionWithAction:[CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:YES ] times:1];</p>
<p>        self.isTouchEnabled = YES;</p>
<p>		CCMenuItemSprite *dummyMenuItem1 =<br />
		[CCMenuItemSprite itemFromNormalSprite:_playbutton<br />
										   selectedSprite: Nil<br />
												   target: self<br />
												 selector: @selector(dummyButton1Pressed)<br />
		 ];</p>
<p>        CCMenu *menu = [CCMenu menuWithItems: dummyMenuItem1, nil];<br />
		menu.anchorPoint = ccp(0,0);<br />
		menu.position = ccp(100,100);<br />
        		[self addChild: menu];<br />
    }<br />
    return self;<br />
}<br />
- (void) dummyButton1Pressed<br />
{<br />
     [_playbutton runAction:_walkAction];</p>
<p>	NSLog(@"dummy button 1 pressed");<br />
}</p>
<p>@end
</p></description>
		</item>
		<item>
			<title>sneakyness on "[input][joystick][buttons] SneakyInput 0.1 Just Released!!"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4645#post-27641</link>
			<pubDate>Mon, 22 Feb 2010 18:16:39 +0000</pubDate>
			<dc:creator>sneakyness</dc:creator>
			<guid isPermaLink="false">27641@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>It was bound to happen! SneakyInput 0.1 just went live on GitHub: <a href="http://github.com/sneakyness/SneakyInput" rel="nofollow">http://github.com/sneakyness/SneakyInput</a></p>
<p>Check it out! Let it control you(r game)! ;)</p>
<p>Features:</p>
<p>-The same amazing SneakyJoystick everybody's come to know and love.<br />
-Totally skinnable in any way you can think to skin it.<br />
-New fancypants buttons! All the configurability and versatility of SneakyJoystick, in button form!<br />
-The buttons have 3 modes: RateLimit, Holdable, and Toggleable.</p>
<p>@CJ I've given you collaborator access to this, to save myself fork headaches. Forkaches? O_o
</p></description>
		</item>
		<item>
			<title>mayoxy on "Grid Menu"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/15879#post-89678</link>
			<pubDate>Sat, 23 Apr 2011 22:29:09 +0000</pubDate>
			<dc:creator>mayoxy</dc:creator>
			<guid isPermaLink="false">89678@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, i just created grid menu from other code found on the internet. It's from three menus, menu image, menu font (text, number, 1,2,3,4,5...) and menu stars. there is a function, sorting menuitems to the grid. You can call it and set up like you want.<br />
I hope it help someone.<br />
P.S.: Image at the bottom</p>
<pre><code>@implementation Levely
-(id) init
{
	if( (self=[super init]) ) {

        .
        .
        .
        .
        .
        .
        .//menuitems setuping...

CCMenu *menu =[CCMenu menuWithItems: item1, item2, item3, item4, item5,item6,item7,item8,item9,item10,item11,item12, item13, nil];
        [menu alignItemsInColumns:[NSNumber numberWithUnsignedInt:4],[NSNumber numberWithUnsignedInt:4], [NSNumber numberWithUnsignedInt:4], [NSNumber numberWithUnsignedInt:1],nil];
		[self addChild: menu];	

        CCMenu *menu2 = [CCMenu menuWithItems:it1, it2,it3,it4,it5,it6,it7,it8,it9,it10,it11,it12,it13, nil];
        [self addChild:menu2];

        CCMenu *menu3 = [CCMenu menuWithItems:ih1, ih2, ih3,ih4,ih5,ih6,ih7,ih8,ih9,ih10,ih11,ih12,ih13, nil];
        [self addChild:menu3];

        NSMutableArray *pole = [[NSMutableArray alloc] initWithObjects:item1, item2, item3, item4, item5,item6,item7,item8,item9,item10,item11,item12, item13, nil];
        NSMutableArray *pole2 = [[NSMutableArray alloc] initWithObjects:it1, it2,it3,it4,it5,it6,it7,it8,it9,it10,it11,it12,it13, nil];
        NSMutableArray *pole3 = [[NSMutableArray alloc] initWithObjects:ih1, ih2, ih3,ih4,ih5,ih6,ih7,ih8,ih9,ih10,ih11,ih12,ih13, nil];

        [self usporiadajMenuItemy:pole padding:65 pozicia:100 col:4 row:4 scale:1];
        [self usporiadajMenuItemy:pole2 padding:65 pozicia:100 col:4 row:4 scale:0.7];
        [self usporiadajMenuItemy:pole3 padding:65 pozicia:80 col:4 row:4 scale:0.6];

        [ih3 setOpacity:0];
        [ih5 setOpacity:0];
        [ih12 setOpacity:0];
        [ih13 setOpacity:0];

        item12.isEnabled = NO;
        it12.isEnabled = NO;

        item13.isEnabled = NO;
        it13.isEnabled = NO;

	}
        return self;
}

-(void)usporiadajMenuItemy:(NSArray*)pole padding:(int)padding pozicia:(int)pozicia col:(int)coll row:(int)roww scale:(float)scale{
    int col = 0, row = 0;
    for (CCMenuItem* item in pole)
    {
        // Calculate the position of our menu item.
        item.position = CGPointMake(self.position.x + col * padding -pozicia, self.position.y - row * padding +pozicia);

        // Increment our positions for the next item(s).
        ++col;
        if (col == coll)
        {
            col = 0;
            ++row;

            if( row == roww )
            {
                col = 0;
                row = 0;
            }
        }
        [item setScale:scale];
    }
}</code></pre>
<p><img src="http://img607.imageshack.us/img607/5487/img1123.png" alt="" />
</p></description>
		</item>
		<item>
			<title>Techy on "GamePack!"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7556#post-44235</link>
			<pubDate>Thu, 01 Jul 2010 03:34:34 +0000</pubDate>
			<dc:creator>Techy</dc:creator>
			<guid isPermaLink="false">44235@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>SKDTutor and I have been working on something called GamePack for the last few weeks... It allows you to easily create things that you may need in your game without having to go through all the trouble, tweaking, and debugging... With GamePack everything is simplified, keeping your code nice and clean... You may have already seen GPJoystick, which is a success, but here soon we are going to be releasing many more GamePack classes... Here is a list of things that will be in GamePack(you may suggest things you want)</p>
<p>GPJoystick - released<br />
GPButton - Almost Done<br />
GPHoldButton - Almost Ready For Release(couple things to add)<br />
GPSlider - Almost Ready For Release(couple things to add)<br />
GPLoadingBar - In the works</p>
<p>GPJoyctick<br />
-------------------------------<br />
Easily create multiple joystick that are easy to use, manage, and support multitouch 100%!<br />
<a href="http://www.youtube.com/watch?v=FzzHyPaCURY" rel="nofollow">http://www.youtube.com/watch?v=FzzHyPaCURY</a></p>
<p>GPButton<br />
-------------------------------<br />
Create buttons without having to use a CCMenu, simplifying your code... Plus even more features than a normal CCMenuItem</p>
<p>GPHoldButton<br />
-------------------------------<br />
A button that repeatedly runs a method whenever held down, great for thrust buttons! </p>
<p>GPSlider<br />
-------------------------------<br />
Creates a slider that returns a value in between the min and max values... It is great for volume sliders!</p>
<p>GPLoadingBar<br />
-------------------------------<br />
An easy to implement bar that can return loading progress, great for loading scenes!</p>
<p>If you have any thing you want in Game Pack just comment :)</p>
<p>Pricing:<br />
GPJoystick - $5-7 ($5 comes with no updates)<br />
GPButton - $2<br />
GPHoldButton - $2<br />
GPSlider - $3<br />
GPLoadingBar - $5<br />
GamePack Complete: $15 ( comes with all updates)
</p></description>
		</item>
		<item>
			<title>guydor on "How To Button Tap &amp; Hold?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/14870#post-84429</link>
			<pubDate>Fri, 25 Mar 2011 07:00:10 +0000</pubDate>
			<dc:creator>guydor</dc:creator>
			<guid isPermaLink="false">84429@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I would like to know how can I make a Tap &#38; Hold action in cocos2d-iPhone buttons?</p>
<p>Thanks!
</p></description>
		</item>
		<item>
			<title>EasyDev on "TouchDown with CCMenuItemImage ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8167#post-47530</link>
			<pubDate>Fri, 23 Jul 2010 21:57:14 +0000</pubDate>
			<dc:creator>EasyDev</dc:creator>
			<guid isPermaLink="false">47530@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey developers,</p>
<p>I am just searching everywhere how to change the default touch up inside state on the CCMenuItemImage to touchdown state ?</p>
<p>Thanks in advance,<br />
Best regards
</p></description>
		</item>
		<item>
			<title>sneakyness on "SneakyInput 0.3 is on it&#039;s way!"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5922#post-35066</link>
			<pubDate>Fri, 23 Apr 2010 04:18:11 +0000</pubDate>
			<dc:creator>sneakyness</dc:creator>
			<guid isPermaLink="false">35066@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello everybody! It's been a while since you've heard the word on <a href="http://github.com/sneakyness/SneakyInput">SneakyInput</a>.</p>
<p>The word is: <a href="http://pledgie.com/campaigns/9124"><em>I'm kicking ass!</em></a> :) I've received $105 in donations as of version 0.2. You might be wondering what all that money buys, the answer is: <a href="http://github.com/sneakyness/SneakyInput/issues">SneakyInput 0.3</a>!</p>
<p>I'm planning the next version right now, here are the <strong>currently planned features</strong>:</p>
<p><strong><a>Directional Analog Joysticks/Sliders</a></strong> - Joysticks that only work in two directions from the center in one line. This can be used with or without auto-center to make all sorts of controls, such as thruster, balance, or volume/fader controls. </p>
<p><strong><a>Visual Input Diagnostics</a></strong> - Debugging tools, graphs that show data for the sneakyinput it's enabled for, bars for force, velocity indicators, rotation, angle, degrees, position, button state, slider position, etc. Also doubles as indicators for an interface, such as making a green light to show that something is enabled. </p>
<p><strong><a>Event System/Callbacks</a></strong> - This one is a doozie, and I would appreciate a lot of user input.<em>(pun intended)</em> Basically you'll be able to set events for certain states, so like, a range of force in a certain direction, or the activation of a button. There will also be all the usual callbacks, such as input started/finished/is happening/etc. </p>
<p><strong><a>Draggable Buttons</a></strong> - Pretty self explanatory</p>
<p><strong><a>SneakyKnob/SneakySlider</a></strong> - A knob and a slider, with and without "clicks", and also toggleable auto-return and value-linking (moves to reflect change in value)</p>
<p><strong><a>SneakyBlister</a></strong> - A controller that will generate SneakyButtons around an object, so that you are presented with options when you touch an object. Pretty handy stuff. I'm sure everybody will really appreciate/abuse this one ;)</p>
<p>Now, these are just the things I want to do. I'm pretty overambitious. We'll see how much of this really makes it into the next version. Do you have suggestions? Do you have something you really want? A good idea? Do you want to collaborate? <a href="http://github.com/sneakyness/SneakyInput/issues">Come to the GitHub!</a> You can post your thoughts and ideas here as well, but the only way to make sure everybody working on the project will see what you said is to post them in Issues on the GitHub. </p>
<p>If you use SneakyInput, be sure to let us know, we really appreciate it! :)
</p></description>
		</item>

	</channel>
</rss>

