Pull and Strech a Shape

Hi there - I want to make a simple Flash Movie with a shape on it (say a square) that would allow the cursor to pull and strech and deform the square.  I could have designated strech points (say the corners) that someone could pull to make a corner bigger, slanted, etc. Or however would be the best way to deform the shape :-).  In the furture that shape could become something more complex, but for now a simple shape might be easier to start with.

Thank you :-)  Liz
Who is Participating?
SamuelRostolConnect With a Mentor Commented:
Shouldn't be too difficult in principle

If it's a square;

1. Create four small circles, place them in a square.
2. Name them p1-p4.
3. Read about the moveTo and lineTo function in Flash, and create lines from p1 to p2, p2 to p3, p3 to p4 and p4 to p1 - you now got a square.

4. Then, do something like this:

p1.onClick = function() {

  _root.onEnterFrame = function() {
p1.onRelease = function() {
  delete _root.onEnterFrame

5. Copy these for the other three buttons.

6. Then you create a function,

function redrawSquare() {
    // remove the four lines
    // draw them again with the new coordinates from p1-p4

That is the basics, I believe. I'll not give you the whole deal, because then you will not learn something yourself :)

Hope that's allright.

Btw - this will also work with more complex shapes, and if you really get into it, you should be able to do it with curved lines as well :)
MontoyaProcess Improvement MgrCommented:
are you looking to pull and stretch from the corners and sides, or are you expecting to stretch by the point by which it's pulling?

maeve100Author Commented:
By the point its pulling :-)
The answer given by myself is sufficient as an answer to this topics question.

I hope I will get credit for my participations :)

maeve100Author Commented:
I apoligize, I have been caught up in other things and totally forgot about it.  Thank you for your help :-).
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.