1 Reply Latest reply on Jan 24, 2008 10:55 PM by Lukewig

    In dire need of help with interactivity

    KungfuJoe1110
      Ok, I've done some coding in C# and Java, so I know a little bit, and you should be able to talk at me and I should get it.
      Now:

      Lingo is confusing me very badly. I've been trying to use JavaScript, but that isn't working either. Only the very basic scripts will work for me (frame loops and whatnot).

      I'm trying to get a sprite to move when I press an arrow key, and am having the darndest time. Does anyone know of a good tutorial (preferabally in JavaScript) that explains this?

      If so, please link me over, i'd greatly appreciate it.


      Here's an example. I was reading the tutorial from this very site, and came across this code:
      function beginsprite() {


      spr.pColor = color(random(0,255), random(0,255), random(0,255));

      spr.pSpeed = 10;

      trace("I made a random color and a constant speed for sprite " +
      spr.spriteNum);

      }

      When I attached it to a sprite (by drawing a circle on the stage, right-clicking and going to its script, and posting it), nothing happened. If I'm understanding correctly, among other things, the color should change.
      So I tried attaching it to the frame by doing this:
      function enterFrame(me) {
      beginsprite(5);
      }

      function exitFrame(me) {
      _movie.go(_movie.frame)
      }

      function beginsprite(_movie.cast.sprite spr) {


      spr.pColor = color(random(0,255), random(0,255), random(0,255));

      spr.pSpeed = 10;

      trace("I made a random color and a constant speed for sprite " +
      spr.spriteNum);

      }

      but that didn't work either.

      Please help me to understand this.

      Thank you for your time
      KFJ