开发者

ActionScript syntax error 1084: expecting rightbrace before leftbrace and var 'colour' will be scoped to default namespace

I got an error which says 开发者_运维技巧

1084 syntax error; expecting rightbrace before leftbrace as well as var 'colour' will be scoped to default namespace.

Im' not sure what is going on but it is interfering with my ability to debug. it is action script

1084 error

package {
import flash.display;
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.*;:

public class assgn extends Sprite
{ 

    public function assgn()
    {
      var request = new URLRequest("C:\Users\Fujitsu User\Desktop\projects folder09_10");
      var loader = new Loader();
      loader.load(request);

      addChild(loader);

      loader.x = 100;
      loader.scaleY = 0.5;

      var recA:Sprite = new Sprite();

      graphics.beginFill(0xFFF010);
      graphics.lineStyle(1);
      graphics.drawRect(0, 380, 50, 20);
      addChild(recA);

        recA.x = 300;
        recA.y = 300;
        recA.scaleX = 2;
        recA.scaleY = 2;
        recA.addEventListener(Event.ENTER_FRAME, moveRecA);
        graphics.beginFill(0xFF0000);
     }
   }
 }


As for the time being i cant comment, or edit your post I will suggest you to reformat your post to include all the code inside the tags.

Also, there is a semicolon after (is that a typo or is in your actual code...remove it) Error 1084 is the general error number for syntax errors.

import flash.net.*;:

Another thing is that you are loading a folder(?), the path you have in your loader has no file type.

As a pointer, there is this blog Actionscript Errors that is a repository of AS3 common errors.


  • As suggested, removing the : from the end of import flash.net.*;: will fix the rightbrace/leftbrace error.
  • As for the var colour warning, there is no such variable in this file; locate the class in which you are declaring var colour and add private or public or protected to that line as applicable.
  • Apart from referring to a folder as already pointed out, "C:\Users\Fujitsu User\Desktop\projects folder09_10" is also wrong syntactically. You have to escape backslashes in strings.

    The corrected string is : "C:\\Users\\Fujitsu User\\Desktop\\projects folder09_10"

  • import flash.display; is wrong, change it to import flash.display.*;
  • The method moveRecA is not defined.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