<?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; Topic: MenuItem FadeIn glitch?</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/3413</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 01:58:29 +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/topic/3413" rel="self" type="application/rss+xml" />

		<item>
			<title>ShaneT on "MenuItem FadeIn glitch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3413#post-125358</link>
			<pubDate>Thu, 10 Nov 2011 12:04:01 +0000</pubDate>
			<dc:creator>ShaneT</dc:creator>
			<guid isPermaLink="false">125358@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I am trying to make a menu see through.</p>
<p>radioMenu.opacity = 0;</p>
<p>When I try this I get told opacity is a readonly fielld and cannot be set.</p>
<p>Same goes for </p>
<p>((CCMenuItem*) settings).opacity = 0;<br />
or<br />
[(CCMenuItem*)settings setOpacity: 0];</p>
<p>How do I make a menu item images opacity 50?</p>
<p>I am trying to implement a pause button on the screen to pause and resume.</p>
<p>The pause button is on the Hud Layer.</p>
<p>Thanks</p>
<p>Shane
</p></description>
		</item>
		<item>
			<title>gangcil on "MenuItem FadeIn glitch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3413#post-60867</link>
			<pubDate>Wed, 27 Oct 2010 10:33:54 +0000</pubDate>
			<dc:creator>gangcil</dc:creator>
			<guid isPermaLink="false">60867@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/30412'>tim</a>:<br />
