There are many, try googling Object Oriented Tutorials

Here is a quick overview from the Flex 2 docs:
http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001837.html

--Mike

--- In [email protected], "amigo_fd" <[EMAIL PROTECTED]> wrote:
>
> Thanks a lot, Mike
> 
> used "public static function String2Date"
> and "CommonFunctions.String2Date(...)"
> 
> I'm a search-trialanderror-and-search-again type of programmer. Just
> learning as I need something :-)
> 
> Any suggestions on good OO-related basic learning sites ?
> 
> --- In [email protected], "Michael Labriola" <labriola@>
> wrote:
> >
> > 
> > Frank,
> > 
> > I think you might be approaching this from the wrong perspective. In
> > particular, if you don't have object oriented programming experience,
> > you may want to take a few minutes and read some of the many tutorials
> > available online.
> > 
> > As Flex is a pretty OO heavy environment, without this knowledge, I
> > think you are going to get stuck on a lot of issues.
> > 
> > That said, you have two choices in the code you wrote below:
> > 
> > You could make your method static:
> > 
> > public function String2Date becomes->
> > public static function String2Date
> > 
> > Then you could access it as:
> > dfShipping.selectedDate =
> > CommonFunctions.String2Date(x.result[0].shipdatum[0].toString());
> > 
> > Or you need to create an instance of this class first.
> > 
> > var cf:CommonFunctions = new CommonFunctions();
> > dfShipping.selectedDate =
> > cf.String2Date(x.result[0].shipdatum[0].toString());
> > 
> > I do encourage you to spend a little time reading about Object
> > Oriented programming, either from an Adobe resource or just an online
> > tutorial. It will help you immensly.
> > 
> > --Mike
> > 
> > --- In [email protected], "amigo_fd" <frank@> wrote:
> > >
> > > Hello,
> > > 
> > > I want to make a class with a function I want to reuse in my
> > > application. This is new for me, so I need some help ...
> > > 
> > > I've created a file "CommonFunctions.as" in the root of my
application
> > > with this code:
> > > 
> > > package {
> > >   public class CommonFunctions {
> > >           public function String2Date(doString:String):Date {
> > >                   var doYear:int = Number(doString.substr(0,4));
> > >                   var doMonth:int = Number(doString.substr(5,2));
> > >                   var doDay:int = Number(doString.substr(8,2));
> > >                   var doHour:int = Number(doString.substr(11,2));
> > >                   var doMin:int = Number(doString.substr(14,2));
> > >                   var doSec:int = Number(doString.substr(17,2));  
> > >                   
> > >                   var myDate:Date = new Date(doYear, doMonth, doDay, 
> > > doHour, doMin,
> > > doSec);
> > >                   // showErrorDialog(doString + "+" + doYear + "+" + 
> > > doMonth +
"+" +
> > > doDay + "+" + doHour + "+" + doMin + "+" + doSec);
> > >                   
> > >                   return myDate;
> > >           }
> > >   }
> > > }
> > > 
> > > Now, how do I use in it on an other mxml-file in that application ?
> > > This does not work:
> > > 
> > > dfShipping.selectedDate =
> > > String2Date(x.result[0].shipdatum[0].toString());
> > > 
> > > Thanks a lot,
> > > Frank
> > >
> >
>





--
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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to