actionscript 3 - How to re size a circle by dragging its child holder on it? -


i want resize circle dragging child holder movieclip, can body tell me how in as3.its transforming movielcip

here code far:

var pupil:movieclip=new movieclip(); var holder:movieclip=new movieclip();  pupil.graphics.linestyle(1, 0x000000); pupil.x = pupil.y = 100; pupil.graphics.beginfill(0xff0000, .1); pupil.graphics.drawcircle(0, 0, 20); pupil.graphics.endfill();  holder.graphics.beginfill(0xff0000); holder.graphics.drawcircle(pupil.width/2,0, 4); holder.graphics.endfill();  addchild(pupil); pupil.addchild(holder);  holder.buttonmode = true; 

try below code hope need.

import flash.events.mouseevent; import flash.geom.point; import flash.events.event;  var pupil:movieclip=new movieclip(); var holder:movieclip=new movieclip(); var newpoint:point = new point();  var dist:number;  pupil.graphics.linestyle(1, 0x0000ff); pupil.x = pupil.y = 100; pupil.graphics.beginfill(0x0000ff, .1); pupil.graphics.drawcircle(0, 0, 50); //pupil.graphics.endfill();  holder.graphics.beginfill(0xff0000); holder.graphics.drawcircle(0,0, 5); holder.graphics.endfill();  holder.x = pupil.width/2;  addchild(pupil); pupil.addchild(holder);  holder.buttonmode = true;  holder.addeventlistener(mouseevent.mouse_down, onholderclikded); holder.addeventlistener(mouseevent.mouse_up, onholderreleased); function onholderclikded(eve:mouseevent):void{      holder.startdrag();       addeventlistener(event.enter_frame, onpointmoving)  }  function onpointmoving(eve:event):void{      newpoint.x = holder.x;     newpoint.y = holder.y;     dist = point.distance(new point(0,0),newpoint.clone());     pupil.graphics.clear();     pupil.graphics.linestyle(1, 0x0000ff);     pupil.graphics.beginfill(0x0000ff, .1);     pupil.graphics.drawcircle(0, 0, dist); }   function onholderreleased(eve:mouseevent):void{     holder.stopdrag(); } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -