Jason, So will the code look like the following? var image:Image = new Image(); image.source = list.selectedItem.photoUrl; image.maintainAspectRatio = true; image.width = 700; image.height = 600; image.creationComplete = completeHandler(event); photopanel.addChild(image);
'cause I tried it and it didn't work. I know in the <mx:Image > tag I can specify complete="completeHandler(event)" but I'm trying to do it dynamically and not in the <mx:Image > tag. Thanks. Gabsaga -----Original Message----- From: Jason Vanhoy [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2008 01:37 PM To: [email protected] Subject: Re: [AFFUG Discuss] ProgressBar question Do what Justin said on CreationComplete of the image in question. Justin Haygood wrote: > > photopanel.removeChild(pgBar); ? > > > > Justin Haygood | Software Engineer | EyeWonder Atlanta > > Phone 678-891-2031 | Mobile 404-271-2273 > [EMAIL PROTECTED] | aim - ewjhaygood > > *EyeWonder > Interactive Digital Advertising. Advance. > *www.eyewonder.com > > > > > > *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of > *Gabsaga Tata > *Sent:* Friday, July 25, 2008 12:51 PM > *To:* [email protected] > *Subject:* Re: [AFFUG Discuss] ProgressBar question > > > > > > I tried that already and it didn't work. But I found an alternate way. > The only thing I'm trying to figure out why now is to remove the > progress bar from the panel when the image completely loads. Do you > know how I can do that? > > > > private var image:Image; > private var pgBar:ProgressBar; > > public function clickHandler(event:MouseEvent):void > { > if (image != null) > { > photopanel.removeChild(image); > } > > if (pgBar != null) > { > photopanel.removeChild(pgBar); > } > > pgBar = new ProgressBar(); > pgBar.mode = ProgressBarMode.POLLED; > pgBar.label = "Loaded %1 of %2 bytes, %3%%"; > pgBar.indeterminate = false; > > > image = new Image(); > image.source = list.selectedItem.photoUrl; > photopanel.addChild(image); > photopanel.addChild(pgBar); > pgBar.source = image; > } > > > private function completeHandler(event:Event):void > { > // remove the progress from the featured phototgraph panel > if (pgBar != null) > { > photopanel.removeChild(pgBar); > } > } > > > > Do you know how I can call the completeHandler function after the > image finishes loading? > > > > I know in mxml you can do like the following: > > > > complete="completeHandler(event)" /> > > But I'm trying to do it from the ActionScript which I haven't figured > out yet. > > > > Thanks. > > > > Gabsaga > > > > -----Original Message----- > *From:* Davy Strube [mailto:[EMAIL PROTECTED] > *Sent:* Thursday, July 24, 2008 10:43 PM > *To:* [EMAIL PROTECTED] > *Subject:* Re: [AFFUG Discuss] ProgressBar question > > Try this: > In the completeHandler, > photoLoadProgressBar.setProgress(0,1); > > I doubt this will work because the documentation says this method > is for mode=manual, but it's something to try. > http://livedocs.adobe.com/flex/2/langref/mx/controls/ProgressBar.html > > -Davy > > On Thu, Jul 24, 2008 at 5:31 PM, Gabsaga Tata > > wrote: > > I am new to flex and I have developed this very simple application > with the source could included below. > > > > The problem I'm having is how to reset the progress bar. When the > first image is loaded in the Featured Photograph panel, the > progress bar shows the % complete as the image is being loaded. > So far, so good. > > > > But when the subsequent images are loaded, the progress bar does > not change. It just shows the last state after the first image > completely loaded. > > > > Is there a way to make it such that the progress bar shows the > progress of subsequent images being loaded? > > > > Thanks for any help in advance!! > > > Gabsaga > > > > > > ******************** Source Code ******************** > > > > > > xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> > > > > > > Panel { > > backgroundAlpha: 1; > > borderAlpha: 1; > > headerColors: #c7c7c7, #ffffff; > > footerColors: #ffffff, #c7c7c7; > > paddingTop: 15; > > paddingRight: 25; > > paddingLeft: 25; > > paddingBottom: 15; > > shadowDirection: "right"; > > } > > .header { > > color: #ffffff; > > fontSize: 15; > > fontWeight: "bold"; > > } > > > > > > > > > > > import mx.rpc.events.ResultEvent; > > import mx.rpc.events.FaultEvent; > > import mx.utils.ObjectUtil; > > import mx.controls.Alert; > > import mx.utils.StringUtil; > > > > private function resultHandler(event:ResultEvent):void > > { > > //used for debugging - shows details about result > > //returned by the Java class method > > > > //Alert.show( ObjectUtil.toString(event.result) ); > > } > > > > private function faultHandler(event:FaultEvent):void > > { > > Alert.show( ObjectUtil.toString(event.fault) ); > > } > > > > private function updateHandler(event:Event):void > > { > > remoteObj.updatePhoto(updatedPhoto); > > remoteObj.getPhotos(); > > } > > > > public function clickHandler(event:MouseEvent):void > > { > > image1.source = list.selectedItem.photoUrl; > > photoLoadProgressBar.visible = true; > > progressHandler(event); > > } > > > > private function completeHandler(event:Event):void > > { > > // make progress bar invisible > > photoLoadProgressBar.visible = false; > > } > > > > public function progressHandler(event:Event):void > > { > > photoLoadProgressBar.indeterminate=false; > > } > > > > ]]> > > > > > > result="resultHandler(event)" fault="faultHandler(event)" /> > > > > > photoId="{list.selectedItem.photoId}" > > photoUrl="{list.selectedItem.photoUrl}" > > photoDescription="{txtPhotoDescription.text}" /> > > > > > > > > width="800" height="350"> > > > > dataProvider="{remoteObj.getPhotos.lastResult}" width="100%" > height="80%" click="clickHandler(event)" > > > > > width="100" /> > > > > width="400" /> > > > > > > > > > > > > > > text="{list.selectedItem.photoDescription}" width="100%" > height="20%"/> > > > > > > > > > > source="image1" mode="polled" visible="false" label="Loaded %3%%" > labelWidth="400" labelPlacement="top" /> > > > > > > > > > > > > > > > > > height="400"> > > > > maintainAspectRatio="true" complete="completeHandler(event)" /> > > > > > > > > > > > > > > > ------------------------------------------------------------- > To unsubscribe from this list, simply email the list with > unsubscribe in the subject line > > For more info, see http://www.affug.com > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > List hosted by FusionLink > ------------------------------------------------------------- > > > > > ------------------------------------------------------------- > To unsubscribe from this list, simply email the list with unsubscribe > in the subject line > > For more info, see http://www.affug.com > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > List hosted by FusionLink > ------------------------------------------------------------- > > > ------------------------------------------------------------- > To unsubscribe from this list, simply email the list with unsubscribe > in the subject line > > For more info, see http://www.affug.com > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > List hosted by FusionLink > ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
