Copy link to clipboard
Copied
I am making a puzzle with scoreboard with error addressed in subject.
Pasting part of the code:
var textfont: TextFormat = new TextFormat();
textfont.size = 40;
textfont = "Showcard Gothic";
1b1.setStyle("textFormat", textfont); /*error line in compiler*/
1b2.setStyle("textFormat", textfont);
Hopefully someone can help me.
I am new to this kind of forum so if i forgot something please let me know.
Copy link to clipboard
Copied
Hi.
Properties and variables names cannot start with numbers. So you're gonna have to rename 1b1 to something else.
Naming limitations for variables in ActionScript 3
• Variable names cannot be a reserved word or keyword. For more information, see ActionScript 3 fundamentals: Syntax
• Variable names must start with a letter, an underscore, or a dollar sign
• Variable names cannot use special characters (except
_
and
$
in certain situations)
• Variable names must be unique
More details here:
https://www.adobe.com/devnet/actionscript/learning/as3-fundamentals/variables.html
Regards,
JC
Copy link to clipboard
Copied
Thank you for the quick answer, changed it to kb1 and the error disappeared. I will read the variable page to learn more about as3. After the changes the compiler has the following error: 1172: Definition com.adobe.tvsdk.mediacore.TextFormat could not be found.
When i click on it this line is selected: import com.adobe.tvsdk.mediacore.TextFormat;
What am i doing wrong now? Thanks in advance.
Copy link to clipboard
Copied
Nice!
Yeah. Because that's probably not the TextFormat class you want to use.
Instead of:
import com.adobe.tvsdk.mediacore.TextFormat;
Write:
import flash.text.TextFormat;
Please let us know if this fixes the issue.
Regards,
JC