# Classes in mx 2004 (new to classes)

**URL:** <https://forum.kirupa.com/t/classes-in-mx-2004-new-to-classes/33478>\
**Category:** flash\
**Created:** [October 20, 2003, 2:12am UTC](https://forum.kirupa.com/t/classes-in-mx-2004-new-to-classes/33478 "2003-10-20T02:12:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cristian](https://avatars.discourse-cdn.com/v4/letter/c/a698b9/32.png) [@cristian](https://forum.kirupa.com/u/cristian)\
**Post date:** [October 20, 2003, 2:12am UTC](https://forum.kirupa.com/t/classes-in-mx-2004-new-to-classes/33478/1 "2003-10-20T02:12:46Z")

</div>

hi everyone, Im Nubis, from Argentina.  
I´m new to woking whit classes, Im using flash mx 2004 pro.

Ive created a class, that works correctly, it creates a square, a textbox, and uses a variable to pupulate the textbox.  
(im sorry for my english)

in my library i have a MC (an empty MC) that is linked to that class.

I use this script to place the clip on the stage  
attachMovie(“card”, “card”, 1)  
iknow the class works fine, but, I dont know where to pass the parameters to the class.

And if I use : Card = new MyCard("this Card´s Name or label ")  
both the clip and the textbox are not created.

could anybody please help me?

thanks in advance 🙂  
(feel free to make comments about my code)

this is my class code:  
// MyCard  
class MyCard extends MovieClip {  
var thisCardName:String;  
//method for creating the square  
function gen\_sqr (){  
this.createEmptyMovieClip(“Square”,2);  
with(this[“Square”]){  
beginFill (0x0099FF, 100);  
lineStyle (1, 0x003399, 100);  
moveTo (0, 0);  
lineTo (100, 0);  
lineTo (100, 70);  
lineTo (0, 70);  
lineTo (0, 0);  
endFill();  
}  
}  
//method for generating the textfield  
function gen\_txt(my\_text){  
this.createTextField(“mytext”,3,0,0,50,20);  
with(this[“mytext”]){  
text = my\_text;  
multiline = true;  
html = true;  
}  
}  
//constructor  
function MyCard (thisName:String){  
//set the name or label for the card  
thisCardName = thisName;  
//  
gen\_sqr()  
gen\_txt(thisName)  
//  
trace(“newclass Created”)  
trace(thisCardName)  
}  
}
