I'm trying to change:

 text="{photoFile}"

to

 text="{this.detailObject.Photo}"

in this TextInput:

<c:TextInput 
    visible="false" includeInLayout="false"
    id="Users_Photo"
    text="{photoFile}"
    x="390" y="70"
    width="240"
  />

after a user saves an uploaded photo.

The TextInput is part of a form where users upload a photo {photoFile}
dispatched via a <c:MyPhoto id="MePhoto"
dataShared="photoFileHandler(event)" /> photo upload component which is
later displayed by binding {this.detailObject.Photo} to <mx:Image
id="myPhoto" source="applicantPics/{Users_Photo.text}" />. 

If  //text="{photoFile}" remains after saving an uploaded photo, the photo
upload component reappears the next time I view the file. 

What I need is  //text="{photoFile}" to become 
//text="{this.detailObject.Photo}" after the user saves. 

Here's my code:

import flash.events.TextEvent;
                
                        
  [Bindable]
  private var photoFile:String="";

                        
  private function photoFileHandler(event:TextEvent):void 
  {
  photoFile=event.text;
  }

  private function newPhoto():void
 {
 myPhoto.visible = false;
 myPhoto.includeInLayout = false;
 MePhoto.visible = true;
 MePhoto.includeInLayout = true;
 }

<mx:Box x="390" y="70" borderStyle="solid" borderThickness="2"
borderColor="#333333">

<mx:Image id="myPhoto" source="applicantPics/{Users_Photo.text}" 
 includeInLayout="{(Users_Photo.text.length == 0) ? false : true}"      
 visible="{(Users_Photo.text.length == 0) ? false : true}"
 width="105" height="140"
 toolTip="{Users_FirstName.text} {Users_LastName.text}"
 doubleClickEnabled="true"
 doubleClick="newPhoto()"
 />

<c:MyPhoto id="MePhoto" x="390" y="70"
 dataShared="photoFileHandler(event)" 
 includeInLayout="{(Users_Photo.text.length == 0) ? true : false}"
 visible="{(Users_Photo.text.length == 0) ? true : false}"/>
</mx:Box>
                
<c:TextInput x="390" y="70"
 visible="false" includeInLayout="false"
 id="Users_Photo"
 text="{this.detailObject.Photo}"
 width="240"
/>
                
<c:PhotoName myPhoto="{photoFile}" visible="false" includeInLayout="false"/>

TIA

James
-- 
View this message in context: 
http://www.nabble.com/Dynamic-Binding-tp15059994p15059994.html
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to