<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:thr="http://purl.org/syndication/thread/1.0">
  <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html" />
  <link rel="self" type="application/atom+xml" href="http://www.insideria.com/atom.xml" />
  <id>tag:www.insideria.com,2009://34/tag:www.insideria.com,2008://34.23180-</id>
  <updated>2009-11-16T15:07:39Z</updated>
  <title>Comments for LFFS - 5: ActionScript 3.0 - Conditionals and Loops (http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html)</title>
  <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.21-en</generator>
  <entry>
    <id>tag:www.insideria.com,2008://34.23180</id>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.oreilly.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=34/entry_id=23180" title="LFFS - 5: ActionScript 3.0 - Conditionals and Loops" />
    <published>2008-03-21T15:00:00Z</published>
    <updated>2008-06-25T01:15:57Z</updated>
    <title>LFFS - 5: ActionScript 3.0 - Conditionals and Loops</title>
    <summary>In order for software to be useful, it needs to be able to react to its environment. Put another way, a program needs to have logic. The logic of an application gives it the ability to change course when a given condition is met. Program flow in ActionScript 3.0 is controlled by conditionals and loops. Both conditionals and loops are responsible for determining whether a particular code block is executed, and are therefore placed within a method body. The main difference between the two is that conditionals decide on executing one collection of statements over another, and loops allow a collection of statements to execute over and over. As we&apos;ll soon see, loops, like many things in object-oriented programming, are great tools that provide the very important element of scalability. But first, a bit about conditionals.</summary>
    <author>
      <name><![CDATA[Adam Flater &amp; Scott Sheridan]]></name>
      
    </author>
    
    <category term="Blogs" />
    
    <content type="html" xml:lang="en" xml:base="http://www.insideria.com/">
      <![CDATA[<p>In order for software to be useful, it needs to be able to react to its environment. Put another way, a program needs to have logic. The logic of an application gives it the ability to change course when a given condition is met. Program flow in ActionScript 3.0 is controlled by conditionals and loops. Both conditionals and loops are responsible for determining whether a particular code block is executed, and are therefore placed within a method body. The main difference between the two is that conditionals decide on executing one collection of statements over another, and loops allow a collection of statements to execute over and over. As we'll soon see, loops, like many things in object-oriented programming, are great tools that provide the very important element of scalability. But first, a bit about conditionals.</p>


<strong>Conditionals</strong>

<p>There are three basic conditional statements for use in ActionScript 3.0. They are: the "if, else" statement, the "if, else, if" statement, and the "switch" statement.</p>

 

<p>The "if, else" conditional allows your program to test for a stated condition, and then execute some determined block of code "if" the condition exists. If the condition does not exist, the "else" part of the conditional statement cues your program to execute some other block of code. Let's check out what the if, else code looks like, and break it down.</p>

 
<div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre> 
<span class="category1">if</span> (a == b)
{
      doSomething();
}
<span class="category1">else</span>
{
      doSomethingElse();
}

 </pre>
</code>

</div></div>


<p>As it is, our code asks if a is equal to b. If that's true, the program should "do something". If it's not true that a equals b, then the program should "do something else". So put another way, if the value of the variable labeled "a" is equal to the value of the variable labeled "b" then the code block named "doSomething" is executed, otherwise the code block named "doSomethingElse" is executed.</p>

 

<p>An "if, else, if" conditional statement can ask if more than one condition is met. A code block can be executed if a condition is met, and then yet another code block can be executed if a different condition is instead met. It looks like this:</p>

 
<div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre> 

<span class="category1">if</span> (a == b)
{
      doSomething();
}
<span class="category1">else</span> <span class="category1">if</span> (a == c)
{
      doSomethingElse();
}

 </pre>
</code>

</div></div>

 

<p>In this case, we are testing to see if a is equal to b, <em>and</em> if a is equal to c. If it turns out that a is equal to b, then the first code block is called. If that's not the case, but a happens to be equal to c, then the second code block is called.</p>

 

<p>Both "if, else", and "if, else, if" conditionals test for Boolean values, that is, whether it's true or not that a condition exists. A switch statement, on the other hand, doesn't need a Boolean value to be returned. Instead, it evaluates an expression and determines the correct code to execute based on the result.</p>

 
<div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">var</span> finishPlace : Result; <span class="linecomment">// finishPlace is fetched from a service that our app uses</span>
<span class="category1">var</span> myPlace : <span class="category1">int</span> = finishPlace.getPlace();
<span class="category1">switch</span>(myPlace)
{
      <span class="category1">case</span> 0:
           <span class="category2">trace</span>("<span class="quote">First place - You're the champion!</span>");
           <span class="category1">break</span>;
 
      <span class="category1">case</span> 1:
           <span class="category2">trace</span>("<span class="quote">Second</span>");
           <span class="category1">break</span>;
 
      <span class="category1">case</span> 2:
           <span class="category2">trace</span>("<span class="quote">Third</span>");
           <span class="category1">break</span>;
 
      <span class="category1">case</span> 3:
           <span class="category2">trace</span>("<span class="quote">Fourth</span>");
           <span class="category1">break</span>;
 
      <span class="category1">case</span> 4:
           <span class="category2">trace</span>("<span class="quote">Fifth</span>");
           <span class="category1">break</span>;
 
      <span class="category1">default</span>:
           <span class="category2">trace</span>("<span class="quote">sorry, you didn't make the top 5</span>");
           <span class="category1">break</span>;
}</pre>
</code>

</div></div>
 

 

<p>This switch statement evaluates the results of the "getPlace" method as it applies to the "finishPlace" variable to determine the value of the "myPlace" variable. Since ActionScript is a "zero-based" language, our count can begin at zero, and be assigned a value of 1. The "switch(myPlace)" statement tells the compiler that a switch statement is in play. The "case" and "break" statements mark the beginning and end of each code block that may be called depending on the result that the getResult function returns. So basically, I'm asking the getResult method to find out what place I came in, and then asking the switch statement to let me know the results.</p>

 

 

<strong>Loops</strong>

<p>As I said before, loops are another great tool in object-oriented programming that allow for scalability. A loop is simply the repetition, or <em>iteration</em> of a block of code. Ideally, all loops will have a point at which they come to a stop, but this isn't always the case, as we'll soon see. What makes loops such a valuable tool is the fact that in order to accomplish the same task without one, you'd have to write a huge amount of code. For example, let's say you'd like to create five hundred instances of a button when a user enters the correct information in a text field. (why not?) One way to do this is to simply to write a loop that calls the button's constructor method when the conditions are right, and then iterates five hundred times. It might look something like this:</p>

 
<div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">var</span> button : <span class="category2">Button</span> = <span class="category1">null</span>;
<span class="category1">for</span> ( <span class="category1">var</span> i : <span class="category1">int</span> = 0; i &lt; 500 ; i++)
{
      button = <span class="category1">new</span> <span class="category2">Button</span>();
      <span class="linecomment">// do something with button</span>
}

 </pre>
</code>

</div></div>


<p>Without the use of a loop, a programmer would have to write over 500 lines of code to do the same job that can be done in just a few.</p>

 

<p>ActionScript 3.0 employs the use of 5 different types of loops to control the flow of an application. They are: the "while" loop, the "do while" loop, the "for" loop, the "for..in" loop, and the "for each..in" loop.</p>

 

<strong>The While Loop</strong>

<p>The while loop allows a block of code to run continuously as long as a certain condition is met. In this case, the code block repeats over and over until the condition no longer exists. While loops can be tricky because they can create an infinite loop if not coded correctly, causing the program to crash. In order to avoid this, it's important to include a stop point for your loop. Consider the following example of a while loop:</p>

 <div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>


<span class="category1">var</span> i : <span class="category1">int</span> = 0;
<span class="category1">while</span> (i &lt; 50)
{
      doSomething();
      i++;
}</pre>
</code>

</div></div>

<p>The first thing we see is a variable named "i". (It's common practice to name incrementing variables "i".) The variable "i" is an integer, and it's initial value is set to 0. Our loop says that "while the value of i is less than 50, loop away". For every iteration of the loop, the "doSomething" code block is carried out, and the variable i is incremented in value by 1. (The "++" operator means to increment by 1. You can also employ the "--" operator which means to decrement by 1.) Because we have included the "i++" statement, the value of i will continually increase on every iteration of the loop as long as it's less than 50. It won't loop again if it reaches 50 because of our conditional statement: while (i<50). While loops will compile, however, without a "i++" statement, unlike other loops. Of course, excluding the increment statement would result in an infinite loop, causing the program to crash.</p>

<strong> 

Do..While Loops</strong>

<p>Much like while loops, do..while loops allow code to loop as long as a condition is met. The difference here is that a do..while loop allows the code to execute at least one time because the condition is not tested for until after the code is executed. Here's the code:</p>

 <div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre> 
<span class="category1">var</span> i : <span class="category1">int</span> = 0;
<span class="category1">do</span>
{
      someFunction(i);
      i++;
}

<span class="category1">while</span> (i &lt; 5);

 </pre>
</code>

</div></div> 

Notice how the while statement comes after the code block.</br>

 
<strong>
For Loops</strong>

<p>For loops are used to iterate through a given range of values for a particular variable.
Unlike while, and do..while loops, for loops require the inclusion of an expression that changes the variable's value on each iteration of the loop. In fact, for loops have three requirements: the variable with it's initial value, the conditional statement that explains the conditions necessary for looping, and the expression that changes the value of the variable. They are written like so:</p>

 <div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>


<span class="category1">var</span> i : <span class="category1">int</span>;
<span class="category1">for</span> (i = 5; i &lt; 50; i++)
{
      someFunction();
}
 </pre>
</code>

</div></div>


<p>Our loop says that someFunction should be performed when the value of i is between 5 and 50. Variable i will increase in value by 1 on every iteration of the loop, and the loop will cease once the value is not less than 50.</p>

 
<strong>
For..in Loops</strong>

<p>For..in loops are used to iterate through the properties of a generic object. Properties are not iterated over in any particular order since ActionScript doesn't store variable names in any particular order.</p>

 

 
<div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>


<span class="category1">for</span> (<span class="category1">var</span> i : <span class="category2">String</span> <span class="category1">in</span> someObject)
{
      <span class="category2">trace</span>(i);
}
     <span class="linecomment">//output:</span>
     propertyNameOne
     propertyNameTwo
     propertyNameThree

 </pre>
</code>

</div></div> 

 

<strong>For each..in Loops</strong>

<p>For each..in loops are used to iterate through the values of items in a list, such as an XML document, an Array, or an ArrayCollection. The main difference between a for each..in loop and a for..in loop is that a for each..in loop iterates over the <em>value</em> of an item, and a for..in loop iterates over the variable name.</p>

 
<div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre> 


<span class="category1">for</span> each (<span class="category1">var</span> item : <span class="category2">Object</span> <span class="category1">in</span> someCollection)
{
      <span class="category2">trace</span>(item);
}
     <span class="linecomment">//output:</span>
     [object <span class="category2">Object</span>]
     [object <span class="category2">Object</span>]
     [object <span class="category2">Object</span>]

 </pre>
</code>

</div></div> 

 

<p>We've discussed the basics of object-oriented programming and several points about the creation of classes in ActionScript, but before we can build even a simple application, we need to cover at least one more area. Our next post will discuss collections and arrays. Very soon we will have the skills needed to build simple widgets in ActionScript, and the background knowledge necessary for our journey deeper into the world of Flex.</p>

 

 

 

 

 

 
<big><big><strong>
Glossary of Terms</strong></big></big>

 

<p><strong>case (expression) -</strong> Within a switch conditional statement, a case expression precedes every

                                     possible block of code that may be called.</p>

                                     

 

<p><strong>Conditional -</strong> A special statement type used to control the flow of an application. A

                           conditional statement tests for a given condition and allows a designated

                           block of code to execute based on the validity of said condition.</p>

 

<p><strong>do while (loop) -</strong> A type of while loop that allows at least one execution of a code block

                                  due to the fact that the condition isn't tested until after the code block is

                                  executed.</p>

 

<p><strong>for (loop) -</strong> A loop that iterates through a specific range of values.</p>

 

<p><strong>for..in (loop) -</strong> A loop that iterates through an object's variables.</p>

 

<p><strong>for each..in (loop) -</strong> A loop that iterates through the values of items in a collection.</p>

 
<p><strong>
if, else -</strong> The most basic type of conditional statement. An if, else conditional tests for a certain condition, and if it finds it, executes a given code block. If the condition is not found, an alternate code block is executed.</p>

<p><strong>if, else, if -</strong> A conditional statement that is able to test for multiple conditions, not simply the  presence or absence of one condition.</p>

<p><strong>Iterate -</strong> Simply, to do once again. In regards to looping, to iterate is to run through one round of the loop.</p>

<p><strong>loop -</strong> A method to provide program flow in which conditions are tested for and code blocks are executed a certain number of times.</p>

<p><strong>switch -</strong> A type of conditional statement in which the code block to be executed can be any number of different possible outcomes depending on the value returned in the conditional.</p>
 
<p><strong>
trace () function -</strong> A top level function that displays expressions, or writes to log files while debugging.</p>

<p><strong>
while (loop) -</strong> A loop that allows a code block to be executed as long as a given condition is met.</p>

<p>
Next: <a href="http://www.insideria.com/2008/04/lffs-6-actionscript-30-arrays.html">LFFS - 6: ActionScript 3.0 - Arrays</a>
</p>

 

 

 

 

 

 <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-3756476-7";
urchinTracker();
</script>]]>
      
    </content>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2016047</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2016047" />
    <title>Comment from Andrew Trice on 2008-03-21</title>
    <author>
        <name>Andrew Trice</name>
        <uri>http://www.tricedesigns.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.tricedesigns.com">
        <![CDATA[<p>Don't forget the conditional ternary operator!<br />
x = (  a == b ) ? y : z;</p>

<p>If a equals b, then x will equal y, else x will equal z.</p>]]>
    </content>
    <published>2008-03-21T15:40:37Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2016049</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2016049" />
    <title>Comment from Bartek on 2008-03-21</title>
    <author>
        <name>Bartek</name>
        <uri>http://www.everydayflash.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.everydayflash.com">
        <![CDATA[<p>I would also mention the <b>break</b> and <b>continue</b> keywords that can appear in <b>for, for in, for each</b> and <b>while</b> loops. </p>

<p>The <b>break</b> keyword will terminate a loop. It usually is used together with conditionals to exit a loop before it reaches its natural end. Ex. when searching for a property of an object in a <b>for in</b> loop, once the property is found, <b>break</b> be used to end the loop immediately.</p>

<p>The <b>continue</b> keyword will not end a loop, but instead it will terminate one iteration without executing any more statements, and start the next one.</p>]]>
    </content>
    <published>2008-03-21T16:17:55Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2016053</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2016053" />
    <title>Comment from kathryn on 2008-03-21</title>
    <author>
        <name>kathryn</name>
        <uri>http://kathrynrotondo.com/weblog</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://kathrynrotondo.com/weblog">
        <![CDATA[<p>great article!  i'm a flash teacher and will send this link out to my students.  one note: the code formatting for the loops section is all very strange.  it would be great to clean up the indenting -- it's better practice, and much easier for beginners to read.</p>]]>
    </content>
    <published>2008-03-21T18:28:36Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2016056</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2016056" />
    <title>Comment from Adam Flater on 2008-03-21</title>
    <author>
        <name>Adam Flater</name>
        <uri>http://adamflater.net</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://adamflater.net">
        <![CDATA[<p>@andrew</p>

<p>Nice point.. thanks man.. We kind of wanted to cover the basics in this post since the series is targeted at non-programmers, but it was probably an oversight to not at least mention the ternary operator. It is one of my favorite geeky cool conditionals.</p>]]>
    </content>
    <published>2008-03-21T19:28:21Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2016057</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2016057" />
    <title>Comment from Adam Flater on 2008-03-21</title>
    <author>
        <name>Adam Flater</name>
        <uri>http://adamflater.net</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://adamflater.net">
        <![CDATA[<p>@bartek</p>

<p>Thanks for mentioning this. I actually tend to avoid using <b>break</b> and <b>continue</b>, but sometimes it's very effective to use them. They kind of remind me of using a goto statement back in the BASIC / Pascal days. </p>

<p>I think especially for a beginning programmer it's a little more intuitive to build that kind of logic into the conditional of the loop. Although, if you're tuning for efficiency <b>break</b> and <b>continue</b> can be a good choice. (IMHO)</p>]]>
    </content>
    <published>2008-03-21T19:35:37Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2016058</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2016058" />
    <title>Comment from Adam Flater on 2008-03-21</title>
    <author>
        <name>Adam Flater</name>
        <uri>http://adamflater.net</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://adamflater.net">
        <![CDATA[<p>@kathryn</p>

<p>Thanks for reading... yeah we'll try and get the indenting style more consistent with best practices. When we post sample Flex apps view source will be enabled and that code should reflect all the best practices.</p>]]>
    </content>
    <published>2008-03-21T19:37:33Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2055549</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2055549" />
    <title>Comment from bob on 2009-03-19</title>
    <author>
        <name>bob</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>hi  there, listen im stuck with an issue here.... im doing a horizontal sliding menu using actionscript 3.0, and well  i wanted to know if i can use two conditions inside an  if e.g :</p>

<p><br />
function mover2(e:MouseEvent):void<br />
{<br />
	****** if(concepto_mc.y == 54.6, contacto_mc.y = 88.3)<br />
          {   <br />
          new Tween(contacto_mc,"y", Strong.easeInOut, 88.3, 267.2, 4, true);<br />
          }<br />
	if(concepto_mc.y == 54.6)<br />
          {   <br />
          new Tween(contacto_mc,"y", Strong.easeInOut, 88.3, 267.2, 4, true);<br />
		  new Tween(senza_mc,"y", Strong.easeInOut, 122, 300.8, 4, true);<br />
          }<br />
	if(concepto_mc.y == 233.6)<br />
	{<br />
	new Tween(concepto_mc,"y", Strong.easeInOut, 233.6, 54.6, 4, true);<br />
	}<br />
}</p>

<p>it does not seem to work, so i wanted to know if that can actually be used or im just wasting my time, or if there is another way to do this...</p>

<p>help will be great </p>]]>
    </content>
    <published>2009-03-19T18:34:02Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2055550</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2055550" />
    <title>Comment from bob on 2009-03-19</title>
    <author>
        <name>bob</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>hi  there, listen im stuck with an issue here.... im doing a horizontal sliding menu using actionscript 3.0, and well  i wanted to know if i can use two conditions inside an  if e.g :</p>

<p><br />
function mover2(e:MouseEvent):void<br />
{<br />
	****** if(concepto_mc.y == 54.6, contacto_mc.y = 88.3)<br />
          {   <br />
          new Tween(contacto_mc,"y", Strong.easeInOut, 88.3, 267.2, 4, true);<br />
          }<br />
	if(concepto_mc.y == 54.6)<br />
          {   <br />
          new Tween(contacto_mc,"y", Strong.easeInOut, 88.3, 267.2, 4, true);<br />
		  new Tween(senza_mc,"y", Strong.easeInOut, 122, 300.8, 4, true);<br />
          }<br />
	if(concepto_mc.y == 233.6)<br />
	{<br />
	new Tween(concepto_mc,"y", Strong.easeInOut, 233.6, 54.6, 4, true);<br />
	}<br />
}</p>

<p>it does not seem to work, so i wanted to know if that can actually be used or im just wasting my time, or if there is another way to do this...</p>

<p>help will be great </p>]]>
    </content>
    <published>2009-03-19T18:35:19Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2055551</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2055551" />
    <title>Comment from bob on 2009-03-19</title>
    <author>
        <name>bob</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>hi  there, listen im stuck with an issue here.... im doing a horizontal sliding menu using actionscript 3.0, and well  i wanted to know if i can use two conditions inside an  if e.g :</p>

