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