How do i do this in Flex/Flash Builder on pageload?
This is my label:
<s:Label id="hallo" text="hallo"/>
And this is how i try to get the text value into a var:
public var halloText:String = hallo.text;
But when i run this i get an actionscript Error #1009: Cannot access a property or method of a null…
It sounds like you are trying to access the .text property before it has been instantiated.
Suppose you have an mxml file that looks like:
and an application class called LabelTester that looks something like this:
Then you will get the runtime error that you describe.
But then change the constructor to this:
and add:
and if you run it in the debugger you should see the correct value in the console window.