Hello everyone, any help changing the syntax of this piece of code in as1 to as2.
for some reason when i change the public settings to as2… my code won’t work anymore… please advice… thank you.
stop();
Mouse.hide();
clickTag.enabled = false;
_root.pplTypes = [5,2,5,3,4,3,4,2];
init();
function init(){
for(var i:Number=1;i<=8;i++){
this["person"+i].dragging = false;
this["person"+i].onPress = function(){
this.startDrag();
this.dragging = true;
}
this["person"+i].onRelease = function(){
this.stopDrag();
this.dragging = false;
}
moveIt();
}
}
function moveIt() {
this["person"+i]._x = Math.random()*300;
this["person"+i]._y = Math.random()*250;
this["person"+i].dx = Math.round(Math.random()*300);
this["person"+i].dy = Math.round(Math.random()*250);
}
function onEnterFrame(){
claudia_mc._x = _xmouse;
claudia_mc._y = _ymouse;
for(var i=1;i<=8;i++){
if (this["person"+i].hitTest(tableArea)) {
trace("you hit the table");
}
if(this["person"+i].dragging == true){
var dx:Number = 0;
var dy:Number = 0;
var dd:Number = 0;
var chair:MovieClip;
var pp = this["person"+i];
//trace(pp+" "+pp._x+" "+pp._y);
for(var j=1;j<=8;j++){
chair = this["seat"+j];
if(chair._currentframe > 1)
continue;
dx = chair._x - pp._x;
dy = chair._y - pp._y;
dd = Math.sqrt(dx*dx+dy*dy);
//trace(dd);
if(dd < 20)
{
sitPerson(i, j);
break;
}
}
continue;
}
this["person"+i]._x += (this["person"+i].dx-this["person"+i]._x)/6;
this["person"+i]._y += (this["person"+i].dy-this["person"+i]._y)/6;
if(Math.round(this["person"+i]._x) == this["person"+i].dx) {
this["person"+i].dx = Math.round (Math.random()*300);
this["person"+i].dy = Math.round (Math.random()*250);
}
}
}
function sitPerson(pID, cID){
var person = this["person"+pID];
person._visible = false;
person.dragging = false;
var chair = this["seat"+cID];
chair.gotoAndStop(_root.pplTypes[pID-1]);
trace(_root.pplTypes[pID-1]+" "+pID);
}