<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: A Tip on the Boolean() Function (Casting as Boolean)</title>
	<link>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean</link>
	<description>Luck is the residue of good design.</description>
	<pubDate>Tue, 06 Jan 2009 22:40:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-82742</link>
		<pubDate>Tue, 18 Sep 2007 14:27:27 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-82742</guid>
					<description>alejandro,

Well, this is interesting.  Certainly, three &lt;code&gt;if&lt;/code&gt; statements in a row will execute as well as one (or five, or ten).  I wonder if your &lt;code&gt;attachMovie()&lt;/code&gt; references are inadvertently bringing new ActionScript into the mix?

In a case like this, where the code seems to be behaving in an illogical manner, it helps to break things down into smaller pieces, to troubleshoot each step in turn.  So for the time being, for example, drop all the &lt;code&gt;if&lt;/code&gt;s but the first one (&lt;code&gt;arreglo3&lt;/code&gt;) and make sure that one performs the way you expect.

Incidentally, you probably don't need the new &lt;code&gt;arreglo3&lt;/code&gt; variable, since you can reference &lt;code&gt;_root.btn3admintitle&lt;/code&gt; right there in the &lt;code&gt;if&lt;/code&gt; statement:

&lt;pre&gt;&lt;code&gt;if (_root.btn3admintitle == &amp;#34;falso&amp;#34;) {
  _root.btn3.titu.text = _root.btn3admintitle;
} else {
  _root.mainMenu.peliMovie.attachMovie(
    &amp;#34;btn3admin&amp;#34;,
    &amp;#34;btn3adminvideo&amp;#34;,
    this.getNextHighestDepth(),
    {_x:5, _y:18}
  );
}&lt;/code&gt;&lt;/pre&gt;

You may also want to put a &lt;code&gt;trace()&lt;/code&gt; in either clause, just to make doubly sure you know how the &lt;code&gt;if&lt;/code&gt; statement's condition is being interpreted:

