#javascript #actionscript-3 #flash #adobe #font-embedding
#JavaScript #ActionScript-3 #flash #adobe #Встраивание шрифтов
Вопрос:
Итак, я написал немного кода в Actionscript 3.0, который отображает строку при наведении курсора мыши на слово на экране. Однако проблема заключается в том, что при отображении на других устройствах, таких как рабочий стол Windows, шрифт возвращается к значению по умолчанию. Я проверил Adobe Animate, и все мои шрифты правильно встроены в настройки, поэтому я предполагаю, что в моем коде чего-то не хватает, который я перечислил здесь:
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.Font
import com.adobe.tvsdk.mediacore.TextFormat;
stop();
Previous3.addEventListener(MouseEvent.CLICK, Frame4_prev);
function Frame4_prev(event:MouseEvent):void
{
gotoAndStop(3);
}
Next3.addEventListener(MouseEvent.CLICK, Frame4_next);
function Frame4_next(event:MouseEvent):void
{
gotoAndStop(5);
}
/* ---------- HOVER CHART WITH INFO ---------- */
/* MUCH_info (1) */
MUCH_info.addEventListener(MouseEvent.MOUSE_OVER, over1);
MUCH_info.addEventListener(MouseEvent.MOUSE_OUT, out1);
var fl_TF1:TextField;
var textformat1:TextFormat = new TextFormat;
var i1:int = 20;
var fl_TextToDisplay1:String =
"My Utility Cabinet Holdings, LLC";
function over1(event:MouseEvent):void
{
MUCH_info.visible = true;
fl_TF1 = new TextField();
fl_TF1.autoSize = TextFieldAutoSize.LEFT;
fl_TF1.background = false;
fl_TF1.border = false;
fl_TF1.x = 125;
fl_TF1.y = 643;
fl_TF1.text = fl_TextToDisplay1;
addChild(fl_TF1);
textformat1.size = i1;
textformat1.font = "Europa-Regular";
fl_TF1.setTextFormat(textformat1);
}
function out1(event:MouseEvent):void
{
fl_TF1.visible = false;
}
/* RealMTRX_info (2) */
RealMTRX_info.addEventListener(MouseEvent.MOUSE_OVER, over2);
RealMTRX_info.addEventListener(MouseEvent.MOUSE_OUT, out2);
var fl_TF2:TextField;
var textformat2:TextFormat = new TextFormat;
var i2:int = 21;
var fl_TextToDisplay2:String =
"Specializes in tenant billing, sub-metering, and green initiatives";
function over2(event:MouseEvent):void
{
RealMTRX_info.visible = true;
fl_TF2 = new TextField();
fl_TF2.autoSize = TextFieldAutoSize.LEFT;
fl_TF2.background = false;
fl_TF2.border = false;
fl_TF2.x = 125;
fl_TF2.y = 643;
fl_TF2.text = fl_TextToDisplay2;
addChild(fl_TF2);
textformat2.size = i2;
textformat2.font = "Europa-Regular";
fl_TF2.setTextFormat(textformat2);
}
function out2(event:MouseEvent):void
{
fl_TF2.visible = false;
}
/* MUCSaaS_info (3) */
MUCSaaS_info.addEventListener(MouseEvent.MOUSE_OVER, over3);
MUCSaaS_info.addEventListener(MouseEvent.MOUSE_OUT, out3);
var fl_TF3:TextField;
var textformat3:TextFormat = new TextFormat;
var i3:int = 18;
var fl_TextToDisplay3:String =
"An invoice management system able to track, centralize, and analyze billing data";
function over3(event:MouseEvent):void
{
MUCSaaS_info.visible = true;
fl_TF3 = new TextField();
fl_TF3.autoSize = TextFieldAutoSize.LEFT;
fl_TF3.background = false;
fl_TF3.border = false;
fl_TF3.x = 90;
fl_TF3.y = 643;
fl_TF3.text = fl_TextToDisplay3;
addChild(fl_TF3);
textformat3.size = i3;
textformat3.font = "Europa-Regular";
fl_TF3.setTextFormat(textformat3);
}
function out3(event:MouseEvent):void
{
fl_TF3.visible = false;
}
/* MagnaData_info (4) */
MagnaData_info.addEventListener(MouseEvent.MOUSE_OVER, over4);
MagnaData_info.addEventListener(MouseEvent.MOUSE_OUT, out4);
var fl_TF4:TextField;
var textformat4:TextFormat = new TextFormat;
var i4:int = 20;
var fl_TextToDisplay4:String =
"Develops internal system design and updates, robotics, and data mining";
function over4(event:MouseEvent):void
{
MagnaData_info.visible = true;
fl_TF4 = new TextField();
fl_TF4.autoSize = TextFieldAutoSize.LEFT;
fl_TF4.background = false;
fl_TF4.border = false;
fl_TF4.x = 90;
fl_TF4.y = 643;
fl_TF4.text = fl_TextToDisplay4;
addChild(fl_TF4);
textformat4.size = i4;
textformat4.font = "EuropaRegular";
fl_TF4.setTextFormat(textformat4);
}
function out4(event:MouseEvent):void
{
fl_TF4.visible = false;
}
/* GeoMAH_info (5) */
GeoMAH_info.addEventListener(MouseEvent.MOUSE_OVER, over5);
GeoMAH_info.addEventListener(MouseEvent.MOUSE_OUT, out5);
var fl_TF5:TextField;
var textformat5:TextFormat = new TextFormat;
var i5:int = 18;
var fl_TextToDisplay5:String =
"Specializes in data trends and anomalies, cost efficiency, and client consultation";
function over5(event:MouseEvent):void
{
GeoMAH_info.visible = true;
fl_TF5 = new TextField();
fl_TF5.autoSize = TextFieldAutoSize.LEFT;
fl_TF5.background = false;
fl_TF5.border = false;
fl_TF5.x = 90;
fl_TF5.y = 643;
fl_TF5.text = fl_TextToDisplay5;
addChild(fl_TF5);
textformat5.size = i5;
textformat5.font = "EuropaRegular";
fl_TF5.setTextFormat(textformat5);
}
function out5(event:MouseEvent):void
{
fl_TF5.visible = false;
}
/* SST_info (6) */
SST_info.addEventListener(MouseEvent.MOUSE_OVER, over6);
SST_info.addEventListener(MouseEvent.MOUSE_OUT, out6);
var fl_TF6:TextField;
var textformat6:TextFormat = new TextFormat;
var i6:int = 20;
var fl_TextToDisplay6:String =
"Outside services that help maintain the MUC website";
function over6(event:MouseEvent):void
{
SST_info.visible = true;
fl_TF6 = new TextField();
fl_TF6.autoSize = TextFieldAutoSize.LEFT;
fl_TF6.background = false;
fl_TF6.border = false;
fl_TF6.x = 100;
fl_TF6.y = 643;
fl_TF6.text = fl_TextToDisplay6;
addChild(fl_TF6);
textformat6.size = i6;
textformat6.font = "Europa-Regular";
fl_TF6.setTextFormat(textformat6);
}
function out6(event:MouseEvent):void
{
fl_TF6.visible = false;
}
/* Tamara_info (7) */
Tamara_info.addEventListener(MouseEvent.MOUSE_OVER, over7);
Tamara_info.addEventListener(MouseEvent.MOUSE_OUT, out7);
var fl_TF7:TextField;
var textformat7:TextFormat = new TextFormat;
var i7:int = 20;
var fl_TextToDisplay7:String =
"Tamara Naser, President";
function over7(event:MouseEvent):void
{
Tamara_info.visible = true;
fl_TF7 = new TextField();
fl_TF7.autoSize = TextFieldAutoSize.LEFT;
fl_TF7.background = false;
fl_TF7.border = false;
fl_TF7.x = 125;
fl_TF7.y = 643;
fl_TF7.text = fl_TextToDisplay7;
addChild(fl_TF7);
textformat7.size = i7;
textformat7.font = "Europa-Regular";
fl_TF7.setTextFormat(textformat7);
}
function out7(event:MouseEvent):void
{
fl_TF7.visible = false;
}
/* DataEntry_info (8) */
DataEntry_info.addEventListener(MouseEvent.MOUSE_OVER, over8);
DataEntry_info.addEventListener(MouseEvent.MOUSE_OUT, out8);
var fl_TF8:TextField;
var textformat8:TextFormat = new TextFormat ();
var i8:int = 20;
var fl_TextToDisplay8:String =
"Acquires, manages, and enters client invoice data";
function over8(event:MouseEvent):void
{
DataEntry_info.visible = true;
fl_TF8 = new TextField();
fl_TF8.autoSize = TextFieldAutoSize.LEFT;
fl_TF8.background = false;
fl_TF8.border = false;
fl_TF8.x = 100;
fl_TF8.y = 643;
fl_TF8.text = fl_TextToDisplay8;
addChild(fl_TF8);
textformat8.size = i8;
textformat8.font = "Europa-Regular";
fl_TF8.setTextFormat(textformat8);
}
function out8(event:MouseEvent):void
{
fl_TF8.visible = false;
}
/* Control_info (9) */
Control_info.addEventListener(MouseEvent.MOUSE_OVER, over9);
Control_info.addEventListener(MouseEvent.MOUSE_OUT, out9);
var fl_TF9:TextField;
var textformat9:TextFormat = new TextFormat;
var i9:int = 20;
var fl_TextToDisplay9:String =
"Ensures the integrity and quality of data";
function over9(event:MouseEvent):void
{
Control_info.visible = true;
fl_TF9 = new TextField();
fl_TF9.autoSize = TextFieldAutoSize.LEFT;
fl_TF9.background = false;
fl_TF9.border = false;
fl_TF9.x = 100;
fl_TF9.y = 643;
fl_TF9.text = fl_TextToDisplay9;
addChild(fl_TF9);
textformat9.size = i9;
textformat9.font = "Europa-Regular";
fl_TF9.setTextFormat(textformat9);
}
function out9(event:MouseEvent):void
{
fl_TF9.visible = false;
}
/* Finance_info (10) */
Finance_info.addEventListener(MouseEvent.MOUSE_OVER, over10);
Finance_info.addEventListener(MouseEvent.MOUSE_OUT, out10);
var fl_TF10:TextField;
var textformat10:TextFormat = new TextFormat;
var i10:int = 19;
var fl_TextToDisplay10:String =
"Assesses, monitors, and plans the utilization of cash and financial services";
function over10(event:MouseEvent):void
{
Finance_info.visible = true;
fl_TF10 = new TextField();
fl_TF10.autoSize = TextFieldAutoSize.LEFT;
fl_TF10.background = false;
fl_TF10.border = false;
fl_TF10.x = 90;
fl_TF10.y = 643;
fl_TF10.text = fl_TextToDisplay10;
addChild(fl_TF10);
textformat10.size = i10;
textformat10.font = "Europa-Regular";
fl_TF10.setTextFormat(textformat10);
}
function out10(event:MouseEvent):void
{
fl_TF10.visible = false;
}
/* Admin_info (11) */
Admin_info.addEventListener(MouseEvent.MOUSE_OVER, over11);
Admin_info.addEventListener(MouseEvent.MOUSE_OUT, out11);
var fl_TF11:TextField;
var textformat11:TextFormat = new TextFormat;
var i11:int = 20;
var fl_TextToDisplay11:String =
"Acquires and manages physical invoices and handles other projects";
function over11(event:MouseEvent):void
{
HR_info.visible = true;
fl_TF11 = new TextField();
fl_TF11.autoSize = TextFieldAutoSize.LEFT;
fl_TF11.background = false;
fl_TF11.border = false;
fl_TF11.x = 100;
fl_TF11.y = 643;
fl_TF11.text = fl_TextToDisplay11;
addChild(fl_TF11);
textformat11.size = i11;
textformat11.font = "Europa-Regular";
fl_TF11.setTextFormat(textformat11);
}
function out11(event:MouseEvent):void
{
fl_TF11.visible = false;
}
/* HR_info (12) */
HR_info.addEventListener(MouseEvent.MOUSE_OVER, over12);
HR_info.addEventListener(MouseEvent.MOUSE_OUT, out12);
var fl_TF12:TextField;
var textformat12:TextFormat = new TextFormat;
var i12:int = 20;
var fl_TextToDisplay12:String =
"Manages hiring and onboarding of employees and employee relations";
function over12(event:MouseEvent):void
{
HR_info.visible = true;
fl_TF12 = new TextField();
fl_TF12.autoSize = TextFieldAutoSize.LEFT;
fl_TF12.background = false;
fl_TF12.border = false;
fl_TF12.x = 100;
fl_TF12.y = 643;
fl_TF12.text = fl_TextToDisplay12;
addChild(fl_TF12);
textformat12.size = i12;
textformat12.font = "Europa-Regular";
fl_TF12.setTextFormat(textformat12);
}
function out12(event:MouseEvent):void
{
fl_TF12.visible = false;
}
Моя конечная цель — чтобы строка, отображаемая при наведении курсора, отображалась шрифтом Europa Regular. Это потому, что строка не предназначена? Любая помощь приветствуется!
Ответ №1:
если вы правильно внедрили настройки, вам следует установить для свойств embedFonts значение true
fl_TF12.embedFonts = true
также вы можете изменить свой встроенный шрифт с помощью этого скрипта
fl_TF12.font = Font.enumerateFonts()[0].fontName;
Комментарии:
1. Красивые. Я попробую, я не понимал, что это то, что я мог бы добавить в код спасибо!