2 Replies Latest reply on Oct 5, 2006 12:47 PM by TimSymons

    OOP, write a class

    rquantin
      Hi everybody,

      I'm trying to improve my way to write actionscript, so I wrote my first class... I know it is simple for some of you but not for me as it is new. Could you please tell me what is wrong in my code or what I could improve?

      Any advice ven simple as welcome, thanks in advance for your time.

      Romu

      the code to put in a flash:
      var strText:String = 'We specialise in the development of <a href="#">accessible websites</a>, including; content management systems, ecommerce solutions, <a href="#">intranet and extranet development</a>, hosting and digital multimedia as well as a range of printed media forms. We are experienced in integrated communications for companies of all sizes.';
      var test1:CustomTextField = new CustomTextField(ct, "txt1", 1, 20, 20, 400, 80);
      test1.ShowText(strText, 10, 20);
        • 1. Re: OOP, write a class
          rquantin Level 1
          no time for a bit of help? :) I'm sure your advices will be quite interesting for me.
          • 2. Re: OOP, write a class
            TimSymons Level 1
            You had some small issues but overall it was a good attempt. I have tweaked the code a little and put in comments for some explanations. However, I would recommend getting a book since there is a lot to OOP and any reference would be good.

            Also, I had to change the calling script as well:

            import CustomTextField; // Not need since the FLA and class are on the same level but it is good practice to use it anyway.
            var strText:String = '--I just cut this for readability, your string worked fine here.';
            var test1:CustomTextField = new CustomTextField(_root, "txt1", 1, 20, 20, 400, 80); // I just used _root as my movieclip
            test1.ShowText(strText, 10, 200);

            Hope this helps you out.

            Tim