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
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
var test1:CustomTextField = new CustomTextField(ct, "txt1",
1, 20, 20, 400, 80);
test1.ShowText(strText, 10, 20);
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);