0

What is the most appropriate place to call an HttpService to load data to display in a view? I was reading creationComplete is not the best callback for this, but can't find any better answers. My app has a number of tabbed dialogs and other views, I'd like the HttpService to be called once when the view is first rendering on the screen.

Thank you, Sean

ketan
  • 19,129
  • 42
  • 60
  • 98
SeanLabs
  • 1,739
  • 4
  • 18
  • 22
  • Better to load data in the previous `View` and display a `BusyIndicator` and once the web stuff arrives - pass it as `data` to `navigator.pushView()` – Alexander Farber Jun 15 '12 at 13:16

2 Answers2

0

Well, it is a completely acceptable solution, because it is the easiest way to get notified when a view is rendered the first time. So, you kind of depend on it.

You could also just load the data and pass it to the view, before it is rendered.

Florian Salihovic
  • 3,921
  • 2
  • 19
  • 26
  • Thanks for the response. My application has a number of tabbed dialogs arranged into a viewstack controller by a LinkBar. When loading my data via HTTP I put up a spinner dialog. What I am seeing is multiple spinner dialogs being created when the app. is initialized. I'd prefer to load the data for each component the first time it's bought into view, but can't find the right event for that. – SeanLabs Jun 09 '12 at 16:59
  • You won't be lucky for the search of that event. If the view is implementing IDataRenderer, use FlexEvent.DATA_CHANGE. This will be dispatched, in case view#data is changed and it should be followed by FlexEvent.UPDATE_COMPLETE. But FlexEvent.UPDATE_COMPLETE will be dispatched every time a property changes which changes the views appearance. – Florian Salihovic Jun 09 '12 at 17:20
0

I am not sure but this might help: try contentCreationComplete event.

Botz3000
  • 39,020
  • 8
  • 103
  • 127
Nikhil Mahajan
  • 54
  • 1
  • 2
  • 12