Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-10-2007, 04:15 PM   #1
ximo87
Registered User
 
Join Date: Aug 2006
Posts: 41
Default 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
ximo87 is offline   Reply With Quote
Old 02-10-2007, 04:40 PM   #2
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
Default

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
inhan is offline   Reply With Quote
Old 02-10-2007, 04:55 PM   #3
ximo87
Registered User
 
Join Date: Aug 2006
Posts: 41
Default

thanx 4 answer but will u further explain what this code will work in? and where do i add it
ximo87 is offline   Reply With Quote
Old 02-10-2007, 05:20 PM   #4
ximo87
Registered User
 
Join Date: Aug 2006
Posts: 41
Default 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
ximo87 is offline   Reply With Quote
Old 02-10-2007, 06:07 PM   #5
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
Default

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
inhan is offline   Reply With Quote
Old 02-10-2007, 06:34 PM   #6
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
Default

Take a look at Flash help with curveTo (MovieClip.curveTo method)

And please, use "private message" function when you want to communicate one-to-one rather than opening new threads..
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
inhan is offline   Reply With Quote
Old 02-10-2007, 08:56 PM   #7
johnnyboy
JBOY
 
johnnyboy's Avatar
 
Join Date: Nov 2005
Location: Stockholm
Posts: 480
Send a message via MSN to johnnyboy
Default

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
__________________
/JBOY

www.f-i.com
johnnyboy is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help Urgently!!!!!!! metalg3r ActionScript 2.0 2 10-16-2006 04:54 AM
HELP ME!! Please.. i need it URGENTLY for my final year project! Lashelle ActionScript 2.0 4 09-14-2004 03:32 PM
Urgently need help!! fanntasy ActionScript 1.0 (and below) 8 07-16-2003 04:28 AM
Urgently, pl help me out of the abrubt if loop vaishu ActionScript 1.0 (and below) 4 07-05-2002 04:52 AM
Need help urgently Jesume ActionScript 1.0 (and below) 2 12-28-2001 11:35 AM


All times are GMT. The time now is 04:39 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.