02102007, 04:15 PM

#1

Registered User
Join Date: Aug 2006
Posts: 41

Draw a curve between two points
hi can u help me with my problem?i want to add a function that draw a curve actually a masked curve between 2 points when i give it the x,y coordinates please help me,or at least tell me where to start from.I am biulding a dynamic map and after choosing the destination from the combobox i would like to add a curve between the 2 places,it is imposible to do it manually coz i need more than 900 animation!! please help



02102007, 04:40 PM

#2

it's all about patience
Join Date: Jun 2005
Location: istanbul
Posts: 6,696

From Flash help:
ActionScript Code:
this.createEmptyMovieClip("circle_mc", 10);
circle_mc._x = 100;
circle_mc._y = 100;
drawCircle(circle_mc, 100, 0x99FF00, 100);
function drawCircle(target_mc:MovieClip, radius:Number, fillColor:Number, fillAlpha:Number):Void {
var x:Number = radius;
var y:Number = radius;
with (target_mc) {
beginFill(fillColor, fillAlpha);
moveTo(x+radius, y);
curveTo(radius+x, Math.tan(Math.PI/8)*radius+y, Math.sin(Math.PI/4)*radius+x, Math.sin(Math.PI/4)*radius+y);
curveTo(Math.tan(Math.PI/8)*radius+x, radius+y, x, radius+y);
curveTo(Math.tan(Math.PI/8)*radius+x, radius+y, Math.sin(Math.PI/4)*radius+x, Math.sin(Math.PI/4)*radius+y);
curveTo(radius+x, Math.tan(Math.PI/8)*radius+y, radius+x, y);
curveTo(radius+x, Math.tan(Math.PI/8)*radius+y, Math.sin(Math.PI/4)*radius+x, Math.sin(Math.PI/4)*radius+y);
curveTo(Math.tan(Math.PI/8)*radius+x, radius+y, x, radius+y);
curveTo(Math.tan(Math.PI/8)*radius+x, radius+y, Math.sin(Math.PI/4)*radius+x, Math.sin(Math.PI/4)*radius+y);
curveTo(radius+x, Math.tan(Math.PI/8)*radius+y, radius+x, y);
endFill();
}
}
// I have added the following
my_mc.setMask(circle_mc);
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com



02102007, 04:55 PM

#3

Registered User
Join Date: Aug 2006
Posts: 41

thanx 4 answer but will u further explain what this code will work in? and where do i add it



02102007, 05:20 PM

#4

Registered User
Join Date: Aug 2006
Posts: 41

To MR.inhan
thanx for answering my previois thread but maybe u miss understood me i would like to draw a curve between 2 known points not a circle how can i do that u can visit : http://www.ryanair.com/site/EN/dests.php?flash=chk so that u might get what i mean



02102007, 06:07 PM

#5

it's all about patience
Join Date: Jun 2005
Location: istanbul
Posts: 6,696

This script creates an empty movie clip named "circle_mc" in depth 10, locates it in (100,100) coordinates, then in this mc it creates a circle with dimensions 100x100px.
In the last lines I assumed the instance name of the mc you want to be masked by this circle is "my_mc" and masked that with the "circle_mc".
This script is located in the frame (actions) where you want to create the masking process.
What, in this code, actually defines the radius of the circle is:
drawCircle(circle_mc, 100, 0x99FF00, 100);
and what defines the _x/_y pos is:
circle_mc._x = 100;
circle_mc._y = 100;
If you don't want an absolute circle but an ellipse, you need to modify the drawCircle function code (but I'm not familiar with that, so I can't help).
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com



02102007, 06:34 PM

#6

it's all about patience
Join Date: Jun 2005
Location: istanbul
Posts: 6,696

Take a look at Flash help with curveTo (MovieClip.curveTo method)
And please, use "private message" function when you want to communicate onetoone rather than opening new threads..
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com



02102007, 08:56 PM

#7

JBOY
Join Date: Nov 2005
Location: Stockholm
Posts: 480

Hey dude
use the drawing API in Flash and for the curves I suggest u tage a look at the FUSE kit at www.mosessupposes.com witch will be able to do everything like ryanAir did.
Check out www.gotoandlearn.com where Lee Brimelow shows a couple of FUSE video tutorials
Hope this helps u out



Thread Tools 

Display Modes 
Rate This Thread 
Linear Mode


Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off



All times are GMT. The time now is 06:12 PM.
///

