• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

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
0
maeve100
Asked:
maeve100
  • 2
  • 2
1 Solution
 
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?

0
 
maeve100Author Commented:
By the point its pulling :-)
0
 
SamuelRostolCommented:
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() {
  this.startDrag();

  _root.onEnterFrame = function() {
      redrawSquare();
  }
}
p1.onRelease = function() {
  stopDrag();
  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 :)
0
 
SamuelRostolCommented:
The answer given by myself is sufficient as an answer to this topics question.

I hope I will get credit for my participations :)

Kindly,
Samuel
0
 
maeve100Author Commented:
I apoligize, I have been caught up in other things and totally forgot about it.  Thank you for your help :-).
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now