PDA

Volledige versie bekijken : Mouse over op een tekstvlak


FlashElements
%Europe/Berlin %883 %2005, 22:12
Hoi Allemaal,

Ik probeer een mouse over te verkrijgen op een tekstvlak.
Is er iemand die hiermee ervaring heeft ?


MovieClip.prototype.setText = function (textItem:String, itemNo:Number,
x0:Number,y0:Number,
textWidth:Number,textHeight:Number) {
this.createTextField("my_txt" + itemNo, this.getNextHighestDepth(), x0, y0,textWidth,textHeight);
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Verdana";
my_fmt.size = 12;
my_fmt.color = 0x006699;

this["my_txt" + itemNo].border = true;
this["my_txt" + itemNo].backgroundColor = 0xCCFF77;
this["my_txt" + itemNo].background = true;
this["my_txt" + itemNo].selectable = false;
this["my_txt" + itemNo].text = textItem;
this["my_txt" + itemNo].setTextFormat(my_fmt);


this["my_txt" + itemNo].onRollOver = function() {
this["my_txt" + itemNo].backgroundColor = 0x88FF77; // werkt dus niet
};
}

Alvast bedankt :cool:

theFlashWizard
%Europe/Berlin %894 %2005, 22:28
volgens mij kan dit niet..
zet het txt in een mc en zet daar een RollOver aan.. dat werkt zeker wel..

Laiverd
%Europe/Berlin %908 %2005, 22:47
Ik zou zeggen this.onRollOver etc. Tenslotte maak je het textfield in een movieclip.

John

Gerrit55
%Europe/Berlin %933 %2005, 23:24
Een tekstField kent geen events als onRollOver en onRollOut

Je moet je onRollover dus op je movieclip (this) zetten, dus je prototype veranderen in


this.onRollOver = function() {
this["my_txt" + itemNo].backgroundColor = 0x88FF77;
};
this.onRollOut = function() {
this["my_txt"+ itemNo].backgroundColor = 0xCCFF77;
}

FlashElements
%Europe/Berlin %950 %2005, 23:48
Heel erg bedankt allemaal...........

Ik heb het even zolang op een andere mannier gedaan.
De bedoeling is uiteindelijk om alles in een class te plaatsen maar gezien de tijd heb ik het
even snel in een prototype gedaan.

MovieClip.prototype.drawBox = function(x0:Number, y0:Number, width:Number, height:Number, borderColor:Number, fillColor:Number) {
this.lineStyle(1, borderColor, 100);
this.beginFill(fillColor, 100);
this.moveTo(x0, y0);
this.lineTo((x0+width), y0);
this.lineTo((x0+width), (y0+height));
this.lineTo((x0), (y0+height));
this.lineTo(x0, y0);
this.endFill();
};
MovieClip.prototype.setText = function(textItem:String, itemNo:Number, x0:Number, y0:Number, textWidth:Number, textHeight:Number, borderColor:Number, fillColor:Number) {
txtHolder = this.createEmptyMovieClip("textHolder"+itemNo, this.getNextHighestDepth());
txtHolder.drawBox(x0, y0, textWidth, textHeight, borderColor, fillColor);
txtHolder.createTextField("my_txt", this.getNextHighestDepth(), x0, y0, textWidth, textHeight);
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Verdana";
my_fmt.size = 12;
my_fmt.color = 0x006699;

txtHolder.my_txt.selectable = false;
txtHolder.my_txt.text = textItem;
txtHolder.my_txt.setTextFormat(my_fmt);

txtHolder.onRollOver = function() {
my_fmt.color = 0xFFFFFF;
this.my_txt.setTextFormat(my_fmt);
this.drawBox(x0, y0, textWidth, textHeight, borderColor, borderColor);
};
txtHolder.onRollOut = function() {
my_fmt.color = 0x006699;
this.my_txt.setTextFormat(my_fmt);
this.drawBox(x0, y0, textWidth, textHeight, borderColor, fillColor);
};
};


this.setText(_level0.my_array[n][i][1], i, (n*50)+10, (i*18)-20, 100, 18, 0x006699, 0xFFFFFF);




Alles werkt nu prima, nogmaals erg bedankt !!! :)

Als mijn FlashDorpDown menuutje helemaal klaar is zal ik 'm op FlashFocus zetten.