1 Reply Latest reply on Apr 14, 2011 9:04 AM by Retox.

    Got action sequence to "loop" but it shows in all states - conditional statement to fix it?

    Retox.

      Using Flash Catalyst & Notepad (to open and alter the code in the "Main" MXML file) I'm able to "loop" an action sequence on the home state for my swf by changing the code as follows:

       

       

      ORIGINAL CODE

      <s:Parallel id="Sequence3">

       

      ALTERED CODE

      <s:Parallel id="Sequence3" effectEnd="Sequence3.play()">

       

      The desired effect is a sequence (of 4 images) that loops whenever a user is viewing the home state.  It is activated "On Application Start"

       

       

      The PROBLEM is that the loop continues in all other states (it appears in the background - behind the objects that are supposed to show up on the other pages and only begins to show up in each state when the sequence begins another loop).

       

       

      I am assuming I need a conditional statement --- something along the lines of:

       

      while (condition){ statements;}

       

      ...in other words, ONLY while currentstate = "Home" it should loop the sequence. What would be the correct code for this conditional statement and where would the conditional statement be inserted to loop the sequence as desired???  Or... is there another better way??

       

       

       

      My current code for this action sequence is:

       

      <s:Parallel id="Sequence3" effectEnd="Sequence3.play()">
                  <s:Parallel target="{designlayer1}">
                      <s:Fade alphaTo="0" duration="500" startDelay="2100"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage2}">
                      <s:Fade alphaTo="0" startDelay="2100"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage3}">
                      <s:Fade alphaTo="0" startDelay="2100"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage4}">
                      <s:Fade alphaTo="0" startDelay="2100"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage5}">
                      <s:Fade alphaTo="0" startDelay="1650"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage6}">
                      <s:Fade alphaTo="0" startDelay="1800"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage7}">
                      <s:Fade alphaTo="0" startDelay="1950"/>
                  </s:Parallel>
                  <s:Parallel target="{designlayer5}">
                      <s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
                      <s:Fade alphaTo="0" startDelay="5300"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage8}">
                      <s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
                      <s:Fade alphaTo="0" startDelay="5350"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage9}">
                      <s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
                      <s:Fade alphaTo="0" startDelay="5350"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage10}">
                      <s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
                      <s:Fade alphaTo="0" startDelay="5350"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage11}">
                      <s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
                      <s:Fade alphaTo="0" startDelay="4750"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage12}">
                      <s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
                      <s:Fade alphaTo="0" startDelay="5000"/>
                  </s:Parallel>
                  <s:Parallel target="{designlayer6}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
                      <s:Fade alphaTo="0" startDelay="7900"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage13}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
                      <s:Fade alphaTo="0" startDelay="7550"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage14}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
                      <s:Fade alphaTo="0" startDelay="7900"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage15}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
                      <s:Fade alphaTo="0" startDelay="7750"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage16}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
                      <s:Fade alphaTo="0" startDelay="7900"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage17}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
                      <s:Fade alphaTo="0" startDelay="7900"/>
                  </s:Parallel>
                  <s:Parallel target="{designlayer7}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
                      <s:Fade alphaFrom="1" alphaTo="0" startDelay="11000"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage18}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
                      <s:Fade alphaFrom="1" alphaTo="0" startDelay="11000"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage19}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
                      <s:Fade alphaFrom="1" alphaTo="0" startDelay="11000"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage20}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
                      <s:Fade alphaFrom="1" alphaTo="0" startDelay="11000"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage21}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
                      <s:Fade alphaFrom="1" alphaTo="0" startDelay="10650"/>
                  </s:Parallel>
                  <s:Parallel target="{bitmapimage22}">
                      <s:Fade alphaTo="0" duration="0"/>
                      <s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
                      <s:Fade alphaFrom="1" alphaTo="0" startDelay="10800"/>
                  </s:Parallel>
              </s:Parallel>

       

       

       

       

      Thank you!!!!!!!!

        • 1. Re: Got action sequence to "loop" but it shows in all states - conditional statement to fix it?
          Retox. Level 1

          Figured out my issue...

           

          I had to select each layer for the 4 photo sequence and "Remove From State" for each layer.  If this is done with all layers except the "Home" state, the images show only where appropriate.

           

          So...   "Loop an action sequence" is really easy.

           

          I've seen a lot of complaining that "FC can't do it" but with a very simple code mod, I was able to do it WITHOUT using the video timer method.

           

           

          I should also mention that I've never worked with Flash at all before this project and am only self-taught in HTML (basics).  I was able to make a pretty good looking Flash component for a web site and never would have attempted it without FC.  I have to say, while FC is a bit limited, GUI-based Flash is a great add for Adobe and will save me over $2k per year in web admin.

           

           

           

           

           

          To edit the document in Notepad as mentioned in the first post:

          the full text can be found here http://www.judahfrangipane.com/blog/2010/09/03/flash-catalyst-jailbreak-for-flex-developer s/

           

           

          Editing MXML Documents
          To edit your projects MXML documents we first need to find the path to  the Flash Catalyst workspace. To do this publish your Flash Catalyst  project (CMD / CTRL + ENTER). Now, the browsers URL shows the path to  the project workspace. So in this URL,  "file:///Users/judah/Library/Application Support/Adobe/Flash  Catalyst/workspace/Project/bin-debug/Main.html", the project MXML  documents are located at, "file:///Users/monkeypunch/Library/Application  Support/Adobe/Flash Catalyst/workspace/Project/" when on a Mac.

          Flash Catalyst project files

          Flash Catalyst project files

           

          Project Files Description

           

          /src - location of the application source files

           

          /bin - the location of any additional flex libraries

           

          /bin-debug - location of testing swf

           

          /html-template - location of the html template that wraps around your application

           

          /src/Main.mxml - the main application file. make your application changes here

           

          /src/Main.css - the css stylesheet of the main application

           

          /src/components - the location of custom components and component skins

           

          /src/assets/graphics - location of optimized FXG graphic symbols

           

          /src/assets/images - location of images

          You can edit these XML documents in any text editor. To apply the  changes you need to save the file and refresh the Flash Catalyst  project. You can do this by opening the changed document in Flash  Catalyst code view. When we do this it will recognize the document has  changed and prompt you to use the newer version of the file. Select Yes.  If the project does not rebuild immediately publish it using CMD +  Enter.