i strongly recommend the following books if u want to get serious about OOP

1) Essential Actionscript 2.0 - http://www.amazon.com/Essential-ActionScript-2-0-Colin-Moock/dp/0596006527/sr=1-4/qid=1161183848/ref=sr_1_4/102-9410879-8010537?ie=UTF8&s=books
 
2) Head first design patterns - this book is written for Java but the same OO concepts can be used in flash (must buy) - http://www.amazon.com/Head-First-Design-Patterns/dp/0596007124/sr=8-1/qid=1161181139/ref=pd_bbs_sr_1/102-9410879-8010537?ie=UTF8
 
 
P

 
On 10/18/06, 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" <[EMAIL PROTECTED]>


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





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to