<p><br />
function mover2(e:MouseEvent):void<br />
{<br />
	****** if(concepto_mc.y == 54.6, contacto_mc.y = 88.3)<br />
          {   <br />
          new Tween(contacto_mc,"y", Strong.easeInOut, 88.3, 267.2, 4, true);<br />
          }<br />
	if(concepto_mc.y == 54.6)<br />
          {   <br />
          new Tween(contacto_mc,"y", Strong.easeInOut, 88.3, 267.2, 4, true);<br />
		  new Tween(senza_mc,"y", Strong.easeInOut, 122, 300.8, 4, true);<br />
          }<br />
	if(concepto_mc.y == 233.6)<br />
	{<br />
	new Tween(concepto_mc,"y", Strong.easeInOut, 233.6, 54.6, 4, true);<br />
	}<br />
}</p>

<p>it does not seem to work, so i wanted to know if that can actually be used or im just wasting my time, or if there is another way to do this...</p>

<p>help will be great </p>]]>
    </content>
    <published>2009-03-19T18:36:40Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2066178</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2066178" />
    <title>Comment from T.Hutchinson on 2009-06-14</title>
    <author>
        <name>T.Hutchinson</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Question for any of you...<br />
Can you put conditionals in a SWITCH statement?</p>

<p>such as:</p>

