unsorted
unsorted

Reputation: 3274

flex event triggered on component re-render?

What's the call analogous to creationComplete that happens every time a component is rendered? I want to rerun a function every time the component gets rendered (it has to make an HTTP request, but the url it calls changes each time) and I can't figure out how to do it.

For context:

<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" 
     xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%"
     creationComplete="loadGallery()">

private function loadGallery():void {
            var src:String = "http://localhost:3000/car_type/" + UserPreference.getInstance().carType.toString() + ".xml";
            Alert.show(src);
            httpService.url = src;
            httpService.send();
        }

Upvotes: 1

Views: 1554

Answers (3)

Wade Mueller
Wade Mueller

Reputation: 6059

I would override the updateDisplayList method for the component and add a call to your loadGallery method there.

Hope that helps.

Upvotes: 1

JeffryHouser
JeffryHouser

Reputation: 39408

Instead of creationComplete use updateComplete.

Upvotes: 5

Related Questions