0
votes
graphics.drawCircle(20, 20, 10);
graphics.drawCircle(40, 40, 20);

so lets say i've been created two circles in the stage, now i want to create a bone object to connect the first circle to another and then try to move them in the code, because i've readed that the bones can only be created by the BONE tool in adobe flash is that true?

can you give me a little example on how to create a bone object in the code?

1
You can create a similar effect using a physics engine that utilizes joints/constraints. Take a look at the first example demo here: box2dflash.sourceforge.net - Marty
ohhh that cool, but for some reason i can't download it, its stop downloading after 91% complete :D - Mister PHP
Google Box2D AS3, there are various sources to download from. - Marty
yeah its all right, downloaded successfull - Mister PHP
Awesome, this tutorial will help you with what you're trying to do: blog.allanbishop.com/box2d-2-1a-tutorial-part-2-joints - Marty

1 Answers

0
votes

Above code is AS3 right?

  • Set any desired object on the stage (in your .fla)
  • right-click and click convert to symbol.. in the menu
  • Select the type to be a movieclip from the drop-down box
  • Then give it a name (let's say Bone1 for instance, mind the capital B) and check the box export for Actionscript. Make sure the name that you see below matches the name you entered at the top of the window. Click ok.
  • Now the Actionscript part. Make a var for every MovieClip you made like so:

.

var bone1:Bone1 = new Bone1;

or

 var somename:Bone1 = new Bone1;

Both are the same, I simply used two examples to show the the possibilities (first one is usually how I do it). Difference between uppercase and lowercase letters is crucial!