开发者

Changing text styles in Actionscript 3 GoToSlide widget

开发者 https://www.devze.com 2023-04-05 12:19 出处:网络
I\'m converting an old Captivate 4, Actionscript 2 GoToSlide widget to Captivate 5 and Actionscript 3.

I'm converting an old Captivate 4, Actionscript 2 GoToSlide widget to Captivate 5 and Actionscript 3.

The FLA file of the old widget when opened in Flash has Actionscript 2 code including the following extract sitting at top level of the file timeline. The third last line of the following evidently controls the colour of the text on rollover:

  mc.onRollOver = function() {
    this._parent._visible = true;
    ...
    txt_fmt.color = 0xffff00;
    this.item_txt.setTextFormat(txt_fmt);
}

I can't find any comparable point in the equivalent Actionscript 3 GoToSlide Flash file to define the text color for the rollover. C开发者_开发百科an anyone help me locate it, and help with the equivalent AS3 syntax for txt_fmt.color = 0xffff00; ?

Thank you..


So after a few weeks ...

Within the Actionscript in the FLA file for the GoToSlide widget - which seems to be a variant on the combobox and listbox components - For the loop that populates the combobox dropdown, I put this:

for (var i=0; i<cbItemArray.length; i++)
{
    var obj:Object = new Object();
    obj.label = cbItemArray[i];
    CB.addItem(obj);
    var myFormatButton:TextFormat = new TextFormat();
    myFormatButton.size = 9;
    myFormatButton.color = 0xffffff;
    myFormatButton.font = "Helvetica";
    var myFormatDropdown:TextFormat = new TextFormat();
    myFormatDropdown.size = 15;
    myFormatDropdown.color = 0xffffff;
    myFormatDropdown.font = "Helvetica";
    CB.textField.setStyle("embedFonts", true);
    CB.textField.setStyle("textFormat", myFormatButton);
    CB.dropdown.setRendererStyle("embedFonts", true);
    CB.dropdown.setRendererStyle("textFormat", myFormatDropdown);
    CB.dropdownWidth = 337;
    CB.rowCount="20";
    CB.dropdown.rowHeight=30;
    CB.prompt = "OVERVIEW"; //default value that won't show in the dropdown

                    }

This doesn't actually answer my original question -- in that it doesn't change the text colour .. (For me that was still in the too-hard basket for the moment: I think you have to define a custom combobox or listbox component to do that) .. But it does control other combobox parameters - dropdown width, rowHeight, font, etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号