Declare a class instance, or make the function static.

It's customary to name classes with a capital letter at the start, instances 
with a lower case.

private function callClassFunction():void
{
var test:Layout = new Layout();
 test.traceTest();
}

Paul


----- Original Message ----- 
From: "sailorsea21" <[email protected]>
To: <[email protected]>
Sent: Monday, April 06, 2009 6:36 PM
Subject: [flexcoders] How can I call a function from a class?


> 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.
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location: 
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives: 
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
> Links
>
>
>

Reply via email to