actionscript 3 - Can't interact with tiles in an interactive jigsaw puzzle (Flash CC AS3) -
i am doing interactive assignment media arts class , have no idea how code in action script 3. took orignal code tutorial , didn't work came here , attempted learn how modify it.
as3 code
//********************* // initialize: flash.events.mouseevent var numpieces = 16; (var = 0; < numpieces; i++) { var piecename = "p" + (i + 1); var piece = this[piecename]; if( piece ){ piece.name = piecename; piece.addeventlistener(mouseevent.mouse_down, function)(evt) { this.scalex = 1; this.scaley = 1; this.shadow = null; this.parent.addchild(this);// bump top this.offset = {x:this.x - evt.stagex, y:this.y - evt.stagey}; }); piece.addeventlistener(mouseevent.mouse_move, function) { this.x = evt.stagex + this.offset.x; this.y = evt.stagey + this.offset.y; }); piece.addeventlistener(mouseevent.mouse_up, function)(evt) { var target = this.parent["t"+this.name.substr(1)]; if( target && hittestinrange( target, 30) ){ this.x = target.x; this.y = target.y; } }); } } function hittestinrange( target, range ) { if( target.x > stage.mousex - range && target.x < stage.mousex + range && target.y > stage.mousey - range && target.y < stage.mousey + range ) { return true; } return false; }
please me fix code can run puzzle , move pieces. i can upload flash file if needed
Comments
Post a Comment