How about the other way around, how can I access a variable in my main mxml from my class package?
Thanks! ________________________________ From: Tim Hoff <[email protected]> To: [email protected] Sent: Monday, April 6, 2009 1:50:24 PM Subject: [flexcoders] Re: How can I call a function from a class? There's a couple of ways. If your class and function are static, like a utility class that doesn't persist any data, just call Layout.traceTest( ); Note: Classes should be capitalized, in order to differentiate them from variables. Another way is to instantiate the class as a variable: private function callClassFunction( ):void { var layout:Layout = new Layout(); layout.traceTest( ); } -TH --- In flexcod...@yahoogro ups.com, "sailorsea21" <sailorsea21@ ...> wrote: > > Hi everyone, How can I call a function from a class? > > ////// MAIN FILE > import test.layout; > > private function callClassFunction( ):void > { > test.layout_ QT.traceTest( ); > } > > > > ////// CLASS FILE layout.as > package test > { > public class layout > { > public function traceTest(): void > { > trace("This is a test."); > } > } > } > > Thanks. >

