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

# Problem With Actionscript Working in Player 7 and Up

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.

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;
_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();
}

• ###### 1. Re: Problem With Actionscript Working in Player 7 and Up
use the attach code option in this forum to display code.

the usual problem is either,

1. incrementing or decrementing a variable that's not initialized
2. a mistyped object/variable. for example, var1 used to be the same as Var1 in flash 6 and earlier.
• ###### 2. Re: Problem With Actionscript Working in Player 7 and Up
Thanks but I have been over the code several times and nothing I do works. If you don't mind could you look at the code, I understand usual problems but in this case I cant seem to find the usual. Im trying to implement this code for a client it was on their old website so I dint not write the code. So its hard for me to find the problems. I have a similar code that I wrote that works but " not like this one" so the client wants this one.

Thanks
Jahue
• ###### 3. Re: Problem With Actionscript Working in Player 7 and Up
look at the code you posted. it's close to unreadable.

someone might help you if you follow the directions i gave for posting code in this forum. at least, try it. if all else fails you can hire me to fix your problem.
• ###### 4. Re: Problem With Actionscript Working in Player 7 and Up
I wouldn't think copy and paste was beyond your limits. And if you don't know thats fine just say so. Thanks anyway I will wait for some one else. And why would I hire you your website is archaic update it with more than basic flash and then we will talk.
• ###### 5. Re: Problem With Actionscript Working in Player 7 and Up
copy and paste is not beyond my limits, smart ***.

because you're too rude to consider that despite part of your code being posted in a regular font and part in italic, i won't be helping you.
• ###### 6. Re: Problem With Actionscript Working in Player 7 and Up
OK. I was replying to you being a smart *** first. Because you have posted 31000 comments you rule the forums? When last I posted on this forum there was no attach code function. Im sure your good but don't get full of yourself because some where there are a dozens of kids that grew up with this stuff and can beat the pants off both you and I. Im sure there is no less than 10,000 other people that can help me most likely better than you. So thanks for being a smart *** first but like I said before I will wait for some one else.
Thanks
Jahue
• ###### 7. Re: Problem With Actionscript Working in Player 7 and Up
Oh I suspect you'll be waiting a long time, now. I certainly don't have the same impression you do about who did what first. That was just some advice on how to get the answers you needed...