&lt;pre&gt;&lt;code&gt;if (_root.btn3admintitle == &amp;#34;falso&amp;#34;) {
  trace(&amp;#34;btn3admintitle true&amp;#34;);
  _root.btn3.titu.text = _root.btn3admintitle;
} else {
  trace(&amp;#34;btn3admintitle false&amp;#34;);
  _root.mainMenu.peliMovie.attachMovie(
    &amp;#34;btn3admin&amp;#34;,
    &amp;#34;btn3adminvideo&amp;#34;,
    this.getNextHighestDepth(),
    {_x:5, _y:18}
  );
}&lt;/code&gt;&lt;/pre&gt;

Often by breaking down a complex goal (three &lt;code&gt;if&lt;/code&gt;s) into a simpler one, you can discover mistaken assumptions on your part, or otherwise see something you missed previously.</description>
		<content:encoded><![CDATA[<p>alejandro,</p>
<p>Well, this is interesting.  Certainly, three <code>if</code> statements in a row will execute as well as one (or five, or ten).  I wonder if your <code>attachMovie()</code> references are inadvertently bringing new ActionScript into the mix?</p>
<p>In a case like this, where the code seems to be behaving in an illogical manner, it helps to break things down into smaller pieces, to troubleshoot each step in turn.  So for the time being, for example, drop all the <code>if</code>s but the first one (<code>arreglo3</code>) and make sure that one performs the way you expect.</p>
<p>Incidentally, you probably don&#8217;t need the new <code>arreglo3</code> variable, since you can reference <code>_root.btn3admintitle</code> right there in the <code>if</code> statement:</p>
<pre><code>if (_root.btn3admintitle == &quot;falso&quot;) {
  _root.btn3.titu.text = _root.btn3admintitle;
} else {
  _root.mainMenu.peliMovie.attachMovie(
    &quot;btn3admin&quot;,
    &quot;btn3adminvideo&quot;,
    this.getNextHighestDepth(),
    {_x:5, _y:18}
  );
}</code></pre>
<p>You may also want to put a <code>trace()</code> in either clause, just to make doubly sure you know how the <code>if</code> statement&#8217;s condition is being interpreted:</p>
<pre><code>if (_root.btn3admintitle == &quot;falso&quot;) {
  trace(&quot;btn3admintitle true&quot;);
  _root.btn3.titu.text = _root.btn3admintitle;
} else {
  trace(&quot;btn3admintitle false&quot;);
  _root.mainMenu.peliMovie.attachMovie(
    &quot;btn3admin&quot;,
    &quot;btn3adminvideo&quot;,
    this.getNextHighestDepth(),
    {_x:5, _y:18}
  );
}</code></pre>
<p>Often by breaking down a complex goal (three <code>if</code>s) into a simpler one, you can discover mistaken assumptions on your part, or otherwise see something you missed previously.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: alejandro</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-79189</link>
		<pubDate>Thu, 06 Sep 2007 14:35:26 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-79189</guid>
					<description>hei,,  i dont know if you have the time to answer me this questions,  but i'm a little bit deseperated....

i have this script:


var arreglo3:String =_root.btn3admintitle;

var arreglo4:String =_root.btn4minsidetitle;

var arreglo5:String =_root.btn5systemtitle;


if(arreglo3 == &quot;falso&quot;){
	_root.btn3.titu.text = arreglo3;
}
	else{
	_root.mainMenu.peliMovie.attachMovie(&quot;btn3admin&quot;, &quot;btn3adminvideo&quot;, this.getNextHighestDepth(), {_x:5, _y:18});
}



if(arreglo4 == &quot;falso&quot;){
	this.btn4.titu.text = arreglo4;
}
	else{
	this.mainMenu.peliMovie.attachMovie(&quot;btn4minside&quot;, &quot;btn4minsidevideo&quot;, this.getNextHighestDepth(), {_x:5, _y:54});
}


if(arreglo5 == &quot;falso&quot;){
	this.btn5.titu.text = arreglo5;
}
	else{
	this.mainMenu.peliMovie.attachMovie(&quot;btn5system&quot;, &quot;btn5systemvideo&quot;, this.getNextHighestDepth(), {_x:5, _y:92});
}



what i want to do is to evaluate several times different variables, wheter if they are = to &quot;falso&quot; or to ather string, 

The problem is that when the script runs it only read the last script...  the last &quot;if&quot;...  how can i make it to read all the 3 &quot;if's&quot;...??  or more?....

thanks

alejandro</description>
		<content:encoded><![CDATA[<p>hei,,  i dont know if you have the time to answer me this questions,  but i&#8217;m a little bit deseperated&#8230;.</p>
<p>i have this script:</p>
<p>var arreglo3:String =_root.btn3admintitle;</p>
<p>var arreglo4:String =_root.btn4minsidetitle;</p>
<p>var arreglo5:String =_root.btn5systemtitle;</p>
<p>if(arreglo3 == &#8220;falso&#8221;){<br />
	_root.btn3.titu.text = arreglo3;<br />
}<br />
	else{<br />
	_root.mainMenu.peliMovie.attachMovie(&#8221;btn3admin&#8221;, &#8220;btn3adminvideo&#8221;, this.getNextHighestDepth(), {_x:5, _y:18});<br />
}</p>
<p>if(arreglo4 == &#8220;falso&#8221;){<br />
	this.btn4.titu.text = arreglo4;<br />
}<br />
	else{<br />
	this.mainMenu.peliMovie.attachMovie(&#8221;btn4minside&#8221;, &#8220;btn4minsidevideo&#8221;, this.getNextHighestDepth(), {_x:5, _y:54});<br />
}</p>
<p>if(arreglo5 == &#8220;falso&#8221;){<br />
	this.btn5.titu.text = arreglo5;<br />
}<br />
	else{<br />
	this.mainMenu.peliMovie.attachMovie(&#8221;btn5system&#8221;, &#8220;btn5systemvideo&#8221;, this.getNextHighestDepth(), {_x:5, _y:92});<br />
}</p>
<p>what i want to do is to evaluate several times different variables, wheter if they are = to &#8220;falso&#8221; or to ather string, </p>
<p>The problem is that when the script runs it only read the last script&#8230;  the last &#8220;if&#8221;&#8230;  how can i make it to read all the 3 &#8220;if&#8217;s&#8221;&#8230;??  or more?&#8230;.</p>
<p>thanks</p>
<p>alejandro
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-25137</link>
		<pubDate>Sun, 18 Mar 2007 23:57:08 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-25137</guid>
					<description>Gaute,

Sure thing!  Glad this was helpful to you.  :)</description>
		<content:encoded><![CDATA[<p>Gaute,</p>
<p>Sure thing!  Glad this was helpful to you.  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Gaute</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-25054</link>
		<pubDate>Sun, 18 Mar 2007 14:52:45 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-25054</guid>
					<description>Thank you so much for this post. I was nearly going mad trying to make a graph that should scale by the highest Y and X values (with XML-data). Its strange, it would draw the graphs correctly although they were based on stringdata, but as soon as i tried sort functions or &amp;#62;, it would compare strings. Anyway, thank you and have a good day.</description>
		<content:encoded><![CDATA[<p>Thank you so much for this post. I was nearly going mad trying to make a graph that should scale by the highest Y and X values (with XML-data). Its strange, it would draw the graphs correctly although they were based on stringdata, but as soon as i tried sort functions or &gt;, it would compare strings. Anyway, thank you and have a good day.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-11508</link>
		<pubDate>Wed, 10 Jan 2007 20:42:37 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-11508</guid>
					<description>Nice!  I always like the variety of your compact approaches, NSurveyor.  :)</description>
		<content:encoded><![CDATA[<p>Nice!  I always like the variety of your compact approaches, NSurveyor.  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: NSurveyor</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-11505</link>
		<pubDate>Wed, 10 Jan 2007 20:33:09 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/casting-as-boolean#comment-11505</guid>
					<description>You can further simplify the compacted code to the following :

var str:String = &quot;false&quot;;
var boo1:Boolean = str == &quot;true&quot;; //everything but &quot;true&quot; is false
var boo2:Boolean = str != &quot;false&quot;; //everything but &quot;false&quot; is true

The above shows two different ways of considering it, if the string is &quot;true&quot;, or the string is not &quot;false&quot;. So by the first method (boo1), &quot;happiness&quot; would go to false, and by the second (boo2), it would go to true.</description>
		<content:encoded><![CDATA[<p>You can further simplify the compacted code to the following :</p>
<p>var str:String = &#8220;false&#8221;;<br />
var boo1:Boolean = str == &#8220;true&#8221;; //everything but &#8220;true&#8221; is false<br />
var boo2:Boolean = str != &#8220;false&#8221;; //everything but &#8220;false&#8221; is true</p>
<p>The above shows two different ways of considering it, if the string is &#8220;true&#8221;, or the string is not &#8220;false&#8221;. So by the first method (boo1), &#8220;happiness&#8221; would go to false, and by the second (boo2), it would go to true.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
