Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only Expert

Status
Not open for further replies.

TACUSTER

Technical User
Mar 25, 2001
1
UY
As we all know, we can set in Flash positions and scales of any .swf that we want to load in your main .fla

Having four variables (Xscale, Yscale, Xpositoin, Yposition) we can determine the area of the .swf (length by width) and where we want to place it. This is my problem: it is always a polygon of four sides (it can be a rectangle or a square) but always with angles of 90°, right?

If I have the four variables, is it possible to obtain larger or smaller angles than the one of 90°?

Mathematically (and here I recede to my acknowledgements from high school) this is possible but I have problems to apply a formula for Flash; I do have some ideas on how to get started on but not on how to develop it in Flash.

I know that you are probably asking yourselves the same question: what do you want this for?

Well, after seeing the poor performance of some programs as Swift3D and its “brothers”, handling with polygons, I realized that if I want to work with 3D I will have to do it through perspective drawings (even more as when someone designs environments in 3D). At that point I get stuck because I have to design something more or less like a “screen” but seeing it as perspective and also bring a .swf and visualize it in the screen.

The “screen” will be drawn as a perspective (that is an irregular polygon) but the .swf that I see on screen is not a perspective.

This is the reason why I am asking the Forum to see if we can develop this all together. I know this is very complicated but at the same time it has lots of benefits and many possibilities of developing other things, if the four angles of the .swf can be set.

Well, I have stated my Thesis/Hypothesis or Hypothesis/Thesis of this THEOREM (yes, in capital letters). I hope we can demonstrate this all together. Thank you.
 
This is a problem I've been scratching my head about for a while. There's a lot of info out there on how to get perspective with lines, fair enough, but when you get to the subject of polygons/planes everyone turns their back and throws a swift3d link (yawn). There's no doubt that this is possible in Flash, just needs a post like yours to summon everyone from the depths and pull together.

I'd be happy to spend time on this one with you, and hope that there's a lot of response on this from everyone.

dave
davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Sitting working away on ACAD, just had probably the biggest brainwave since my beginnings in flash. This problem seems SO possible (well, maybe I'm being over-enhusiastic)that it's almost laughable in it's simplicity (he says with gusto, though he fears the mocking laughter of a non-convinced audience). If it wasn't for the past two days brain-numbing action-crunching with the 'draw' fla, I probably wouldn't have got it either.

At work, so will test and post the theory later on.

What's your name by the way Tacuster?

dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
ok, I had about ten spare minutes last night to throw something together and test the basics and it worked, albeit on a basic level thus far.

Consider a polygon, whatever shape, and think of it in terms of right angled triangles. Every polygon can be created with right angled triangles, here's a sample list:

square (2 triangles)
rectangle (2)
isoceles triangle (2)
scalene triangle (2)
parallelogram (4)

etc, etc

now, imagine you have your 'wall' (rectangle) and you're standing at one end looking down it's length. You see a 4-sided polygon with one vertical edge (closest and largest) going down to another vertical edge (furthest away and smallest). If you take the small vertical as the edge of a rectangle, and draw horizontal lines from the top and bottom of this edge to the 'closest' vertical edge, you'll see that the 'perspective' rectangle is simply a rectangle (containing 2 trianlges) with a triangle on top and a triangle on the bottom.

With this in mind we can now manipulate the 'rectangle' knowing now that it is made of 4 rectangles. To have a plain rectangle (ie: no perspective, facing it head-on) we just set the y-scale of the upper and lower rectangles to '0'.

Here is where I got to in my brief test last night. I made a movie-clip containg a right-angled triangle of dimensions 100w x 100h and dragged four copies of the mc onto the main stage. Rotate the triangles accordingly on the main stage such that you have a 4-sided polygon, one vertical edge 3 times the height of the other (square in middle, triangle top-and-bottom). Name the instances (top, mid1, mid2, bottom). Create a button:

On (press)
setproperty (/top, _xscale) = (getproperty(/top, _xscale)+10)
setproperty (/mid1, _xscale) = (getproperty(/mid1, _xscale)+10)
setproperty (/mid2, _xscale) = (getproperty(/mid2, _xscale)+10)
setproperty (/bottom, _xscale) = (getproperty(/bottom, _xscale)+10)
End (on)

Forgive me if the syntax is wrong. This button now gives the effect of a perspective wall (albeit very basic just now, but proving the underlying principles). Tonight, I'll try and spend some more time on it and make it do all the work itself including 'real' perspective.

dave
davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top