A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [AS3][help] code works w/ a 404

  1. #1
    Senior Member zervell's Avatar
    Join Date
    May 2004
    Posts
    259

    [AS3][help] code works w/ a 404

    coding in as3 is getting easier everyday but I'm not a guru yet. My code makes curvy lines. The problem is, is that i get this error

    <pre>
    TypeError: Error #1010: A term is undefined and has no properties.
    at liner/::init()
    at liner$iinit()
    </pre>


    this is my code

    <pre>
    package {
    import flash.display.Sprite;
    public class liner extends Sprite {
    public function liner() {
    init();


    }
    private function init():void
    {
    graphics.lineStyle(1,0xff0000,1);
    graphics.moveTo(200,200);
    var points:Array = new Array();
    for (var i:int =0; i<10; i++) {
    points[i]=new Object();
    points[i].x=Math.random()*550;
    points[i].y=Math.random()*110;


    }
    for (i =0; i<10; i++) {
    var dx:Number=(points[i].x+points[i+1].x)/2;
    var dy:Number=(points[i].y+points[i+1].y)/2;

    graphics.curveTo(points[i].x,points[i].y,dx,dy);
    }
    }
    }
    }

    </pre>

    the code works so why do i get this 404?
    CEO OF

  2. #2
    Senior Member
    Join Date
    Sep 2005
    Location
    Detroit
    Posts
    193
    you don't need
    Code:
    points[i]=new Object();
    Objects in the array cannot be strict typed. I had this issue in the transition too, and I really think that this is a bug in AS3.

    Also you might want to use Point instead of Object in the future for points. It works well and is new.

    A 404 is a server error for a page not found and what you are getting is not a 404.
    While the music played you worked by candlelight
    Those san francisco nights
    You were the best in town
    Just by chance you crossed the diamond with the pearl
    You turned it on the world
    That’s when you turned the world around

  3. #3
    Senior Member zervell's Avatar
    Join Date
    May 2004
    Posts
    259
    thanks. charlie

    i found out that this was the problem

    for (i =0; i<10; i++) {
    var dx:Number=(points[i].x+points[i+1].x)/2;
    var dy:Number=(points[i].y+points[i+1].y)/2;

    graphics.curveTo(points[i].x,points[i].y,dx,dy);
    }

    when it gets to 10 points[i+1 is point11 and there wasn't a point11. Point are great!!
    CEO OF

  4. #4
    Senior Member
    Join Date
    Sep 2005
    Location
    Detroit
    Posts
    193
    Cool yea I was thinking about that and realized that wouldn't throw an error. but glad you figured it out
    While the music played you worked by candlelight
    Those san francisco nights
    You were the best in town
    Just by chance you crossed the diamond with the pearl
    You turned it on the world
    That’s when you turned the world around

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