flash.sampler.getSamples() is returning undefined when called in flex application.

I tried it by deploying this application to a local tomcat and called the flash.sampler.getSamples() which returned undefined.

The same code works fine when run in a standalone mode. Can someone please help me why it is not working when deployed in a server.