Skip to main content
kristak60753381
Participant
August 16, 2023
Question

ActionScript3 to Canvas Game No Longer Working - What's Wrong With My Code?

  • August 16, 2023
  • 1 reply
  • 106 views

I am new to Animate, and to say that I am inexperienced with coding is an understatement. I created a puzzle game in Flash, but realized I needed to create it in HTML5 for hosting on our website. I converted to Canvas, but now the puzzle pieces are not movable. I am stumped. Help?

 

/* import flash.events.MouseEvent;

import flash.events.Event;

stop();

var count:Number=0;

stage.addEventListener (Event.ENTER_FRAME,PuzzleLoop);

function PuzzleLoop(e:Event):void

{

 

                if (count >=25)

                                {

                                stage.removeEventListener(Event.ENTER_FRAME, PuzzleLoop);

                                _this.MC1.visible= false;

                                _this.MC2.visible= false;

                                _this.MC3.visible= false;

                                _this.MC4.visible= false;

                                _this.MC5.visible= false;

                                _this.MC6.visible= false;

                                _this.MC7.visible= false;

                                _this.MC8.visible= false;

                                _this.MC9.visible= false;

                                _this.MC10.visible= false;

                                _this.MC11.visible= false;

                                _this.MC12.visible= false;

                                _this.MC13.visible= false;

                                _this.MC14.visible= false;

                                _this.MC15.visible= false;

                                _this.MC16.visible= false;

                                _this.MC17.visible= false;

                                _this.MC18.visible= false;

                                _this.MC19.visible= false;

                                _this.MC20.visible= false;

                                _this.MC21.visible= false;

_this.MC22.visible= false;

_this.MC23.visible= false;

_this.MC24.visible= false;

_this.MC25.visible= false;

                                gotoAndStop(2);

                                }

 

}

var orig1X:Number=_this.MC1.x; 

var orig1Y:Number=_this.MC1.y;

var orig2X:Number=_this.MC2.x;

var orig2Y:Number=_this.MC2.y;

var orig3X:Number=_this.MC3.x;

var orig3Y:Number=_this.MC3.y;

var orig4X:Number=_this.MC4.x;

var orig4Y:Number=_this.MC4.y;

var orig5X:Number=_this.MC5.x; 

var orig5Y:Number=_this.MC5.y;

var orig6X:Number=_this.MC6.x; 

var orig6Y:Number=_this.MC6.y;

var orig7X:Number=_this.MC7.x; 

var orig7Y:Number=_this.MC7.y;

var orig8X:Number=_this.MC8.x; 

var orig8Y:Number=_this.MC8.y;

var orig9X:Number=_this.MC9.x; 

var orig9Y:Number=_this.MC9.y;

var orig10X:Number=_this.MC10.x; 

var orig10Y:Number=_this.MC10.y;

var orig11X:Number=_this.MC11.x; 

var orig11Y:Number=_this.MC11.y;

var orig12X:Number=_this.MC12.x; 

var orig12Y:Number=_this.MC12.y;

var orig13X:Number=_this.MC13.x; 

var orig13Y:Number=_this.MC13.y;

var orig14X:Number=_this.MC14.x; 

var orig14Y:Number=_this.MC14.y;

var orig15X:Number=_this.MC15.x; 

var orig15Y:Number=_this.MC15.y;

var orig16X:Number=_this.MC16.x; 

var orig16Y:Number=_this.MC16.y;

var orig17X:Number=_this.MC17.x; 

var orig17Y:Number=_this.MC17.y;

var orig18X:Number=_this.MC18.x; 

var orig18Y:Number=_this.MC18.y;

var orig19X:Number=_this.MC19.x; 

var orig19Y:Number=_this.MC19.y;

var orig20X:Number=_this.MC20.x; 

var orig20Y:Number=_this.MC20.y;

var orig21X:Number=_this.MC21.x; 

var orig21Y:Number=_this.MC21.y;

var orig22X:Number=_this.MC22.x; 

var orig22Y:Number=_this.MC22.y;

var orig23X:Number=_this.MC23.x; 

var orig23Y:Number=_this.MC23.y;

var orig24X:Number=_this.MC24.x; 

var orig24Y:Number=_this.MC24.y;

var orig25X:Number=_this.MC25.x; 

var orig25Y:Number=_this.MC25.y;

_this.MC1.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC1.addEventListener(MouseEvent.MOUSE_UP, MC1Release);

_this.MC2.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);  

_this.MC2.addEventListener(MouseEvent.MOUSE_UP, MC2Release);  

_this.MC3.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);   

_this.MC3.addEventListener(MouseEvent.MOUSE_UP, MC3Release);   

_this.MC4.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC4.addEventListener(MouseEvent.MOUSE_UP, MC4Release);

_this.MC5.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC5.addEventListener(MouseEvent.MOUSE_UP, MC5Release);

_this.MC6.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC6.addEventListener(MouseEvent.MOUSE_UP, MC6Release);

_this.MC7.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC7.addEventListener(MouseEvent.MOUSE_UP, MC7Release);

_this.MC8.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC8.addEventListener(MouseEvent.MOUSE_UP, MC8Release);

_this.MC9.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC9.addEventListener(MouseEvent.MOUSE_UP, MC9Release);

_this.MC10.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC10.addEventListener(MouseEvent.MOUSE_UP, MC10Release);

_this.MC11.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC11.addEventListener(MouseEvent.MOUSE_UP, MC11Release);

_this.MC12.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC12.addEventListener(MouseEvent.MOUSE_UP, MC12Release);

_this.MC13.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC13.addEventListener(MouseEvent.MOUSE_UP, MC13Release);

_this.MC14.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC14.addEventListener(MouseEvent.MOUSE_UP, MC14Release);

_this.MC15.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC15.addEventListener(MouseEvent.MOUSE_UP, MC15Release);

_this.MC16.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC16.addEventListener(MouseEvent.MOUSE_UP, MC16Release);

_this.MC17.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC17.addEventListener(MouseEvent.MOUSE_UP, MC17Release);

_this.MC18.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC18.addEventListener(MouseEvent.MOUSE_UP, MC18Release);

_this.MC19.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC19.addEventListener(MouseEvent.MOUSE_UP, MC19Release);

_this.MC20.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC20.addEventListener(MouseEvent.MOUSE_UP, MC20Release);

_this.MC21.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC21.addEventListener(MouseEvent.MOUSE_UP, MC21Release);

_this.MC22.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC22.addEventListener(MouseEvent.MOUSE_UP, MC22Release);

_this.MC23.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC23.addEventListener(MouseEvent.MOUSE_UP, MC23Release);

_this.MC24.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC24.addEventListener(MouseEvent.MOUSE_UP, MC24Release);

_this.MC25.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC25.addEventListener(MouseEvent.MOUSE_UP, MC25Release);

resetbutton.addEventListener(MouseEvent.CLICK, reset);

_this.MC1.buttonMode=true;   

_this.MC2.buttonMode=true;   

_this.MC3.buttonMode=true;

_this.MC4.buttonMode=true;

_this.MC5.buttonMode=true;

_this.MC6.buttonMode=true;

_this.MC7.buttonMode=true;

_this.MC8.buttonMode=true;

_this.MC9.buttonMode=true;

_this.MC10.buttonMode=true;

_this.MC11.buttonMode=true;

_this.MC12.buttonMode=true;

_this.MC13.buttonMode=true;

_this.MC14.buttonMode=true;

_this.MC15.buttonMode=true;

_this.MC16.buttonMode=true;

_this.MC17.buttonMode=true;

_this.MC18.buttonMode=true;

_this.MC19.buttonMode=true;

_this.MC20.buttonMode=true;

_this.MC21.buttonMode=true;

_this.MC22.buttonMode=true;

_this.MC23.buttonMode=true;

_this.MC24.buttonMode=true;

_this.MC25.buttonMode=true;

function dragTheObject(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.startDrag();

var topPos:uint=this.numChildren-1;

this.setChildIndex(item, topPos);   

 

function MC1Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();      

if (dz1.hitTestPoint(item.x,item.y)) {

item.x=dz1.x;

item.y=dz1.y;

_this.MC1.buttonMode=false;

_this.MC1.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

 

count++;

}

else {

item.x=orig1X;

item.y=orig1Y;

}}   

 

function MC2Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();  

if (dz2.hitTestPoint(item.x,item.y)) {

item.x=dz2.x;

item.y=dz2.y;

_this.MC2.buttonMode=false;

_this.MC2.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

}

else {

item.x=orig2X;

item.y=orig2Y;

}}   

 

function MC3Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz3.hitTestPoint(item.x,item.y)) {

item.x=dz3.x;

item.y=dz3.y;

_this.MC3.buttonMode=false;

_this.MC3.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig3X;

item.y=orig3Y;

}}

 

function MC4Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();      

if (dz4.hitTestPoint(item.x,item.y)) {

item.x=dz4.x;

item.y=dz4.y;

_this.MC4.buttonMode=false;

_this.MC4.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

}

else {

item.x=orig4X;

item.y=orig4Y;

}}

 

function MC5Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz5.hitTestPoint(item.x,item.y)) {

item.x=dz5.x;

item.y=dz5.y;

_this.MC5.buttonMode=false;

_this.MC5.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig5X;

item.y=orig5Y;

}}

 

function MC6Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz6.hitTestPoint(item.x,item.y)) {

item.x=dz6.x;

item.y=dz6.y;

_this.MC6.buttonMode=false;

_this.MC6.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig6X;

item.y=orig6Y;

}}

 

function MC7Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz7.hitTestPoint(item.x,item.y)) {

item.x=dz7.x;

item.y=dz7.y;

_this.MC7.buttonMode=false;

_this.MC7.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig7X;

item.y=orig7Y;

}}

 

function MC8Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz8.hitTestPoint(item.x,item.y)) {

item.x=dz8.x;

item.y=dz8.y;

_this.MC8.buttonMode=false;

_this.MC8.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig8X;

item.y=orig8Y;

}}

 

function MC9Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz9.hitTestPoint(item.x,item.y)) {

item.x=dz9.x;

item.y=dz9.y;

_this.MC9.buttonMode=false;

_this.MC9.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig9X;

item.y=orig9Y;

}}

 

function MC10Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz10.hitTestPoint(item.x,item.y)) {

item.x=dz10.x;

item.y=dz10.y;

_this.MC10.buttonMode=false;

_this.MC10.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig10X;

item.y=orig10Y;

}}

 

function MC11Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz11.hitTestPoint(item.x,item.y)) {

item.x=dz11.x;

item.y=dz11.y;

_this.MC11.buttonMode=false;

_this.MC11.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig11X;

item.y=orig11Y;

}}

 

function MC12Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz12.hitTestPoint(item.x,item.y)) {

item.x=dz12.x;

item.y=dz12.y;

_this.MC12.buttonMode=false;

_this.MC12.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig12X;

item.y=orig12Y;

}}

 

function MC13Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz13.hitTestPoint(item.x,item.y)) {

item.x=dz13.x;

item.y=dz13.y;

_this.MC13.buttonMode=false;

_this.MC13.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig13X;

item.y=orig13Y;

}}

 

function MC14Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz14.hitTestPoint(item.x,item.y)) {

item.x=dz14.x;

item.y=dz14.y;

_this.MC14.buttonMode=false;

_this.MC14.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig14X;

item.y=orig14Y;

}}

 

function MC15Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz15.hitTestPoint(item.x,item.y)) {

item.x=dz15.x;

item.y=dz15.y;

_this.MC15.buttonMode=false;

_this.MC15.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig15X;

item.y=orig15Y;

}}

 

function MC16Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz16.hitTestPoint(item.x,item.y)) {

item.x=dz16.x;

item.y=dz16.y;

_this.MC16.buttonMode=false;

_this.MC16.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig16X;

item.y=orig16Y;

}}

 

function MC17Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz17.hitTestPoint(item.x,item.y)) {

item.x=dz17.x;

item.y=dz17.y;

_this.MC17.buttonMode=false;

_this.MC17.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig17X;

item.y=orig17Y;

}}

 

function MC18Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz18.hitTestPoint(item.x,item.y)) {

item.x=dz18.x;

item.y=dz18.y;

_this.MC18.buttonMode=false;

_this.MC18.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig18X;

item.y=orig18Y;

}}

 

function MC19Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz19.hitTestPoint(item.x,item.y)) {

item.x=dz19.x;

item.y=dz19.y;

_this.MC19.buttonMode=false;

_this.MC19.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig19X;

item.y=orig19Y;

}}

 

function MC20Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz20.hitTestPoint(item.x,item.y)) {

item.x=dz20.x;

item.y=dz20.y;

_this.MC20.buttonMode=false;

_this.MC20.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig20X;

item.y=orig20Y;

}} 

 

function MC21Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz21.hitTestPoint(item.x,item.y)) {

item.x=dz21.x;

item.y=dz21.y;

_this.MC21.buttonMode=false;

_this.MC21.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig21X;

item.y=orig21Y;

}}

 

function MC22Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz22.hitTestPoint(item.x,item.y)) {

item.x=dz22.x;

item.y=dz22.y;

_this.MC22.buttonMode=false;

_this.MC22.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig22X;

item.y=orig22Y;

}}

 

function MC23Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz23.hitTestPoint(item.x,item.y)) {

item.x=dz23.x;

item.y=dz23.y;

_this.MC23.buttonMode=false;

_this.MC23.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig23X;

item.y=orig23Y;

}}

 

function MC24Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz24.hitTestPoint(item.x,item.y)) {

item.x=dz24.x;

item.y=dz24.y;

_this.MC24.buttonMode=false;

_this.MC24.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig24X;

item.y=orig24Y;

}}

 

function MC25Release(event:MouseEvent):void {

var item:MovieClip=MovieClip(event.target);

item.stopDrag();

if (dz25.hitTestPoint(item.x,item.y)) {

item.x=dz25.x;

item.y=dz25.y;

_this.MC25.buttonMode=false;

_this.MC25.removeEventListener( MouseEvent.MOUSE_DOWN, dragTheObject );

count++;

} else {

item.x=orig25X;

item.y=orig25Y;

}}

 

function checkAnswers(event:MouseEvent):void {

if (_this.dz1.hitTestPoint(MC1.x,MC1.y) &&

_this.dz2.hitTestPoint(MC2.x,MC2.y) &&

_this.dz3.hitTestPoint(MC3.x,MC3.y) &&

_this.dz4.hitTestPoint(MC4.x,MC4.y) &&

_this.dz5.hitTestPoint(MC5.x,MC5.y) &&

_this.dz6.hitTestPoint(MC6.x,MC6.y) &&

_this.dz7.hitTestPoint(MC7.x,MC7.y) &&

_this.dz8.hitTestPoint(MC8.x,MC8.y) &&

_this.dz9.hitTestPoint(MC9.x,MC9.y) &&

_this.dz10.hitTestPoint(MC10.x,MC10.y) &&

_this.dz11.hitTestPoint(MC11.x,MC11.y) &&

_this.dz12.hitTestPoint(MC12.x,MC12.y) &&

_this.dz13.hitTestPoint(MC13.x,MC13.y) &&

_this.dz14.hitTestPoint(MC14.x,MC14.y) &&

_this.dz15.hitTestPoint(MC15.x,MC15.y) &&

_this.dz16.hitTestPoint(MC16.x,MC16.y) &&

_this.dz17.hitTestPoint(MC17.x,MC17.y) &&

_this.dz18.hitTestPoint(MC18.x,MC18.y) &&

_this.dz19.hitTestPoint(MC19.x,MC19.y) &&

_this.dz20.hitTestPoint(MC20.x,MC20.y) &&

_this.dz21.hitTestPoint(MC21.x,MC21.y) &&

_this.dz22.hitTestPoint(MC22.x,MC22.y) &&

_this.dz23.hitTestPoint(MC23.x,MC23.y) &&

_this.dz24.hitTestPoint(MC24.x,MC24.y) &&

_this.dz25.hitTestPoint(MC25.x,MC25.y)) {

               

                if (count >=3)

{

                gotoAndStop(2);

}

} else {

 

}}

function reset(event:MouseEvent):void {

_this.MC1.x=orig1X;

_this.MC1.y=orig1Y;

_this.MC2.x=orig2X;

_this.MC2.y=orig2Y;

_this.MC3.x=orig3X;

_this.MC3.y=orig3Y;

_this.MC4.x=orig4X;

_this.MC4.y=orig4Y;

_this.MC5.x=orig5X;

_this.MC5.y=orig5Y;

_this.MC6.x=orig6X;

_this.MC6.y=orig6Y;

_this.MC7.x=orig7X;

_this.MC7.y=orig7Y;

_this.MC8.x=orig8X;

_this.MC8.y=orig8Y;

_this.MC9.x=orig9X;

_this.MC9.y=orig9Y;

_this.MC10.x=orig10X;

_this.MC10.y=orig10Y;

_this.MC11.x=orig11X;

_this.MC11.y=orig11Y;

_this.MC12.x=orig12X;

_this.MC12.y=orig12Y;

_this.MC13.x=orig13X;

_this.MC13.y=orig13Y;

_this.MC14.x=orig14X;

_this.MC14.y=orig14Y;

_this.MC15.x=orig15X;

_this.MC15.y=orig15Y;

_this.MC16.x=orig16X;

_this.MC16.y=orig16Y;

_this.MC17.x=orig17X;

_this.MC17.y=orig17Y;

_this.MC18.x=orig18X;

_this.MC18.y=orig18Y;

_this.MC19.x=orig19X;

_this.MC19.y=orig19Y;

_this.MC20.x=orig20X;

_this.MC20.y=orig20Y;

_this.MC21.x=orig21X;

_this.MC21.y=orig21Y;

_this.MC22.x=orig22X;

_this.MC22.y=orig22Y;

_this.MC23.x=orig23X;

_this.MC23.y=orig23Y;

_this.MC24.x=orig24X;

_this.MC24.y=orig24Y;

_this.MC25.x=orig25X;

_this.MC25.y=orig25Y;

_this.MC1.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC1.addEventListener(MouseEvent.MOUSE_UP, MC1Release);

_this.MC2.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);  

_this.MC2.addEventListener(MouseEvent.MOUSE_UP, MC2Release);  

_this.MC3.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);   

_this.MC3.addEventListener(MouseEvent.MOUSE_UP, MC3Release);   

_this.MC4.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC4.addEventListener(MouseEvent.MOUSE_UP, MC4Release);

_this.MC5.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC5.addEventListener(MouseEvent.MOUSE_UP, MC5Release);

_this.MC6.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC6.addEventListener(MouseEvent.MOUSE_UP, MC6Release);

_this.MC7.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC7.addEventListener(MouseEvent.MOUSE_UP, MC7Release);

_this.MC8.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC8.addEventListener(MouseEvent.MOUSE_UP, MC8Release);

_this.MC9.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC9.addEventListener(MouseEvent.MOUSE_UP, MC9Release);

_this.MC10.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC10.addEventListener(MouseEvent.MOUSE_UP, MC10Release);

_this.MC11.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC11.addEventListener(MouseEvent.MOUSE_UP, MC11Release);

_this.MC12.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC12.addEventListener(MouseEvent.MOUSE_UP, MC12Release);

_this.MC13.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC13.addEventListener(MouseEvent.MOUSE_UP, MC13Release);

_this.MC14.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC14.addEventListener(MouseEvent.MOUSE_UP, MC14Release);

_this.MC15.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC15.addEventListener(MouseEvent.MOUSE_UP, MC15Release);

_this.MC16.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC16.addEventListener(MouseEvent.MOUSE_UP, MC16Release);

_this.MC17.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC17.addEventListener(MouseEvent.MOUSE_UP, MC17Release);

_this.MC18.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC18.addEventListener(MouseEvent.MOUSE_UP, MC18Release);

_this.MC19.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC19.addEventListener(MouseEvent.MOUSE_UP, MC19Release);

_this.MC20.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC20.addEventListener(MouseEvent.MOUSE_UP, MC20Release);

_this.MC21.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC21.addEventListener(MouseEvent.MOUSE_UP, MC21Release);

_this.MC22.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC22.addEventListener(MouseEvent.MOUSE_UP, MC22Release);

_this.MC23.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC23.addEventListener(MouseEvent.MOUSE_UP, MC23Release);

_this.MC24.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC24.addEventListener(MouseEvent.MOUSE_UP, MC24Release);

_this.MC25.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);

_this.MC25.addEventListener(MouseEvent.MOUSE_UP, MC25Release);

count = 0;

}

 

function itemRelease(event:MouseEvent):void {

var thisItem:MovieClip = MovieClip(event.target);

thisItem.stopDrag();

if (dz1.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz1.x;

thisItem.y = dz1.y;

}

else if (dz2.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz2.x;

thisItem.y = dz2.y;

}

else if (dz3.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz3.x;

thisItem.y = dz3.y;

}

else if (dz4.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz4.x;

thisItem.y = dz4.y;

}

else if (dz5.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz5.x;

thisItem.y = dz5.y;

}

else if (dz6.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz6.x;

thisItem.y = dz6.y;

}

else if (dz7.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz7.x;

thisItem.y = dz7.y;

}

else if (dz8.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz8.x;

thisItem.y = dz8.y;

}

else if (dz9.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz9.x;

thisItem.y = dz9.y;

}

else if (dz10.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz10.x;

thisItem.y = dz10.y;

}

else if (dz11.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz11.x;

thisItem.y = dz11.y;

}

else if (dz12.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz12.x;

thisItem.y = dz12.y;

}

else if (dz13.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz13.x;

thisItem.y = dz13.y;

}

else if (dz14.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz14.x;

thisItem.y = dz14.y;

}

else if (dz15.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz15.x;

thisItem.y = dz15.y;

}

else if (dz16.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz16.x;

thisItem.y = dz16.y;

}

else if (dz17.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz17.x;

thisItem.y = dz17.y;

}

else if (dz18.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz18.x;

thisItem.y = dz18.y;

}

else if (dz19.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz19.x;

thisItem.y = dz19.y;

}

else if (dz20.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz20.x;

thisItem.y = dz20.y;

}

else if (dz21.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz21.x;

thisItem.y = dz21.y;

}

else if (dz22.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz22.x;

thisItem.y = dz22.y;

}

else if (dz23.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz23.x;

thisItem.y = dz23.y;

}

else if (dz24.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz24.x;

thisItem.y = dz24.y;

}

else if (dz25.hitTestPoint(thisItem.x,thisItem.y)) {

thisItem.x = dz25.x;

thisItem.y = dz25.y;

}

else if (thisItem==MC1) {

event.target.x = orig1X;

event.target.y = orig1Y;

}

else if (thisItem==MC2) {

event.target.x = orig2X;

event.target.y = orig2Y;

}

else if (thisItem==MC3) {

event.target.x = orig3X;

event.target.y = orig3Y;

}

else if (thisItem==MC4) {

event.target.x = orig4X;

event.target.y = orig4Y;

}

else if (thisItem==MC5) {

event.target.x = orig5X;

event.target.y = orig5Y;

}

else if (thisItem==MC6) {

event.target.x = orig6X;

event.target.y = orig6Y;

}

else if (thisItem==MC7) {

event.target.x = orig7X;

event.target.y = orig7Y;

}

else if (thisItem==MC8) {

event.target.x = orig8X;

event.target.y = orig8Y;

}

else if (thisItem==MC9) {

event.target.x = orig9X;

event.target.y = orig9Y;

}

else if (thisItem==MC10) {

event.target.x = orig10X;

event.target.y = orig10Y;

}

else if (thisItem==MC11) {

event.target.x = orig11X;

event.target.y = orig11Y;

}

else if (thisItem==MC12) {

event.target.x = orig12X;

event.target.y = orig12Y;

}

else if (thisItem==MC13) {

event.target.x = orig13X;

event.target.y = orig13Y;

}

else if (thisItem==MC14) {

event.target.x = orig14X;

event.target.y = orig14Y;

}

else if (thisItem==MC15) {

event.target.x = orig15X;

event.target.y = orig15Y;

}

else if (thisItem==MC16) {

event.target.x = orig16X;

event.target.y = orig16Y;

}

else if (thisItem==MC17) {

event.target.x = orig17X;

event.target.y = orig17Y;

}

else if (thisItem==MC18) {

event.target.x = orig18X;

event.target.y = orig18Y;

}

else if (thisItem==MC19) {

event.target.x = orig19X;

event.target.y = orig19Y;

}

else if (thisItem==MC20) {

event.target.x = orig20X;

event.target.y = orig20Y;

}

else if (thisItem==MC21) {

event.target.x = orig21X;

event.target.y = orig21Y;

}

else if (thisItem==MC22) {

event.target.x = orig22X;

event.target.y = orig22Y;

}

else if (thisItem==MC23) {

event.target.x = orig23X;

event.target.y = orig23Y;

}

else if (thisItem==MC24) {

event.target.x = orig24X;

event.target.y = orig24Y;

}

else {

event.target.x = orig25X;

event.target.y = orig25Y;

}}

*/

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    August 17, 2023

    you need to convert your code to easejs/javascript.  all your as3 code is commented-out, as is universal when converting from as3 to html5/canvas.

     

    also, i would strongly recommend you learn how to use for loops in coding to reduce your lines of code and make it more readable, less likely for errors and faster to code.  eg,

     

      _this.MC1.visible= false;

                                    _this.MC2.visible= false;

                                    _this.MC3.visible= false;

                                    _this.MC4.visible= false;

                                    _this.MC5.visible= false;

                                    _this.MC6.visible= false;

                                    _this.MC7.visible= false;

                                    _this.MC8.visible= false;

                                    _this.MC9.visible= false;

                                    _this.MC10.visible= false;

                                    _this.MC11.visible= false;

                                    _this.MC12.visible= false;

                                    _this.MC13.visible= false;

                                    _this.MC14.visible= false;

                                    _this.MC15.visible= false;

                                    _this.MC16.visible= false;

                                    _this.MC17.visible= false;

                                    _this.MC18.visible= false;

                                    _this.MC19.visible= false;

                                    _this.MC20.visible= false;

                                    _this.MC21.visible= false;

    _this.MC22.visible= false;

    _this.MC23.visible= false;

    _this.MC24.visible= false;

    _this.MC25.visible= false;

     

    can be written as:

     

    var _this = this;

    for(var i=1;i<26;i++){

    _this["MC"+i].visible = false;

    }

    kristak60753381
    Participant
    August 18, 2023

    Is there an easy way to convert that? I've no clue *how* to do that. 

    kglad
    Community Expert
    Community Expert
    August 18, 2023

    no, there's no automated way to do that.  you would need to know as3 and easeljs/javascript.

     

    i don't think it would it would be difficult to convert your code. eg, i think i could do that in less than 2 hrs.

     

    unfortunately that's longer than i would do for free via the forums, but would be relatively inexpensive if you wanted to hire me.