7 Replies Latest reply on Jun 5, 2008 2:40 PM by Greg Dove

    Problem With Actionscript Working in Player 7 and Up

    JJahue
      Can some one please help me, I have been working with an old action script file that works in flash player 6 but not any thing above that. Any help would be great. As a side note the spline function no longer works either.

      onClipEvent (load) {
      function x(t) {
      var __reg1 = t;
      if (__reg1 != 0 && __reg1 != 1) {
      xspline = Math.pow(1-__reg1, 3)*x0+3*Math.pow(1-__reg1, 2)*__reg1*x1+3*(1-__reg1)*Math.pow(__reg1, 2)*x2+Math.pow(__reg1, 3)*x3;
      }

      if (__reg1 == 0) {
      xspline = x0;
      }

      if (__reg1 == 1) {
      xspline = x3;
      }

      return xspline;
      }

      function y(t) {
      var __reg1 = t;
      if (__reg1 != 0 && __reg1 != 1) {
      yspline = Math.pow(1-__reg1, 3)*y0+3*Math.pow(1-__reg1, 2)*__reg1*y1+3*(1-__reg1)*Math.pow(__reg1, 2)*y2+Math.pow(__reg1, 3)*y3;
      }

      if (__reg1 == 0) {
      yspline = y0;
      }

      if (__reg1 == 1) {
      yspline = y3;
      }

      return yspline;
      }

      function evalangle(x1, y1, x2, y2, linedist) {
      lineangle = Math.asin((y2-y1)/linedist)*180/3.14159;
      if (x1-x2>0) {
      lineangle = 180-lineangle;
      }

      return lineangle;
      }

      function drawLine(xp1, yp1, xp2, yp2, linedepth) {
      var __reg1 = lineDepth;
      _parent;
      var __reg3 = xp1;
      linedist = Math.sqrt((xp2-__reg3)*(xp2-__reg3)+(yp2-yp1)*(yp2-yp1));
      lineangle = evalangle(__reg3, yp1, xp2, yp2, linedist);
      _parent.attachMovie("line","line"+__reg1,__reg1);
      _parent["line"+__reg1]._x = __reg3;
      _parent["line"+__reg1]._y = yp1;
      _parent["line"+__reg1]._rotation = lineangle;
      _parent["line"+__reg1]._xscale = 10*linedist;
      }


      function drawSpline() {
      i = 0;
      while (i<nsplinepoints) {
      xpspline = x(t);
      ypspline
      = y(t);
      t = t+step;
      ++i;
      }

      i = 0;
      while (i<nsplinelines) {
      drawLine(xpspline ,ypspline,xpspline[i+1],ypspline[i+1],i);
      ++i;
      }

      var t = 0;
      }

      function moveflower() {
      _parent;
      var crdzx = _parent._xmouse;
      if (_parent._ymouse<0) {
      var crdzy = _parent._ymouse;
      }

      if (crdzx>crdx) {
      crdx = crdx+(crdzx-crdx)/20;
      }

      if (crdzx<crdx) {
      crdx = crdx-(crdx-crdzx)/20;
      }

      if (crdzy>crdy) {
      crdy = crdy+(crdzy-crdy)/20;
      }

      if (crdzy<crdy) {
      crdy = crdy-(crdy-crdzy)/20;
      }

      if (crdx == 0) {
      crdx = 1;
      }

      if (crdy == 0) {
      crdy = 1;
      }

      distance = Math.sqrt(crdx*crdx+crdy*crdy);
      angle = Math.asin(crdx/distance)*180/3.14159;
      x3 = radius*crdx/distance;
      y3 = radius*crdy/distance;
      _parent.dragme._rotation = angle;
      _parent.dragme._x = x3;
      _parent.dragme._y = y3;
      }

      var nsplinepoints = 11;
      var nsplinelines = nsplinepoints-1;
      var step = 1/nsplinelines;
      var t = 0;
      var x0 = 0;
      var x1 = 0;
      var x2 = 0;
      var y0 = 50;
      var y1 = 33;
      var y2 = 0;
      var radius = 40;
      var xpspline = [];
      var ypspline = [];
      }
      onClipEvent (enterFrame) {
      moveflower();
      drawspline();
      }