This very simple sample app consist of three file. One is an ordinary
class, one is a class with static methods and the third is the main mxml
file, which uses the two utility classes.

Tracy

<?xml version="1.0" encoding="utf-8"?>
<!-- UtilityClassTest.msml -->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns="*">
      <mx:Script><![CDATA[
            import UtilityClassStatic
            public var sAppProperty:String = "BAZ";
      ]]></mx:Script>
      <UtilityClass id="u" app="{this}"/>
      <mx:Label text="{u.getFoo()}" />
      <mx:Label text="{UtilityClassStatic.getBar()}" />
</mx:Application>


// UtilityClas.as  Example utility function class for dynamic
instantiation
class UtilityClass
{
      public var app:UtilityClassTest;
      public function getFoo():String{
            return "FOO" + app.sAppProperty;
      }
}//UtilityClass


// UtilityClassStatic  Example utility function class for Static
reference
class UtilityClassStatic
{
      public static function getBar():String{
            return "BAR";
      }
}//UtilityClassStatic


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Sascha Balkau
Sent: Monday, April 24, 2006 12:36 AM
To: [email protected]
Subject: RE: [flexcoders] New to Flex, couple of questions

Hi Tracy,

An example would be great if you got any. Even if it's in 1.5 I think it
will be helpful to understand how AS and Flex works together.
Thanks,
Sascha



> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
On
> Behalf Of Tracy Spratt
> Sent: Saturday, 22. April, 2006 02:34
> To: [email protected]
> Subject: RE: [flexcoders] New to Flex, couple of questions
>
> I am not doing 2.0 yet, but in 1.5 you can put your AS code in a class
> file, and then either instantiate it in a tag, or make the class
methods
> static, import it and then use the static methods.
>
> I have a simple example in 1.5 if you want to see it.
>
> Tracy
>



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links










--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to