Draggable Triangle
I work as a multimedia developer in higher education, and I have been given the job of coming up qith a solution of creating a triangle that if you drag one corner, the other corners accomodate that pull. So that a triangle which is demonstrating output/money/quality will allow students to pull for example the quality corner as though making quality a priority, and so the result of that pull on the other corners.
Has anybody done anything like this before, or know of any tutorials that offer similar techniques?
Thanks
Lee
Ultrashock Forums > Flash > ActionScript
Posted on: 2006-04-26
View Complete Forum Thread with Replies
Sponsored Links:
3D Triangle
I need a black spinning 3D triangle which revolves around a verticle axis, however my 3D skills are erm...well, non-existant. Does anyone know of a DECENT 3D tutorial or wud be willing to make it for me?
Much appreciated.
View Replies !
View Related
3d Triangle
Looking for a 3d triangle sample. One that you can move around with your mouse and can click on the corners. Tried to find a tutorial but struck out. Any help is appreciated. Thank you in advance.
View Replies !
View Related
Triangle
hey guys!
i have problem creating triangle but i have example for box
this one:
X & initX for the xmouse
Y & initY for the ymouse
Code:
moveTo(initX, initY);
lineTo(X, initY);
lineTo(X, Y);
lineTo(initX, Y);
lineTo(initX, initY);
any idea guys?
View Replies !
View Related
Triangle Engine
wonder if anyone can find the bug in the rotation? To test, make a movieclip with a right triangle 100x100 downward slope (like baseline). thanks! (function call: mTriangle(name, x1,y1,x2,y2,x3,y3)
function len(ax,ay,bx,by)
{
res = Math.sqrt( (ax-bx)*(ax-bx) + (ay-by)*(ay-by) )
return res;
}
function ang (c, a, b)
{
res = (c*c) - (a*a) - (b*b);
res /= (2 * a * b * (-1) );
res = Math.acos(res);
return res;
}
function drawBigT(name)
{
_root[name].attachMovie("rightTriangle","1",_root.depth++);
_root[name].attachMovie("rightTriangle","2",_root.depth++);
h = _root[name].c * Math.sin(_root[name].aB)
_root[name]["1"]._yscale = h;
_root[name]["2"]._yscale = h;
p = _root[name].c * Math.sin( (Math.PI / 2) - _root[name].aB);
q = _root[name].a - p;
_root[name]["1"]._xscale = -p;
_root[name]["2"]._xscale = q;
_root[name].h = h;
_root[name].q = q;
_root[name].p = p;
}
function mTriangle(name, ax,ay, bx, by, cx, cy)
{
_root.attachMovie("buffer",name,_root.depth++);
_root[name]._x = 0;
_root[name]._y = 0;
a = len(bx,by,cx,cy);
b = len(ax,ay,cx,cy);
c = len(ax,ay,bx,by);
if (a >= b && a >= c)
{
max = ax; may = ay;
if (b >= c)
{mbx = bx; mby = by; mcx = cx; mcy = cy;}
else {mbx = cx; mby = cy; mcx = bx, mcy = by;}
}
else if (b >= c)
{
max = bx; may = by;
if (a >= c)
{mbx = ax; mby = ay; mcx = cx; mcy = cy;}
else {mbx = cx; mby = cy; mcx = ax; mcy = ay;}
}
else
{
max = cx; may = cy;
if (a >= b)
{mbx = ax; mby = ay; mcx = bx; mcy = by;}
else {mbx = bx; mby = by; mcx = ax; mcy = ay;}
}
_root[name].a = len(mbx,mby,mcx,mcy);
_root[name].b = len(max,may,mcx,mcy);
_root[name].c = len(max,may,mbx,mby);
_root[name].aA = ang(a, b, c);
_root[name].aB = ang(b, c, a);
_root[name].aC = ang(c, a, b);
drawBigT(name);
_root[name]["1"]._x = max;
_root[name]["2"]._x = max;
_root[name]["1"]._y = may;
_root[name]["2"]._y = may;
// ERROR in rotation calculation alg here
dist = len(mbx, mby, max + _root[name].q, may + _root[name].h);
rot = ang(dist, _root[name].b, _root[name].b) * 180 / Math.PI;
_root[name]["1"]._rotation = rot;
_root[name]["2"]._rotation = rot;
trace("rotation angle: " + rot);
// END ERROR
}
View Replies !
View Related
Triangle Hittest
I'm going insane. I got a triangle "obja" and square "obj1"
In obja:
PHP Code:
onClipEvent (load) {
startDrag(this, true);
}
onClipEvent (enterFrame) {
if (hitTest(_parent.obj1)) {
trace("hit!");
}
}
But this only works on squares... .
View Replies !
View Related
Angles In A Triangle
Im currently on a project which involves calculating the angles in a triangle. However, there is only 1 pt that is fixed, the other 2 pts are fully draggable, which makes the triangle fully determined by the user.
I have done the line creation and the interactivity, but I have no idea of how to calculate all 3 angles. Another can enlighten me?
Many thanks.
Regards
View Replies !
View Related
Rotating A Triangle
I have a triangle. It draw three points.
I want it to follow the mouse.
I was able to do this with a single line but as soon as I added my extra points in went crazy. Where did I go wrong?
ActionScript Code:
package
{
import flash.display.Sprite;
import flash.events.Event
import flash.events.MouseEvent
public class Triangle extends Sprite
{
var points;
var baseWidth;
var baseHeight;
public function Triangle(stage,width,height)
{
init(width,height);
}
public function init(width,height)
{
this.points = new Array();
this.points[1] = [0,-1]
this.points[2] = [0,1]
this.points[3] = [1,0]
this.change_width(width);
this.change_height(height);
this.draw();
this.rotate(-30 * Math.PI / 180);
//addEventListener(Event.ENTER_FRAME, follow_mouse);
}//init
public function change_width(width)
{
this.baseWidth = width;
this.points[1][1] = this.points[1][1] * width;
this.points[2][1] = this.points[2][1] * width;
}
public function change_height(height)
{
this.baseHeight = height;
this.points[3][0] = this.points[3][0] * height;
}
public function follow_mouse(e:Event):void
{
var dx = stage.mouseX - this.x
var dy = stage.mouseY - this.y
var radians = Math.atan2(dy, dx);
rotate(radians);
}
public function rotate(radians)
{
for each(var p in this.points)
{
p[0] = Math.cos(radians) * p[0] - Math.sin(radians) * p[1];
p[1] = Math.cos(radians) * p[1] + Math.sin(radians) * p[0];
}
this.draw();
}
public function draw()
{
this.graphics.clear();
this.graphics.lineStyle(2,0x000);
for each(var p in this.points)
{
this.graphics.lineTo(p[0],p[1]);
}
this.graphics.lineTo(points[1][0],points[1][1]);
}//draw
}//class
}//package
View Replies !
View Related
Triangle Drawing With AS3
OK, so I need someone to please explain this bit of code for me. I plotted the points on paper and I draw a triangle pointing DOWN however when the triangle is drawn it is pointing UP.
ActionScript Code:
var triangleHeight:uint = 8;
var triangleShape:Shape = new Shape();
triangleShape.graphics.beginFill(0x2147AB);
triangleShape.graphics.moveTo(triangleHeight/2, 5);
triangleShape.graphics.lineTo(triangleHeight, triangleHeight+5);
triangleShape.graphics.lineTo(0, triangleHeight+5);
triangleShape.graphics.lineTo(triangleHeight/2, 5);
triangleShape.graphics.moveTo(triangleHeight/2, 5); ->
From what I see since triangleHeigh is '8' then first the shape is moved to point (8/2, 5) = (4, 5) where the drawing begins.
triangleShape.graphics.lineTo(triangleHeight, triangleHeight+5); ->
Then the shape moves to point (8, 8+5) = (8, 13). So the line moves northeast.
triangleShape.graphics.lineTo(0, triangleHeight+5); ->
Then the shape moves to point (0, 8+5) = (0, 13). So the line moves west.
triangleShape.graphics.lineTo(triangleHeight/2, 5); ->
The the line shape moves to point (8/2, 5) = (4, 5). So the line moves south east.
So the code above in my eyes makes a triangle pointing down however in my app it points up! Help!
View Replies !
View Related
Drawing A Triangle. Help Please
Hi;
I have a prototype which draws a triangle. I want to know how can I use this in an onEnterFrame function to see the drawing on the screen?
Just like a triangle been drawn on the screen. The code:
ActionScript Code:
MovieClip.prototype.drawTriangle=function(ab, ac, angle, rotation, x, y){
angle=Math.degToRad(angle);
rotation=Math.degToRad(rotation);
var bx=Math.cos(angle-rotation)*ab;
var by=Math.sin(angle-rotation)*ab;
var cx=Math.cos(-rotation)*ac;
var cy=Math.sin(-rotation)*ac;
var centroidX= (cx+bx)/3-x;
var centroidY= (cy+by)/3-y;
this.moveTo(-centroidX,-centroidY);
this.lineTo(cx-centroidX, cy-centroidY);
this.lineTo(bx-centroidX, by-centroidY);
this.lineTo(-centroidX,-centroidY);
}
View Replies !
View Related
Manipulate Triangle
For the past two days I have been searching google looking for a tutorial to do the follow, but have not been able to find the right combination of search words to get what I need. I was hoping someone here could point me to the right direction.
What I want to do is have a triangle on the screen and to the side of that triangle three sliding bars where each one controls one side of the triangle. So if I slide one bar to the right it will increase the length of one side of the triangle.
And I am a complete novice so this could be extremely easy (which I hope), but right now I have no clue what to do.
View Replies !
View Related
Triangle From Mouse
i want to make a tiangle appear from the mouse like the first pic on this site
[IMG]http://www.actionscript.org/tutorials/advanced/Mouse_Angle_Detection_II/index.shtml[IMG/]
this is the code im using :
onClipEvent(enterFrame){
clear()
lineStyle(1,0,100)
MoveTo(this._x,this._y)
lineTo(_xmouse,_ymouse)
lineStyle(1,0,100)
MoveTo(_xmouse,_ymouse)
lineTo(_xmouse,200)
lineStyle(1,0,100)
MoveTo(275,200)
lineTo(_xmouse,200)
}
but i dont know why it isnt working? does anybody else ?
View Replies !
View Related
Finding Angles On A Triangle
I'm trying to asign a value to the _rotation of an MC based on it's trajectory. Insted of confusing everyone with a bad discription of what I need, theres a picture of it here: http://www25.brinkster.com/nippashish/triangle.html
It's preaty self explanitory, what Im basicly looking for here is a formula.
View Replies !
View Related
Triangle Drag Area
Does anyone know how to contrain a drag area to the shape of a triangle? I figure running the coordinates of the mc being dragged through a formula that checks to see if the the dragged movie is still in the triangle area would work, but I have no idea what the proper calculations are.
Thanks in advance for any help!
View Replies !
View Related
Making A Rotating Triangle?
I'm trying to make a simple rotating equilateral triangle with Flash 5, but I'm having lots of troubles getting it to rotate smoothly.
I want the triangle to rotate around its center of mass. I drew the triangle with Flash and did the motion-tween/rotate thing (rotating through 120 degrees), but it's always off by a pixel or two on the last keyframe so that when the animation loops, the whole triangle does an ugly shift of one or two pixels before rotating again. I've tried nudging the last keyframe every which way but nothing seems to really work.
Any tips on how to make this work? Thanks in advance.
View Replies !
View Related
Drawing Lines For A Triangle
Well yes. That's basically it. I have 3 circles that automatically form a triangle wherever they are dragged to, but I want 3 lines to be drawn to make a triangle. I've tried stuff like lineTo and moveTo, but it just stays there after every frame and I can't remove it with removeMovieClip();
so..... it would help if someone would just say how to draw a line every frame, from 1 circle to the other, assuming 1 circle was "_root.ball1" and the other "_root.ball2". And also so it would remove the last line drawn. I'm pretty sure it's not that hard, just I don't know what to do.
Cheers.
View Replies !
View Related
Elearning Triangle Problem
I have created a muliple choice triangle (see attached file) but its not working as it should. The movie will sit in a html page which contains a variable called correctans. The movie should spit out a score dependant on the users decision and the correct answer. Any ideas?
View Replies !
View Related
Square/Triangle Maker
I want the user to be able to make a square and a triangle (click buttons to switch between the 2 modes, I already have a drawing button) then rub them out. (rub out any piece of the shape without the whole shape disappearing.
Thanks!
View Replies !
View Related
Draw A Triangle Dynamically? Help
Hi Guys!
im needing to draw a triangle that changes its shape dynamically over time. im wanting each point to stick to a specific mcs x and y however i somehow end up with 4 points rather then the 3 that i thought i was gonna get.
how do i get rid of the fourth static point so that all the others can move freely?
cheers!
Code:
function drawRectangle():MovieClip{
var clip:MovieClip;
clip = _root.createEmptyMovieClip("clip" + 0, 0 );
clip.beginFill(0xFFFFFF)
clip.lineTo(_root.target1._x, _root.target1._y);
clip.lineTo(_root.target2._x, _root.target1._y);
clip.lineTo(_root.target3._x, _root.target3._y);
clip.endFill();
clip._x = 100;
clip._y = 100;
return clip;
}
drawRectangle()
View Replies !
View Related
Volume Control Triangle
Hi all!
I'm currently working on a Flash mp3 player, and was wondering if you guys could help me find some tutorials or give me some pointers on how to create a basic volume control triangle for controlling the volume of the audio. I want to create something like the one at the top of this site:
http://www.apocalyptica.com/
I found many tutorials on how to make a volume control using a slider and a draggable "thumb", but could not find any on how to make one that uses a triangle. I've got all the playback functions working, and having a triangle volume control would be the cherry on top!
Thanks in advance,
tbeanz
View Replies !
View Related
Triangle HitTest Problem
i have 2 triangle movieclips on stage, i use startDrag to hitTest another with different angle, but flash will treat the triangle as rectangle. So i get the signal to tell me they are hitTest when i make them closer from 45 degree, but haven't touch each other...so how can solve this problem???
Sorry, my english are very poor. Hope you can understand what i mean
View Replies !
View Related
Height Being Drawn In A Triangle
I have this triangle drawn (see fla)(Got it from this forum).
Now I want a height being drawn as well.
I want a height from point A beeing drawn to BC
The angle at BC must be 90 degrees of course and the height drawn must alter when I drag the points B and C.
Is this possible to do in flash, I have seen it done in JAVA
View Replies !
View Related
Mouse Coordinates Over A Triangle
Hi Friends,
I need to make a tool where as you mouse over a triangle it displays the percentage of proximity to each of the triangle's three corners. Then, when clicked, it places a dot on that spot and the corresponding percentage values are sent to a web form. Please help! I am even willing to pay someone if you can help with this.
willstone06 @ gmail.com
View Replies !
View Related
Calculate Angles Of A Triangle
Hi all, I'm quite new at Actionscript.
Does anyone know the best method to calculate the angles of a triangle? Or have any good references? I have 3 points which can be moved when the user drags on it, so the angles will have to change accordingly.
Thanks in advance! (:
View Replies !
View Related
Triangle Restricted Drag
whats the best way to restrict a draggable object to a non-rectangular shape (like triangle)
I did it with hittest but i cant get it to go to the nearest point when the cursor is outside the shape...
Thanks
View Replies !
View Related
Height Being Drawn In A Triangle
I have this triangle drawn (see fla)(Got it from this forum).
Now I want a height being drawn as well.
I want a height from point A beeing drawn to BC
The angle at BC must be 90 degrees of course and the height drawn must alter when I drag the points B and C.
Is this possible to do in flash, I have seen it done in JAVA
View Replies !
View Related
Draggable Item On A Draggable Mask
hello, i was trying to make a sniping game, and i can get the mask to drag. but i want crosshairs and it won't appear in the mask, so i put it on a diff. layer and it still won't work. has anyone had this same problem, and if so, please help me.
View Replies !
View Related
Dynamic Triangle Fill (no Mask )
I'm new to AS so bear with me
I wanted to make some weird fractal image by dynamically creating triangles. I have it down to a process where given 3 [random] points, the function will dynamically build a triangle to be the right size though it will not rotate and go into the right position. I have lost scope and having mono isn't helping my concentration so I was wondering if anyone around would be willing to help finish this off? I can post the code in here if wanted..
thanks,
entro
View Replies !
View Related
My Ship Dissapears Bermuda Triangle?
I am currently working on a game where a submarine shoots at some ships.
Problem are that the ships dissapear after i shot like 1000 rocket (1 rocket is 1 movieclip duplicated, same with the ships)
Im suspecting that each movieclip that is duplicated gets an ID, its just like i get out of IDs, and that the programm start to skip the IDs started at the beginning.
Why does this happends? What can i do to avoid it?
Catching me? or am i talking in my hat?!
Thanks!
View Replies !
View Related
Geometry: Finding Area Of Triangle
I'm trying to find the area of a triangle given the lengths of the sides; I'm using Heron's formula, which is:
To get the half perimeter first:
s = (a+b+c)/2 -where a, b, c are the lengths of the sides
Then to get the area:
"Then you multiply this number (s) by three other numbers - the semi-
perimeter minus each of the three sides in turn - and take the square
root of the result" --from Dr.Math
A = sqrt(s(s-a)(s-b)(s-c))
But how would you express this formula into actionscript??? I've got something working, see below, but I believe I'm getting the wrong answer, it comes out too low.
Here's what I have so far:
Code:
var a:Number = Math.sqrt(Math.pow((point1._x - point2._x), 2)+Math.pow((point1._y - point2._y), 2));
var b:Number = Math.sqrt(Math.pow((point2._x - point3._x), 2)+Math.pow((point2._y - point3._y), 2));
var z:Number = Math.sqrt(Math.pow((point3._x - point1._x), 2)+Math.pow((point3._y - point1._y), 2));
trace("a is: "+ a);
trace("b is: "+ b);
trace("z is: "+ z);
s = (a+b+z)/2; // to get the perimeter...
trace("s is: "+s);
// I know this is convoluted is hell, but I want to make sure everything is calculated
// to what I think the proper order is...
p=s-a;
q=s-b;
r=s-z;
m=s*p;
n=m*q;
o=q*r;
trace("o is: "+o);
triArea = Math.sqrt(o);
trace(triArea);
But I get a really small number at the end of this which is why I think what I've done is incorrect. Any advice? Thanks!!
View Replies !
View Related
Positioning Elements Inside Triangle
I want to develop a Christmas tree, how can i populate this triangle with elements dinammicaly loaded from the library?...the code so far..
<code>
for(var i:Number =0; i<MenuArr.childNodes.length ;i++){
var star:MovieClip = _root.attachMovie("estrella","star"+i,_root.getNex tHighestDepth());
star.starId = MenuArr.childNodes[i].attributes.id;
star.nombre = MenuArr.childNodes[i].attributes.nombre;
star.texto = MenuArr.childNodes[i].attributes.texto;
//Posicionamiento.
star._x = randRange(coordenadas[3], coordenadas[2]);
star._y = randRange(coordenadas[1], coordenadas[0]);
if(landing_mc.hitTest(star)){
//star._alpha = 20;
};
};
function boundsLanding():Void{
var bounds_obj:Object = landing_mc.getBounds(this);
for (var i in bounds_obj) {
coordenadas.push(bounds_obj[i]);
};
};
//Random a partir de un RANGO.
function randRange(min:Number, max:Number):Number {
//trace(min); trace(max);
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
};
</code>
txs in advance!
View Replies !
View Related
Figuring The Internal Angles Of A Isoceles Triangle
this script just creates random isoceles triangle using the reference angles of the unit circle
my question now is how do i find the interior angles of the triangle
another way to look at it would be how to find the interior angles of a triangle inscribed in a unit circle
the lenght unit circle values give you something 2 work with i guess...
i tryed applying sin/cos laws...
im sure the solutions probably easy i guess... i just dont know what it is so if you have any references etc you could refer to me please post them
and thank you in advance...
randomRad = random(360)
_root.createEmptyMovieClip ("triangle", 1);
with (_root.triangle){
for(var i = 0; i < 2; i++){
beginFill (0xFFFFFF, 50);
lineStyle (5, 0x000000, 100);
randomTheta = random(360)
theta = randomTheta + 360
radius = randomRad
polarTheta = (Math.PI * theta)/180
x = radius*Math.cos(theta)
y = radius*Math.sin(theta)
a = lineTo(x,y)
endFill();
}
setProperty(_root.triangle,_x,200)
setProperty(_root.triangle,_y,200)
}
note the script also has a glitch im uncertain of how to fix sometimes it will draw a line which has something to do w/ the randomTheta values drawn so i also need help w/ that b/c i tried constraining the random values between two values but i dont understand it enough to solve the problem
View Replies !
View Related
[MX04] Disclosure Triangle And Other Treeview Icons
I am looking for disclosure triangles ( preferably written in actionscript ) that I can use. I need it for a listview navigation I am writing. I would like one that animates like the OSX finder does. I was hoping someone had that written. I will also need various other listview icons.. if someone has already created that wheel and is willing to share, please let me know.
thanks.
View Replies !
View Related
Calculate The Points Of An Isosceles Triangle Using The Sides
-- edit // I meant to say calculate the 'angles' of an isosceles triangle using the sides (not points) // --
Ok, I'm going to kind of step-by-step this one and post as I come up with new info.
Basically, an isosceles triangle has 2 equal sides and the 3rd side is of a different length and called a hypotenuse. This also means that there are always 2 equal angles and a third angle which is different from the other 2.
I've gotten as far as calculating the length of one of the lines that is the same as the other and using that I can calculate the hypotenuse.
(sameLineLength is the length of my equal lines.)
Code:
solveIsoscelesHypotenus = int(Math.sqrt(2*(sameLineLength*sameLineLength))*100)/100;
Ok great. So now I have calculated all 3 sides of my isosceles.
Using this, I can calculate the 3 angles of the triangle. Solve using SSS (side, side, side)...
I have looked up some formulas to do this:
http://www.teacherschoice.com.au/Mat...e_trig_SSS.htm
Now as you can see, the formulas are pretty clear. But when I try to plug them in, I'm getting some wacky numbers that don't make sense so obviously I'm doing something wrong.
My hunch is that somewhere along the way my conversions from radians to degrees and such isn't working the way they should with the cos and sin formulas.
Can someone help me to translate those formulas into as3 as something flash can understand as a formula? If I could get the proper answer in degrees it would be great. I will post more as it comes to me. cheers.
View Replies !
View Related
AS3 - Generate Random Coordinate Inside Of Triangle
I'm trying to generate random coordinates in a triangle based on the equation I found here: Random_Point_In_Triangle
P = aA + bB + cC
where P is my random point
A,B,C are the points of the triangle
a,b,c are 3 random numbers between 0 and 1 that add up to 1
But I'm having trouble figuring out how to generate 3 random numbers that add up to 1.
Here is what I've come up with, but it seems funky and I'm sure there's a better/correct way:
ActionScript Code:
var a:Number = Math.random();
var b:Number = Utils.randRange( a, 1 );
var c:Number = (1 - b) - a;
Thoughts?
View Replies !
View Related
Drag The Corners Of An Triangle The Sides And The Angles Alter
Hi!
I want to do a triangle so when you drag the corners the sides and the angles alter and you can show the degrees and lengths. Just like this website. If someone can show me a tutorial for this I would be most greatful.
I have written to another forum but didnīt get any tips. Hope I am more lucky here.
http://thesaurus.maths.org/mmkb/ent...ode=en&expand=0
View Replies !
View Related
How Do You Use The Matrix Object To Transform A Triangle To 3 Target Points?
I'm still tyring to get a grasp on some 3d rendering techniques, a big thankyou to all who have helped already (via replies or other threads I've read).
I've been using the drawing API with good rendering results but slow rendering times, so I want to start using bitmaps. I've been using quads, and the only way I can think of to render them with bitmap.draw() is to split them into triangles and use a matrix object to transform them appropriately.
So I create two bitmaps, topLeft and bottomRight, with the appropriate triangles drawn in them at 100x100. (I hope to have this be the only time the drawing api is used, draw the triangles in mc then draw to bitmap).
I've been experimenting with the matrix object, and am close, but I'm having difficulty transforming the triangle to the three target vertices. I've spent a couple of hours googling it, and I've found tons of tutorials/articles on how to transform a random triangle to a right triangle for distortion effects (sandy etc), but I need the reverse. I'm thinking I may need to apply multiple matrix transforms instead of doing it in one matrix object, but I'm not sure.
So, given four points and the two triangles mentioned, how do you use the matrix object to rotate, scale, and skew properly to acheive the target vertices? Here's where I'm at now:
PHP Code:
createEmptyMovieClip('tl',_root.getNextHighestDepth());
with(tl){lineStyle(1,0x000000,0);beginFill(0x00ff00);lineTo(100,0);lineTo(0,100);lineTo(0,0);endFill();}
var topLeft=new flashBitmapData(100,100,true,0x00000000);
topLeft.draw(tl);
removeMovieClip(tl);
createEmptyMovieClip('br',_root.getNextHighestDepth());with(br){lineStyle(1,0x000000,0);beginFill(0x00ff00);moveTo(100,0);lineTo(100,100);lineTo(0,100);lineTo(100,0);endFill();}
var bottomRight=new flashBitmapData(100,100,true,0x00000000);
bottomRight.draw(br);
removeMovieClip(br);
var fieldMap=new flashBitmapData(Stage.width,Stage.height,true);
createEmptyMovieClip('field',_root.getNextHighestDepth());
field.attachBitmap(fieldMap,field.getNextHighestDetph());
// startx,starty = upper left point
// nextX,nextY = upper right point
// nextBx,nextBy = lower right point
// BX,BY = lower left point
topLeftMatrix = new flashGeomMatrix( (Math.max(nextX,nextBx)-Math.min(startx,BX))/100, (Math.max(BY,nextBy)-Math.min(starty,nextY))/100, (startx-BX)/100, (Math.min(nextY,starty)-Math.max(BY,nextBy))/100, startx, starty );
fieldMap.draw(topLeft,topLeftMatrix);
bottomRightMatrix = new flashGeomMatrix( (Math.max(nextX,nextBx)-Math.min(startx,BX))/100, (BY-nextBy)/100, (nextX-nextBx)/100, (Math.min(starty,nextY)-Math.max(BY,nextBy))/100, startx, starty );
fieldMap.draw(bottomRight, bottomRightMatrix);
View Replies !
View Related
Drag The Corners Of An Triangle The Sides And The Angles Alter
Hi!
I want to do a triangle so when you drag the corners the sides and the angles alter and you can show the degrees and lengths. Just like this website. If someone can show me a tutorial for this I would be most greatful.
I have written to another forum but didnīt get any tips. Hope I am more lucky here.
http://thesaurus.maths.org/mmkb/ent...ode=en&expand=0
View Replies !
View Related
3d And REAL Shading (Gouraud Shading A Triangle)
I'll ask it quite simple:
There is a triangle movie clip with vertices A (0, 0); B (256, 0); C (0, 256)
Each vertex has some color (e.g., A - red, B - green, C - blue).
I need to shade the entire area of this triangle by interpolating between these 3 colors.
Something like a gradient, but it has 3 vertices, not 2 like a linear one.
I tried two ways:
1) create a 256x256 BitmapData, attach it to my clip and shade the triangle in bitmap,
manually (just like people were programming 3d graphics before opengl&direct3d).
this works, but is very slow (of course).
2) create a 2x2 or 3x3 or some other lilttle square bitmap, shade it then scale it to 256x256
with smoothing option (attachBitmap's argument) enabled. this works quite fast and looks almost
right but not quite right.
I also thought on how to accomplish this with a gradient (maybe several gradients), but no ideas...
You can check out my code at: http://heilong.oceanography.ru/flash/lab/
View Replies !
View Related
More Than Just A Draggable Map
All I need here is just a small push in the right direction and I am sure it will all click.
I have been looking for some time to get a map that I am going to use for navigating through a site, to drag on both the _x and _y axes. however rather than just creating a dragabble MC I was hoping to have a controller to make the animation look that much smoother. Has anyone seen a good tutorial or example to assist me or can recommend a solution.
Any response are greatly appreciated.
View Replies !
View Related
Draggable Help
problem:
i want to have a toolbar where you click the button, a movie clip will appear, and the user can drag it to any location they want.
Extra Credit:
in a perfect world, i would love to have a save button, that would save where the user placed these movie clips as a seperate swf file.
anyone that can help please do so...
thanks!
View Replies !
View Related
Draggable Nav Bar
ive made nav bar which i want to be draggable on my site, i made the background, then the buttons, grouped them as a movie clip and gme them the actions
onClipEvent (mouseDown) {
this.startDrag(true);
}
onClipEvent (mouseUp) {
this.stopDrag();
}
the problem is when people click one of the buttons it picks up the nav bar to be dragged and also when some clicks anywhere on the screen, the bar jumps there. how can i limit the bar from moving to only when its clicked on it a certain place and not the buttons or any random place on the page?
View Replies !
View Related
|