This is a wrong assumption. Only the first viewStack child will be
instantiated initially; unless you use the evil creationPolicy="all"
setting. If you run your program in debug mode, it should break on the
exact line that is causing the error; to help you pinpoint the problem.
Since your second viewStack contains the comboBox, you might be trying
to explicitly set the selectedIndex of a control that doesn't exist yet:
courseCat.selectedIndex = 0;
The comboBox will not be instantialted until you change the viewStack's
selectedIndex. You can get around this by using a bound variable for
the comboBox's selectedIndex.
<mx:ComboBox selectedIndex="{ myComboBoxSelectedIndex }"/>
In the script:
[Bindable]
private var myComboBoxSelectedIndex : int = -1;
// use public if necessary - can also set the default index to 0 here;
if desired.
in the resultHandler:
//courseCat.selectedIndex = 0;
myComboBoxSelectedIndex = 0;
-TH
--- In [email protected], "hoytlee2000" <[EMAIL PROTECTED]>
wrote:
>
> I checked and the combobox with id courseCat is there, does it make a
> difference that it is on the second canvas of a viewstack container?
>
> I can see it throwing an error if it's not drawn till needed, but I
> thought that viewstack container just control visibility and that all
> it's children are actually created just not visible.
>
> Is this assumption wrong?
>
> thanks,
> Hoyt
>
>
> --- In [email protected], "Josh McDonald" dznuts@ wrote:
> >
> > This would imply that courseCat is null, or perhaps if the exception
is
> > actually being thrown inside the SDK code, it could have a null
> > dataProvider? I'm not sure about that second possibility though.
> >
> > -J
> >
> > On Thu, May 8, 2008 at 3:36 PM, hoytlee2000 hoytlee2000@ wrote:
> >
> > > private function configHandler(evt:ResultEvent):void {
> > > catList = evt.result.config.categories.cat;
> > > catList.addItemAt('None', 0);
> > > courseCat.selectedIndex = 0;
> > > }
> > >
> > > this is line 299: courseCat.selectedIndex = 0;
> > >
> > > thanks,
> > > hoyt
> > >
> > >
> > > --- In [email protected] <flexcoders%40yahoogroups.com>,
> "Alex
> > > Harui" <aharui@> wrote:
> > > >
> > > > What is the code at courseInfo.mxml at line 299?
> > > >
> > > >
> > > >
> > > > ________________________________
> > > >
> > > > From: [email protected] <flexcoders%40yahoogroups.com>
> [mailto:
> > > [email protected] <flexcoders%40yahoogroups.com>] On
> > > > Behalf Of hoytlee2000
> > > > Sent: Wednesday, May 07, 2008 10:11 PM
> > > > To: [email protected] <flexcoders%40yahoogroups.com>
> > > > Subject: [flexcoders] need help deciphering error message
> > > >
> > > >
> > > >
> > > > Hello,
> > > >
> > > > I get the error message below when I am running my application,
> > > > however it runs fine when I click continue. There isn't an error
> when
> > > > I compile in Flex builder. I checked the function that
> references the
> > > > object and they are all defined and the objects exist.
> > > >
> > > > The only thing I can think of is that the object that is
> referenced in
> > > > the function isn't displayed on the application startup (its on
the
> > > > second canvas of a view stack) so it throws this error, however
> when I
> > > > move the call to the function to execute only when the second
canvas
> > > > is displayed I still get the error.
> > > >
> > > > I'm sure its a common error that many newbies must hit. I
appreciate
> > > > any clues to look for in the code.
> > > >
> > > > Thanks,
> > > > Hoyt
> > > >
> > > > TypeError: Error #1009: Cannot access a property or method of a
null
> > > > object reference.
> > > >
> > > > at
> > > >
>
courseInfo/configHandler()[/Users/hoytng/Sites/pdiCMS/CourseMgmtSystem/c
> > > > ourseInfo/src/courseInfo.mxml:299]
> > > > at
> > > >
>
courseInfo/__courseCatHTTP_result()[/Users/hoytng/Sites/pdiCMS/CourseMgm
> > > > tSystem/courseInfo/src/courseInfo.mxml:429]
> > > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > "Therefore, send not to know For whom the bell tolls. It tolls for
> thee."
> >
> > :: Josh 'G-Funk' McDonald
> > :: 0437 221 380 :: josh@
> >
>