A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Please help with this tutorial

  1. #1
    Member
    Join Date
    Jul 2011
    Posts
    32

    Please help with this tutorial

    This tutorial si about moving star out of the stage center, this is the script:
    import flash.display.MovieClip;
    import flash.events.Event;

    var container:MovieClip = new MovieClip();
    addChild(container);


    addEventListener(Event.ENTER_FRAME, addstarred);

    function addStared(e:Event):void
    {

    var mc:starred; = new Starred();
    mc.x = stage.stagewidth / 2;
    mc. y = stage, Stageheight / 2;
    mc.Z = 0;


    mc.xVel = Math,random() * 4 -2;
    mc.yVel = Math,random() * 4 -2;
    mc.zVel = Math,random() * 4 -2;
    container. addChild(mc);

    mc.addEventListener(Event. ENTER_FRAME, animate);
    }

    function animate(e:Event):void
    {
    e.currentTarget.x += e.currentTarget.xVel;
    e.currentTarget.y += e.currentTarget.yVel;
    e.currentTarget.z += e.currentTarget.zVel;
    if (e.currentTarget.count>=100)

    }

    This are the 2 errors:
    Scene 1, Layer 'Layer 1', Frame 1, Line 13 1084: Syntax error: expecting identifier before assign.

    Scene 1, Layer 'Layer 1', Frame 1, Line 34 1084: Syntax error: expecting identifier before rightbrace.

    What is identifier?

    With this part it is supposed to work, but doesn't, the part that a left out on purpose, is the one that stop the stars moving at one point in the stage.
    Thank you for your help.

  2. #2
    Member
    Join Date
    Jul 2011
    Posts
    32
    this is line: 13:var mc:starred; = new Starred();
    this is line: 34 }

  3. #3
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You have typos all over the place. You must be precise when writing code.
    You add addstarred as a listener, but you've named the function "addStared". Both spelling and capitalization are incorrect.
    In the line that it's complaining about, you have an extra semicolon. There should not be a semicolon before the equals.
    On the line setting mc.y, you have an extra space before y, a comma which should be a dot, another extra space, and you've incorrectly capitalized stageheight.
    mc.Z should be mc.z
    You have another comma where a dot should be in the line setting mc.yVel, and again on the line setting mc.zVel.
    You have an extra space in the container.addChild line.
    You probably have an extra space in the next addEventListener line, but it could just appear that way because you did not use [code] tags to post your code.
    You have an incomplete and completely useless if statement at the end of animate.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center