Skip to main content
Participant
April 22, 2020
Question

When preview swf getting error, 1086: syntax error: expecting semicolon before b1

  • April 22, 2020
  • 1 reply
  • 673 views

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.

 

 

 

This topic has been closed for replies.

1 reply

JoãoCésar17023019
Community Expert
Community Expert
April 22, 2020

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

Participant
April 22, 2020

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.

 

 

 

 

 

JoãoCésar17023019
Community Expert
Community Expert
April 22, 2020

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