thanks for the post...well it works well and the object fade in correctly......but what if i want to fade out it again??? here is what i did..</p>
<p> first add a sprite to scene<br />
<pre><code>resumeS = [CCSprite spriteWithFile:@&#34;Background_Pause_pad.png&#34;];
		[resumeS setPosition:ccp(384,470)];

		[self addChild:resumeS z:1];</code></pre>
<p>than fadein it in response to button press  </p>
<pre><code>resumeS.opacity = 0;

	       [resumeS runAction:[CCFadeIn actionWithDuration:2]];</code></pre>
<p>and once again fadeout it response to button</p>
<p><code></code>[resumeS runAction:[CCFadeOut actionWithDuration:2]];`<br />
`<br />
but it does not work.....
</p></description>
		</item>
		<item>
			<title>Joe Henry on "MenuItem FadeIn glitch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3413#post-21018</link>
			<pubDate>Tue, 15 Dec 2009 13:00:55 +0000</pubDate>
			<dc:creator>Joe Henry</dc:creator>
			<guid isPermaLink="false">21018@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Wow, thanks for the help guys!  I fiddled with it so much yesterday that I just decided to fade my whole scene in and forget about menuItem fades, although I wouldn't mind getting that working.  I'll take a look at it and seen if any of those suggestions work!  Thanks a bunch!</p>
<p>- Joe
</p></description>
		</item>
		<item>
			<title>Tim on "MenuItem FadeIn glitch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3413#post-20975</link>
			<pubDate>Tue, 15 Dec 2009 00:42:11 +0000</pubDate>
			<dc:creator>Tim</dc:creator>
			<guid isPermaLink="false">20975@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Yeah, I was quickly posting before walking out the door this morning so should've clarified...here's what I use for a fade in menu:</p>
<pre><code>MenuItem *previous = [MenuItemImage itemFromNormalImage:@&#34;previous-button.png&#34; selectedImage:@&#34;previous-button-pressed.png&#34; target:self selector:@selector(previousSong:)];
MenuItem *stop = [MenuItemImage itemFromNormalImage:@&#34;stop-button.png&#34; selectedImage:@&#34;stop-button-pressed.png&#34; target:self selector:@selector(stopMusic:)];
MenuItem *play = [MenuItemImage itemFromNormalImage:@&#34;play-button.png&#34; selectedImage:@&#34;play-button-pressed.png&#34; target:self selector:@selector(playMusic:)];
MenuItem *next = [MenuItemImage itemFromNormalImage:@&#34;next-button.png&#34; selectedImage:@&#34;next-button-pressed.png&#34; target:self selector:@selector(nextSong:)];

radioMenu = [Menu menuWithItems:previous, stop, play, next, nil];
[radioMenu alignItemsHorizontally];
radioMenu.position = ccp(240, 22);
radioMenu.opacity = 0;
[self addChild:radioMenu z:3];
[radioMenu runAction:[FadeIn actionWithDuration:.5]];</code></pre>
<p>Hope this helps or clarifies my earlier post.
</p></description>
		</item>
		<item>
			<title>Lam on "MenuItem FadeIn glitch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3413#post-20958</link>
			<pubDate>Mon, 14 Dec 2009 21:26:37 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">20958@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/4664'>guitarcrazy087</a></p>
<p>'Try assigning the menu item 'settings' to a Menu and then applying the change in opacity to the menu.'</p>
<p>What Tim is saying above is to cast your 'settings' variable to the appropriate Class that has an RGBAProtocol.</p>
<p>(Note: I'm working with 0.9 so naming has changed but you know the corresponding 0.8 names)<br />
CCMenu inherits the RGBAProtocol to have modifiers to 'opacity'</p>
<p>But you're stating that settings.opacity doesn't work therefore I'll assume that you've declared it as: ('settings' is missing the type declaration so it's hard to tell)<br />
<pre><code>id settings = [MenuItemImage itemFromNormalImage:@&#34;settings.png&#34; selectedImage:@&#34;settings.png&#34; target:self selector:@selector(settingsScene:)];

or CocosNode *settings = [MenuItemImage itemFromNormalImage:@&#34;settings.png&#34; selectedImage:@&#34;settings.png&#34; target:self selector:@selector(settingsScene:)];</code></pre>
<p>id (or 'CocosNode') does not inherit the RGBAProtocol though (or the 0.8 namespace for an RGBAProtocol) so it needs to be casted to a class that does in order for the compiler to be able to allow a change in opacity.<br />
<pre><code>((CCMenuItem*) settings).opacity = 0;
or
[(CCMenuItem*)settings setOpacity: 0];</code></pre></description>
		</item>
		<item>
			<title>caw4949 on "MenuItem FadeIn glitch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3413#post-20957</link>
			<pubDate>Mon, 14 Dec 2009 21:01:07 +0000</pubDate>
			<dc:creator>caw4949</dc:creator>
			<guid isPermaLink="false">20957@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>How about initializing the menu item off screen, and change to the correct position before running your action?
</p></description>
		</item>
		<item>
			<title>Joe Henry on "MenuItem FadeIn glitch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3413#post-20937</link>
			<pubDate>Mon, 14 Dec 2009 16:45:51 +0000</pubDate>
			<dc:creator>Joe Henry</dc:creator>
			<guid isPermaLink="false">20937@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks for the speedy reply Tim!<br />
Your idea about fading after I setup the menu didn't work... I get the same results... =[</p>
<p>I've tried setting it up like:</p>
<p><code>[settings runAction:[FadeIn actionWithDuration:0.5]];</code></p>
<p>and also like this:</p>
<p><code>Action *fade = [FadeIn actionWithDuration:0.5]];<br />
[settings runAction:fade];</code></p>
<p>but neither of those work.  After working with this and testing the different methods I found that the glitch actually appears to be random... sometimes everything fades in properly, and sometimes I get the glitch...</p>
<p>Could it have to do with loading time? Like maybe it's taking to long to load the position and rotation properties so it displays the image before it gets to the fade part of the code? I'm new to cocos2d so I'm just guessing... I just tried splitting the code up into two different methods so that the image position and fade in were called after everything else was loaded but it's still acting up....</p>
<p>Any other ideas? Or is this maybe just something wrong with cocos?
</p></description>
		</item>
		<item>
			<title>Tim on "MenuItem FadeIn glitch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3413#post-20933</link>
			<pubDate>Mon, 14 Dec 2009 16:24:28 +0000</pubDate>
			<dc:creator>Tim</dc:creator>
			<guid isPermaLink="false">20933@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Try assigning the menu item 'settings' to a Menu and then applying the change in opacity to the menu.
</p></description>
		</item>
		<item>
			<title>Joe Henry on "MenuItem FadeIn glitch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3413#post-20930</link>
			<pubDate>Mon, 14 Dec 2009 15:54:16 +0000</pubDate>
			<dc:creator>Joe Henry</dc:creator>
			<guid isPermaLink="false">20930@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Yeah, I did try that and it gives me this error:</p>
<p>"Request for member 'opacity' in something not a structure or union"</p>
<p>...Any ideas?</p>
<p>Thanks for your response =]
</p></description>
		</item>
		<item>
			<title>Tim on "MenuItem FadeIn glitch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3413#post-20929</link>
			<pubDate>Mon, 14 Dec 2009 15:40:54 +0000</pubDate>
			<dc:creator>Tim</dc:creator>
			<guid isPermaLink="false">20929@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Try setting opacity to zero before running the action:</p>
<pre><code>settings.opacity = 0;</code></pre></description>
		</item>
		<item>
			<title>Joe Henry on "MenuItem FadeIn glitch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3413#post-20927</link>
			<pubDate>Mon, 14 Dec 2009 15:20:27 +0000</pubDate>
			<dc:creator>Joe Henry</dc:creator>
			<guid isPermaLink="false">20927@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey people,</p>
<p>I am making a simple game and in my first scene (my main menu scene) I'm trying to fade my menu items in like so:</p>
<p><code>settings = [MenuItemImage itemFromNormalImage:@"settings.png" selectedImage:@"settings.png" target:self selector:@selector(settingsScene:)];<br />
settings.position = ccp(-130, 210);<br />
settings.rotation = 340;<br />
[settings runAction:[FadeIn actionWithDuration:1.0f]];</code></p>
<p>I later add the settings object to a menu object.</p>
<p>My problem with this is that when I first launch my app the settings icon displays at full opacity and then it gets to the fade code so the icon disappears and then fades back in.  I'd like it to just start with 0 opacity and fade in.</p>
<p>Any answers are welcome =]</p>
<p>- Joe
</p></description>
		</item>

	</channel>
</rss>

