3 Replies Latest reply on Apr 14, 2009 2:37 PM by Michael Borbor

    Noob Question

      on image (id profilepic towards bottom) I am trying to get it to fade in rather than just snap in. Can anyone help me with this code?

       

      Thanks,

       

      flexNoOb

       

       

       

      ---

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init()" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#212121, #010101]" viewSourceURL="srcview/index.html">
         
          <!--
          Bill Gates Press - http://www.microsoft.com/presspass/exec/billg/default.aspx?tab=images
          Barack Obama Portrait - http://change.gov/newsroom/entry/new_official_portrait_released/
          -->
          <mx:Style>
             
              Label{
                  color:#FFF;   
              }
             
              HBox{
                  backgroundColor:#010101;
                  paddingTop:20;
                  paddingLeft:20;
                  paddingRight:20;
                  paddingBottom:20;   
              }
             
          </mx:Style>

       

          <mx:Fade id="fadeOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/>
          <mx:Fade id="fadeIn" duration="1000" alphaFrom="0.0" alphaTo="1.0"/>

       

          <mx:Script>
         
              <![CDATA[
                  import mx.rpc.events.ResultEvent;
                 
                  //Holds complete XML raw file content
                  [Bindable] private var userList:XMLList;
                 
                  //Changes to Selected Contact's XML Data
                  [Bindable] private var selectedData:XML;

       

                  //Creation Complete Events
                  private function init():void{
                      userData.send();
                      profileName.text = "No Contact Selected";
                  }
                 
                  private function contentHandler(evt:ResultEvent):void{
                      userList = evt.result.user;
                  }
                 
                  private function showProfile(evt:Event):void{
                      //Assign data to currently selected item
                      selectedData = contactList.selectedItem as XML;
                  }
              ]]>
             
          </mx:Script>
         
          <!--Load in the XML file-->
          <mx:HTTPService url="assets/user-data.xml" id="userData" result="contentHandler(event)" resultFormat="e4x"/>

       

          <!--Data Grid Contact List-->
          <mx:HBox>
         
                  <mx:VBox height="490">
                      <mx:DataGrid id="contactList" width="400" change="showProfile(event)" dataProvider="{userList}">
                          <mx:columns>
                              <mx:DataGridColumn dataField="name" headerText="Contact Name"/>
                              <!--<mx:DataGridColumn dataField="position" headerText="Position"/>-->
                          </mx:columns>
                      </mx:DataGrid>
                     
                      <mx:Label fontSize="24" id="profileName" text="{selectedData.name}"/>
                      <mx:Label id="profileJob" text="Position: {selectedData.position}"/>
                      <mx:Label id="profileEmail" text="Email: {selectedData.email}"/>
                  </mx:VBox>
                 
                  <mx:VBox width="360">
                      <!--Result Containers-->
                      <mx:Image id="profilepic" source="{selectedData.image}"
                          hideEffect="{fadeOut}" showEffect="{fadeIn}"/>
                  </mx:VBox>

                 
             
          </mx:HBox>
         
      </mx:Application>