This content has been marked as final. Show 3 replies
from looking at the surface, I don't see you instantiating scenarioName
so its null reference variable until you do scenarioName = new Text().
it will generate that error
"alice_data" <email@example.com> wrote in message
> This seem like a weird problem, but I have have a scenario here where I
> supposed to ask for the user's prompt to enter some information into a
> form and
> have that passed back to the main application. However, I keep on getting
> error saying:
> TypeError: Error #1009: Cannot access a property or method of a null
> I have set up the variable returnName.text in the appropriate "state" that
> would like to display, but the line that tells me I have the error is
> scenarioName.text = scenario_name.text, which is in the child application.
> Since I am not making any changes the actual text, why am I getting this
> Attached is the code of the titleWindow and I have also provided what
> before, but I could not pass that back to the main application.
You're already using data binding, so you probably don't need to explicitly
set the text there. I'm not exactly sure why you're getting that
error...I'd need to play with it.
The reason it's not passing back to Main is the thing that we've talked
about before...when you launch a somewhat independent process, you CANNOT
expect that you'll be able to retrieve the result of that process in the
very next line. That next line will execute before the user has time to
even blink, much less enter anything.
Think back to how you've handled this before, and generalize the old
solution to this somewhat new situation. As a reminder, look at Q15 here
i have to say (and I am not big fan of states in flex and very rarely using it (if ever :))
but I see that your returnedName is declared withing state definition, and as I recall object within state definiton are not created immediately, eitherway from what I see, by the time this line is run:
scenario.scenarioName=returnedName; // in your main
returnedName is definately null.
you can trace it and see,
otherwise you code works just fine if you take out
<mx:Text id="returnedName" text="" width="100%" x="10" y="521"/>
from states definition and
and put it within application.