The "Photo Viewer" Sample App has a ViewStack with 3 views: <ThumbnailView
...>, <CarouselView ...>, <SlideShowView ...>.
When I move <CarouselView ...> to the top of the stack, on execution it throws
an: Error #1009: Cannot access a property or method of a null object
reference.
Poking around with the debugger the problem is that the property gallery =
null.
It all works fine as originally written. That is when <CarouselView ...> is
not the first view in the stack. The default app PhotoViewer.mxml uses
databinding for passing in gallery="{gallery}" to each of the 3 views.
Can anyone help out suggesting why <CarouselView ...> only fails when it is
first view in the stack?
fyi ...
The "Photo Viewer" Sample App is easy to install via the Flex Builder 2 "Flex
Start Page"
(Install sequence: Main Menu -> Help -> Flex Start Page -> More installed
samples -> Photo Viewer -> Open Project)
Because ResourceBundle are used, you might encounter the (annoying) bug 174788
(as documented in TechNote at www.adobe.com/go/4a146409) which requires "In
Flex Builder, clean the project in order to remove the error."
I really would like to get "Photo Viewer" Sample App working with <CarouselView
...> as the default view. If anyone can help me figure out how to do that, I
would appreciate it.
In debugging this I have gotten as far as ...
When the Error #1009 occurs, FB2 opens Carousel.as pointing to the first
statement in method reset() which references: gallery.selected
Using a breakpoint, the debugger's Variables panel shows"gallery=null".
I then modified reset() to include "if ( gallery != null )" in 2 places.
1) around: var selected:int = gallery.selected;
2) around the entire loop: for (var i:int=0; i < 9; i++)
This clears the #1009 error, but the Variables window continues to show
"gallery=null". Only if I then navigate to either <ThumbnailView ...> or
<SlideShowView ...> before navigating back to <CarouselView ...> does the
databinding finally set the gallery property and <CarouselView ...> works.
Pete
____________________________________________________________________________________
Sponsored Link
$200,000 mortgage for $660/ mo -
30/15 yr fixed, reduce debt -
http://yahoo.ratemarketplace.com