<p><br />
			switch (nextQ) {<br />
				Case 0:<br />
				if(myTarget =="resp1"){<br />
					output = myQuestionList.text[1];<br />
					question_txt.text=output;<br />
					outputQ = myQuestionList.text[1];<br />
					visibleQ = myQuestionList.number[1].valueOf();<br />
break;<br />
}</p>]]>
    </content>
    <published>2009-06-14T18:02:28Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2066179</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2066179" />
    <title>Comment from T.Hutchinson on 2009-06-14</title>
    <author>
        <name>T.Hutchinson</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Question for any of you...<br />
Can you put conditionals in a SWITCH statement?</p>

<p>such as:</p>

<p><br />
			switch (nextQ) {<br />
				Case 0:<br />
				if(myTarget =="resp1"){<br />
					output = myQuestionList.text[1];<br />
					question_txt.text=output;<br />
					outputQ = myQuestionList.text[1];<br />
					visibleQ = myQuestionList.number[1].valueOf();<br />
break;<br />
}</p>]]>
    </content>
    <published>2009-06-14T18:04:15Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2066180</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2066180" />
    <title>Comment from T.Hutchinson on 2009-06-14</title>
    <author>
        <name>T.Hutchinson</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Question for any of you...<br />
Can you put conditionals in a SWITCH statement?</p>

<p>such as:</p>

<p><br />
			switch (nextQ) {<br />
				Case 0:<br />
				if(myTarget =="resp1"){<br />
					output = myQuestionList.text[1];<br />
					question_txt.text=output;<br />
					outputQ = myQuestionList.text[1];<br />
					visibleQ = myQuestionList.number[1].valueOf();<br />
break;<br />
}</p>]]>
    </content>
    <published>2009-06-14T18:04:59Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23180-comment:2066181</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23180" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/lffs5actionscript-conditionals.html#comment-2066181" />
    <title>Comment from T.Hutchinson on 2009-06-14</title>
    <author>
        <name>T.Hutchinson</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Question for any of you...<br />
Can you put conditionals in a SWITCH statement?</p>

<p>such as:</p>

<p><br />
			switch (nextQ) {<br />
				Case 0:<br />
				if(myTarget =="resp1"){<br />
					output = myQuestionList.text[1];<br />
					question_txt.text=output;<br />
					outputQ = myQuestionList.text[1];<br />
					visibleQ = myQuestionList.number[1].valueOf();<br />
break;<br />
}</p>]]>
    </content>
    <published>2009-06-14T18:06:12Z</published>
  </entry>

</feed
