Posted by admin in portal.cgkq.com
  • Hey guys, I got this code straight out of a Flash Actionscript book but I can't get it to work. The output panel does not show an error, but the code does not do what it should. It is a mouse trail

    Any thoughts, would be appreciated

    onClipEvent(load){
    //CREATE 10 CURSOR FOLLOWERS
    for(var i=0;i<10;i++){
    _root.attachMovie("glitter","glitter"+i,i);
    }
    //START THE ARRAY
    trail = new Array();
    }
    onClipEvent(enterFrame){
    //MARK THE MOUSE LOCATION
    cursorLoc = {x:_root._xmouse, y:_root._ymouse};
    //ADD THE NEW LOCATION TO THE ARRAY
    trail.push(cursorLoc);
    //DELETE THE OLDEST LOCATION
    if(trail.length > 10) trail.shift();
    //CHANGE THE POSITIONS OF ALL CURSOR FOLLOWERS
    for(var i=0; i _root["cursor"+i]._x = trail[i].x;
    _root["cursor"+i]._y = trail[i].y;
    _root["cursor"+i]._alpha = i*10; //CHANGE BLEND TO
    }
    }


  • Good eye but still no luck. Any thoughts?


  • Looking over it very quickly, this IF statement is broken:


    if(trail.length > 10) trail.shift();

    You need the curlies {}.


  • does it need brackets when its only one line? I know php doesn't require it.







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Easy code from a book. But does not work! , Please add it free.