hi i am new to AS3 in flash. i was trying to add a link button on my flash but i get the (1084: Syntax error: expecting rightparen before semicolon.) when i test it .
this is the code i created:
function myButtonPressed(event:MouseEvent){
navigateToURL(new URLRequest("http://pinoytoon.blogspot.com","_blank");
}
myButton.useHandCursor = true;
myButton.addEventListener(MouseEvent.MOUSE_DOWN, myButtonPressed);
please help me!!!
asked Jun 23, 2013 at 7:49
1
I think, you forgot close navigateToURL function with a rightparen:
function myButtonPressed(event:MouseEvent){
navigateToURL(new URLRequest("http://pinoytoon.blogspot.com","_blank"));
}
myButton.useHandCursor = true;
myButton.addEventListener(MouseEvent.MOUSE_DOWN, myButtonPressed);
i hope i could help you!
answered Jun 23, 2013 at 11:28
HoryHory
162 bronze badges
-
sersche
- FL Team

- Сообщения: 598
- Зарегистрирован: 11 май 2010, 13:45
Re: ПРОСТОЙ ВОПРОС — ОТВЕТ
вот код
Код: Выделить всё
var newtxt = txt; dlina = newtxt.length; for(var i:int = 9; i<(Math.ceil(dlina/10)); i+=10) { if (newtxt.charAt(i)==" ") { newtxt = newtxt; break; } else if(newtext.charAt(i+1)==" ") { newtxt = newtxt.substr(0; i) + newtxt.substr(i+1; dlina-i-1); break; } else if(newtext.charAt(i-1)==" ") { newtxt = newtxt.substr(0; i-1) + " " + newtxt.substr(i; dlina-i+1); break; } else if(newtext.charAt(i-1)!=" ") { newtxt = newtxt.substr(0; i-1) + "-" + newtxt.substr(i; dlina-i+1); break; } dlina = newtxt.length; }
txt — переменная типа стринг.. туда я записываю чо пользователь ввел..
вот ошибки
описание // источник
1084: Синтаксическая ошибка: rightparen перед semicolon. // newtxt = newtxt.substr(0; i) + newtxt.substr(i+1; dlina-i-1);
1084: Синтаксическая ошибка: rightbrace перед i. // newtxt = newtxt.substr(0; i) + newtxt.substr(i+1; dlina-i-1);
и еще 4 штуки подобных..
помогите избавиться…
-
совесть
- Разработчик

- Сообщения: 156
- Зарегистрирован: 22 дек 2009, 23:58
- Откуда: Санкт-Петербург
Re: ПРОСТОЙ ВОПРОС — ОТВЕТ
Сообщение
совесть » 10 июн 2010, 22:46
substr что делает? 0_о
наверно надо писать
substr(что-то там, что-то там)
то есть вместо «;» пишем «,»
-
bodnar
- Модератор

- Сообщения: 1399
- Зарегистрирован: 03 апр 2010, 06:41
Re: ПРОСТОЙ ВОПРОС — ОТВЕТ
Сообщение
bodnar » 12 июн 2010, 11:48
В том как рекламу добавлять разобрались? В контейнере разобрались? Сами пробовали сделать? Как делали? Что не получилось? Почему у вас все спрашивать приходится?
-
Oleg.arh
- Сообщения: 12
- Зарегистрирован: 14 июн 2010, 15:25
Re: ПРОСТОЙ ВОПРОС — ОТВЕТ
Сообщение
Oleg.arh » 14 июн 2010, 15:29
Здравствуйте, я совсем новичок во Flash.
Такой вопрос!
В fla файле у меня есть текстовое поле — InputText, в которое пользователь должен ввести некий текст.
Как мне потом этот текст получить? в какую переменную он попадает? Объясните пожалуйста!
-
grenium
- Сообщения: 25
- Зарегистрирован: 16 май 2010, 14:16
Re: ПРОСТОЙ ВОПРОС — ОТВЕТ
Сообщение
grenium » 17 июн 2010, 19:18
Подскажите пожалуйста, программирую на Abobe Flash CS4. flash выдаёт ошибку при использовании двух as файлов, как их можно объеденить в один as файл, по отдельности они работают отлично, а вот вместе не хотят
ActionScript Error #1084: Syntax error: expecting rightbrace before end of program.
Error 1084 is the general error number for syntax errors. ActionScript Error #1084 can be any number of errors. I will keep this one up to date with all the variations I find and how to fix them.
AS3 Error 1084: Syntax error: expecting rightbrace before end of program
This is a very easy one. This error just means that you are most likely missing a right brace. Or you have nested code improperly.
Bad Code:
[as]
package com.cjm
{
class CoolClass {
function CoolClass () {
trace(“Something cool”)
}
}
[/as]
Good Code:
[as]
package com.cjm
{
class CoolClass {
function CoolClass () {
trace(“Something cool”)
}
}
}
[/as]
Please make note of the third bracket at the end of the good code.
ActionScript Error #1084: Syntax error: expecting colon before semicolon.
You will most likely get this error if you are using a ternary statement and you forget to use a colon, forgot the last part of your ternary, or you replace the colon with a semicolon. This is illustrated in the following example:
Bad Code:
[as]
me.myType == “keys” ? trace(keys);
[/as]
or
[as]
me.myType == “keys” ? trace(keys) ; trace(defs);
[/as]
Good Code:
[as]
me.myType == “keys” ? trace(keys) : trace(defs);
[/as]
Flash/Flex Error #1084: Syntax error: expecting identifier before leftbrace.
Description:
This Flash/Flex Error is reported when you left out the name of your class. The ‘identifier’ that it is looking for is the name of your class.
Fix:
You will see in the code below that you just need to add in the name of your class and the error will go away.
Bad Code:
[as]
package com.cjm.somepackage {
public class {
}
}
[/as]
Good Code:
[as]
package com.cjm.somepackage {
public class MyClass {
}
}
[/as]
Flex/Flash Error #1084: Syntax error: expecting leftparen before colon.
or
Flex/Flash Error #1084: Syntax error: expecting rightparen before colon.
Description:
These AS3 Errors are reported when you the order of the parenthesis and colon are not in the proper place or the parenthesis is missing.
Fix:
The AS3 code below demonstrates the placement error. Properly order the items and the error will disappear. Also, make sure that a parenthesis is not missing. The ‘Bad Code’ gives an example of leftParen and then right paren in the order.
Bad Code:
[as]
public function ScrambleSpelling:void (s:String)
or
public function ScrambleSpelling(s:String:void
[/as]
Good Code:
[as]
public function ScrambleSpelling (s:String):void
[/as]
Flex/Flash Error #1084: Syntax error: expecting rightparen before semicolon.
Description:
This AS3 Error is reported most often when the parenthesis is missing.
Fix:
Make sure that a parenthesis is not missing. The ‘Bad Code’ gives an example of leftParen and then right paren in the order.
Bad Code:
[as]
tempArray.push((middle.splice(middle.length-1) * Math.random());
or
tempArray.push(middle.splice(middle.length-1) * Math.random();
[/as]
Good Code:
[as]
tempArray.push(middle.splice(middle.length-1) * Math.random());
[/as]
Flex/Flash Error #1084: Syntax error: expecting identifier before 1084.
Description:
This AS3 Error is reported when you have begun a package, class, function/method or variable with a numeric character rather than an Alpha character, _(underscore), or $(dollar sign). In the Flash Authoring environment it won’t allow you to add numerics as the first character in an instance name or in the linkage but with code it just gives this crazy error.
Fix:
Make sure to name your package, class, function/method or variable with a Alpha character, _(underscore), or $(dollar sign).
Bad Code:
[as]
package 1084_error
{
class 1084_error {
function 1084_error () {
var 1084_error:int = 123;
}
}
}
[/as]
Good Code:
[as]
package error_1084
{
class error_1084 {
function error_1084 () {
var error_1084:int = 123;
}
}
}
[/as]
P.S. It is probably not a good idea to give everything the same name as in the examples above.
1084: Syntax error: expecting rightparen before tripledot
Description:
This AS3 Error is reported when you add the ellipsis after the arguments parameter
Fix:
Make sure to add the ellipsis before the arguments parameter.
Incorrect:
[as]
public static function checkInheritance(propertyName:String, objects…) { }
[/as]
Correct:
[as]
public static function checkInheritance(propertyName:String, …objects) { }
[/as]
AS3 Error #1084 will rear it’s many heads according to the particular syntax error at the moment. I will post every variation of this error that I can find.
Я пытаюсь использовать цикл for в AS3, чтобы получить значение некоторого узла из файла XML, вот код с их строкой после //
function processxml(){
var checkName = username.text;
var checkPass = password.text;
users_XML = XML(loadusers.data);
var userid:int;
var totaldata = users_XML.*.length();
var maxsearch = totaldata - 1;
var usernamecheck = users_XML.user[userid].@username;
var passwordcheck = users_XML.user[userid].(@username==checkName);
for (userid=0; userid <= maxsearch, userid++){ //line 113
if (usernamecheck==checkName){ //line 114
if (usernamecheck==checkName && passwordcheck==checkPass){ //line 115
gotoAndStop(2); //line 116
}else{ //line 117
result_text.text = "please check your password";
}
}else{ //line 120
result_text.text = "please check your username";
}
}
}
Но это дало мне некоторую ошибку, например:
E:caserversactionsmain.as, Line 113 1084: Syntax error: expecting semicolon before rightparen.
E:caserversactionsmain.as, Line 114 1084: Syntax error: expecting identifier before if.
E:caserversactionsmain.as, Line 114 1084: Syntax error: expecting colon before equals.
E:caserversactionsmain.as, Line 115 1084: Syntax error: expecting identifier before if.
E:caserversactionsmain.as, Line 115 1084: Syntax error: expecting colon before equals.
E:caserversactionsmain.as, Line 116 1084: Syntax error: expecting colon before leftparen.
E:caserversactionsmain.as, Line 117 1084: Syntax error: expecting identifier before rightbrace.
E:caserversactionsmain.as, Line 117 1084: Syntax error: expecting rightbrace before else.
E:caserversactionsmain.as, Line 120 1084: Syntax error: expecting rightparen before else.
Хорошо, я ДЕЙСТВИТЕЛЬНО не знаю, что проверить в первую очередь, потому что я сделал это так, как сказано в руководстве. очень ценится любое просветление! заранее спасибо! : D
1 ответ
Лучший ответ
Вы пропустили точку с запятой в строке цикла for:
for (userid=0; userid <= maxsearch, userid++){
Должно быть
for (userid=0; userid <= maxsearch; userid++){
-1
fsbmain
2 Май 2015 в 19:38