0 Replies Latest reply on Jun 8, 2010 8:44 AM by patrickm

    unload graphics for a particular state

    patrickm Level 1

      hello all,

       

      I want to use Flash Catalyst and Flash Builder to create a full flash site.

      My site will contain about 8 states.

      For some states, I want to be able to unload all others graphics to maximize my free memory.

      In this small example, I create (in Flash Catalyst) 2 screens, with a big picture in each screen (vert. png and rouge.png).

      The bouton on Page1 launch Page 2, …

      What is the best workflow and the simplest code, to modify this example, for unloading 'bitmapimage2' when I am at Page1.

       

      Thanks a lot and excuse my poor english

       

       

       

      ?xml version='1.0' encoding='UTF-8'?>
      <s:Application xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" backgroundColor="#FFFFFF" height="480" preloaderChromeColor="#FFFFFF" width="640">
              <fx:Script>
                      <![CDATA[
                              protected function button_clickHandler():void
                              {
                                      currentState='Page2';
                              }
      
                              protected function button_clickHandler_1():void
                              {
                                      currentState='Page1';
                              }
      
                      ]]>
      
              </fx:Script>
              <s:states>
                      <s:State name="Page1"/>
                      <s:State name="Page2"/>
              </s:states>
              <s:BitmapImage id="bitmapimage2" smooth="true" source="@Embed('/assets/images/test/rouge.png')" d:userLabel="rouge" visible.Page1="false" x="0" y="0"/>
              <s:BitmapImage id="bitmapimage1" smooth="true" source="@Embed('/assets/images/test/vert.png')" d:userLabel="vert" visible.Page2="false" x="0" y="0"/>
              <s:Button id="button1" includeIn="Page2" label="vert" skinClass="components.Button1" x="39" y="23" click="button_clickHandler_1()"/>
              <s:Button id="button0" includeIn="Page1" label="rouge" skinClass="components.Button1" x="39" y="23" click="button_clickHandler()"/>
              
      </s:Application>