The problem is due to a misunderstanding of the order in which these lines execute.

At the time your trace() at the bottom executes, the onLoad() function has not yet executed, so _global.xValue has not been assigned from the XML yet.

The onLoad() function will execute later, and when it does, then _global.xValue will be defined.