Celestial Sphere Component
 celestial_sphere140view, link (66.2 KB, 700400) source (608 KB)Fri, 4 Aug 06, 12:18pm CDT 
 

Fixed a problem affecting the horizon plane when making a movie in Flash 7.

 
 celestial_sphere128   Wed, 27 Jul 05, 3:01pm CDT 
 

Shaded band functions on the celestial sphere component:

  • addShadedBand(frontName, backName, name, parameters, [surface, [hemisphere, [initObject]]]) - name defines the name the band will be known by to access it specifically; see the description of setLinkageNames() below for a description of the frontName, backName, surface, hemisphere, initObject properties; see setParameters() for a description of the parameters argument
  • updateShadedBands()
  • showShadedBands()
  • hideShadedBands()
  • removeShadedBands()

Methods of a shaded band include:

  • setParameters({dec1, dec2, [ra, tilt]}) - the dec1 and dec2 (or alt1 and alt2) parameters determine the range of the band; the optional ra (or az) and tilt parameters can be used to define a band in any arbitrary orientation (see the circle documentation for an understanding of what these parameters mean, or see the celestial_sphere101 example)
  • setLinkageNames(frontName, backName, [surface, [hemisphere, [initObject]]]) - frontName and backName are the linkage names of the clips in the library (these should be discs 200 pixels wide); the optional parameter surface can be the strings "inner" or "outer" and determines whether the band appears on the inner or outer surface of the sphere (default is outer); the optional parameter hemisphere can be the strings "below", "above", or "full" and determines whether the band appears below or above the horizon plane, or both (default is both); the initObject parameter can be an object whose parameters get passed to the front and back movieclips when they are attached
  • setBorderStyle(thickness, [color, [alpha]]) - sets the linestyle of the border
  • remove() - removes the band
  • update() - updates the band

Properties of a shaded band include:

  • visible - toggles the visibility of the band (no update required)
  • showBorder - toggles the visibility of the border of the band (no update required)

Additional notes:

When the front and back shaded movieclips are attached to the library they get three variables defined on them (in addition to any that are passed by an initObject):

  • _sphere - a reference to the sphere that the clips are a part of
  • _shadedBand - a reference to the specific shaded band that the instances belong to
  • _side - a string, "front" or "back", that tells the clip which side of the sphere it is part of

The declination and altitude ranges don't require the tilt and ra (or az) parameters, but one situation that does is putting a band on the ecliptic. The following line defines a band that extends 10° above and below the ecliptic:

sphere.band.setParameters({dec1: -10, dec2: 10, ra: 0, tilt: 23.4});

 
 celestial_sphere101view, link (44.5 KB, 800400)  Mon, 23 Feb 04, 10:32am CST 
 

This new version has a number of changes, the most significant of which is that circles are rendered twice as fast.

 
Globe Component
 globeComponent027view, link (75.7 KB, 930700) source (455.5 KB)Thu, 6 Jul 06, 10:32am CDT 
 

documentation

This is a new version of the globe component. It is designed to be easier to use, and can be used either as an object of the celestial sphere component (plug-in), or as an isolated component (standalone) with a live preview.

When used in the celestial sphere there is no need for the programmer to manually update and position the globe (unlike the earlier globe component), all of that happens automatically. For example, you do not have to define a onMouseUpdate function that repositions the globe when the user drags the celestial sphere around. To add the globe to a celestial sphere instance, all you need is the following line of code:

sphereMC.addObject("Globe Component v2", "globe");

Then, if you want to show sun shading, you would add the following:

sphereMC.globe.instance.showShading = true;
sphereMC.globe.instance.setSunPosition({ra: 0, dec: 0});

All function calls and changes to property values take effect immediately -- you do not have to call an update function.

Note: if you want to show the equator or other features on the globe you still need to do the sphere in a sphere trick.

 
 globeComponent002view, link (61.8 KB, 500500) source (229.5 KB)Fri, 2 Apr 04, 9:30am CST 
Sinusoid Component
 sinusoidComponent001view, link (35.2 KB, 700500) source (427.5 KB)Wed, 7 Sep 05, 3:01pm CDT 
 

documentation

 
Scientific Notation Number Component
 sci_notNumber003view, link (29.5 KB, 800500) source (160 KB)Tue, 7 Jun 05, 9:33am CDT 
 

Note that the toScientific function combined with the displayText function now provides a more convenient way of displaying numbers in scientific format.

 
Logarithmic Histogram
 logHistogram002view, link (22.5 KB, 620400) source (64 KB)Wed, 17 Aug 05, 7:02pm CDT 
 

changes:

  • fixed case bug
  • added function stepLabelsBy(n), so that labels are only shown every nth power of ten; in the example above n is 2
  • added function showMinorTicks(arg), where arg is a boolean indicating whether minor tickmarks are shown; in the example above this is set to false
  • added an optional width parameter to the bar objects, so each bar's width can be specified individually (otherwise the default bar width is used); in the example above a narrow "empty" bar is used to physically separate the "16+" category from the rest

This example also shows what can be done with a custom bar. Rolling over displays the value associated with that bar. Clicking the value lets you drag it around the screen.

 
Slider
 slider637view, link (65.7 KB, 900600) source (580 KB)Mon, 18 Sep 06, 5:20pm CDT 
 

Expanded the list of font characters that are embedded by default (characters like * and + and < were not getting embedded). The default font load is now about 10 Kb (up from 8 Kb). Of this, 1.5 Kb is in Verdana Italic for the value field and the remaining 8.5 Kb is in Verdana for the label and unit fields.

You can still specify your own fonts movieclip; however, the 10 Kb of Verdana will still be embedded unless you remove or de-export the default fonts movieclip. Alternatively, you can edit the default fonts movieclip directly to include just the fonts you need.

The embedded font characters now include all characters on the keyboard plus . The alt-xxxx sequences for entering these extra charaters are:

  • 0176
  • 0177
  • 0181
  • 0183
  • 0215
  • 0247
  • 0133
  • 0139
  • 0155

 
 slider636   Wed, 23 Aug 06, 5:43pm CDT 
 

This update fixes a potentially serious problem where the slider could get locked up in an infinite loop. If this were to happen while using the live preview in the authoring environment the flash program would become unresponsive and you'd lose your unsaved work (at least in Flash 6).

Example scenario: you are editing a movie and you have a slider on the stage with a range of 0 to 10, an initial value of 0, and the precision is in fixed digits. If you were to change the precision mode to significant digits Flash will become unresponsive and you will have to have Windows shut down the program, losing unsaved work.

Please note the following rule: if precisionMode is "significant digits" or if scalingMode is "logarithmic" the value range must be strictly greater than zero. The slider will misbehave (but usually not crash) if this rule is broken. However, the problem is fatal (an infinite loop) if the value is zero and the scaling is in significant digits.

Unless a Flash movie violates – or can potentially violate – the above rule there is no need to go back and update the slider. This update merely prevents violations of the rule from making the flash movie unresponsive, and potentially causing the authoring environment to crash. Therefore, I recommend using this version in new movies, and being careful about adjusting the slider parameters when working with old movies.

 
 slider635   Tue, 23 May 06, 5:31pm CDT 
 

Added the ability to show/hide the value field (via "show value field" in the properties inspector or the showField property).

 
 slider634   Fri, 19 May 06, 1:22pm CDT 
 

made two fixes related to the tab (mouse free) mode:

  • fixed it so that tabbing-off the value field does not result in the change handler being called unless the value was being edited
  • fixed the problem that would cause double incrementing when adjusting the grabber position with the arrow keys

 
 slider008view, link (39.1 KB, 620600) source (288 KB)Tue, 7 Sep 04, 3:32pm CDT 
 

Changed the colors on the spectral type slider to match the blackbody colors we use.

 
Curved Text Component
 curvedText003view, link (55.9 KB, 725525)  Wed, 30 Aug 06, 12:26pm CDT 
 curvedText002view, link (55.8 KB, 725525) source (466.5 KB)Thu, 17 Jun 04, 3:59pm CDT 
toFixed Numerical Routine
 toFixed002view, link (19.7 KB, 550250) source (14.5 KB)Fri, 7 May 04, 3:13pm CDT 
 

The function given here takes a number and returns it as a string with the specified number of digits. To use, copy the function Number.prototype.toFixed() and put it in the first frame of your movie, or inside any #initclip/#endinitclip pair. Then when you have a number x that you want in fixed format with N digits, use the following method:

output = x.toFixed(N);

Another example:

var x = Math.sin(1);
trace(x); // traces 0.841470984807897
var str = x.toFixed(3);
trace(str); // traces 0.841


The variable must be a number to access the function, so explicit conversion may be necessary:

userString = "0.33443";
var x = Number(userString);
trace(x.toFixed(2)); // traces 0.33

 
Scientific Notation Functions
 sci_not002view, link (22.5 KB, 600350) source (37 KB)Fri, 7 May 04, 3:12pm CDT 
 

There are two functions demonstrated here:

Math.toScientific(num, [sigDigs]) returns a string with num in scientific notation. sigDigs is an optional parameter to specify the number of significant digits (valid values are integers 1 through 15). If sigDigs isn't provided it defaults to 4. In the case of error the function returns an empty string.

Math.toSigDigits(num, sigDigs) returns num as a number with sigDigs significant digits, where sigDigs is an integer from 1 to 15. If there is an error it returns NaN. Since this returns a number displaying trailing zeros when converting to a string is a problem. For example:

trace(String(Math.toSigDigits(560001, 4))); // traces 560000
// can't tell which zeros are significant and which are not

trace(String(Math.toSigDigits(0.0005, 5))); // traces 0.0005
// implies that there is only one significant digit

 
Gaussian Random Number Generation
 gaussianRandomNumber001view, link (18 KB, 600400) source (22.5 KB)Mon, 10 May 04, 4:21pm CDT 
 

The function gaussian on the first frame of the main timeline returns a random number that follows a Gaussian distribution with a mean of zero and a standard deviation of one. Note that the function can be modified to produce two guassian random numbers per call. One can use x2*w in the last line of the function as well as x1*w. This function is based on the algorithm found here.

 
drawArc routine
 drawArc002view, link (33.9 KB, 800650) source (25 KB)Mon, 10 May 04, 3:48pm CDT 
 

This file contains the function MovieClip.prototype.drawArc(x, y, radius, startAngle, endAngle), which draws an arc on the movieclip centered at coordinates x and y with the specified radius. The arc starts at startAngle and ends at endAngle, where these angles are measured in radians from the +x axis, going counterclockwise. This function requires that MovieClip.prototype.maxArcStep be defined.

This file dates from July 2003 so don't use the slider in its library.

 
3D Plane Rotation
 planeRotator001view, link (41.5 KB, 700500) source (100 KB)Mon, 10 May 04, 4:02pm CDT 
 

This file contains a component that skews and rotates a movieclip in a way that makes it seem like a plane in 3D space. The orientation of the plane is controled by two angles (given in degrees) that define the direction that the camera is viewing from, measured from an origin centered on the movieclip. In this coordinate system theta is the azimuthal angle, and is measured in the plane of the movieclip counterclockwise from the movieclip's +y axis. phi is the altitudinal angle measured from this plane. There is an option to have the "back" and "front" sides be separate movieclips – otherwise, they can be the same.

This file dates from June 2003 so don't use the slider in its library.

 
Watch Digits
 watchDigits001view, link (2.5 KB, 200200) source (309.5 KB)Fri, 7 May 04, 4:46pm CDT 
 

A first attempt at making numbers that appear like those on a watch lcd.

 
Spectral Type, Temperature, and Color Functions
 typeAndTemp014view, link (27.3 KB, 700920) source (96.5 KB)Wed, 20 Oct 04, 12:30pm CDT 
 

Added getMassFromLuminosity, getLuminosityFromRadiusAndTemp, and getTempFromLuminosityAndRadius. Also tweaked getRadiusFromTempAndLuminosity to be more consistent with other functions (it now uses an effective solar temperature of 5808.3 K). Note that getLuminosityFromRadiusAndTemp and getTempFromLuminosityAndRadius are not demonstrated, though they have been tested.

 
 typeAndTemp012view, link (27.1 KB, 700920)  Tue, 19 Oct 04, 5:53pm CDT 
 

Added getTempFromLuminosity as an inverse to getLuminosityFromTempAndClass for main sequence stars. Also added getTempFromRadius, which returns the temperature associated with main sequence star of a given radius. Also added getLuminosityFromMass, which returns the luminosity of a main sequence star given its mass.

 
 typeAndTemp010view, link (25 KB, 700860)  Wed, 6 Oct 04, 12:01pm CDT 
 

added a bolometric correction function

 
 typeAndTemp009view, link (24.8 KB, 700800)  Fri, 2 Jul 04, 4:44pm CDT 
 

Added the following functions:

getMvFromTempAndLuminosity
getLuminosityFromTempAndClass
getRadiusFromTempAndLuminosity

 
 typeAndTemp008view, link (23.8 KB, 700600)  Fri, 25 Jun 04, 8:50am CDT 
 

getLuminosityFromTempAndMv works now. getColorFromTemp now uses polynomials to calculate the color instead of using a lookup table.

 
 typeAndTemp005view, link (24.2 KB, 700600)  Mon, 21 Jun 04, 5:29pm CDT 
 

Now the function getTempFromSpectralType will accept a number (between 0 and 70) as the argument. If a number is passed the luminosity class can be specified as a second parameter, e.g. getTempFromSpectralType(42, "V") returns 5830.

Furthermore, the object returned by the getSpectralTypeFromTemp function – which has type, number, and class properties – now adds another property, spectralTypeNumber, which is a number between 0 and 70 that corresponds to the spectral type.

 
 typeAndTemp004view, link (24.1 KB, 700600)  Tue, 15 Jun 04, 11:03am CDT 
 typeAndTemp002view, link (22.4 KB, 700600)  Mon, 7 Jun 04, 10:36am CDT 
 typeAndTemp001view, link (18.7 KB, 600400)  Fri, 4 Jun 04, 5:02pm CDT 
displayText Function
 displayText008view, link (38.9 KB, 700400) source (304 KB)Mon, 27 Feb 06, 9:18am CST 
 

Changed it so that the function converts the first argument (textString) to a string if necessary (previously it would return null if it was not a string).

 
 displayText007   Thu, 23 Feb 06, 3:08pm CST 
 

The function displayText is found in the first frame of the main timeline. Documentation:

	// This function takes a string and adds its text to screen. It allows a convenient way to display
	// superscripts and subscripts in a line of text by using <sup></sup> and <sub></sub> tags.
	
	// More precisely, this function creates and positions textfields as needed in a wrapper movieclip it
	// creates. A reference to this wrapper movieclip is returned by the function. The property textWidth
	// is added to the wrapper movieclip and gives the total width of the line of text.
	
	// Arguments of the function:
	// textString contains the text to display (the function returns null if this is not a string)
	// options is an optional object with any of the following properties:
	//   depth - depth to use for the wrapper movieclip containing the text; if no depth
	//     is provided a depth of 913001 or greater is used (a global variable is used to
	//     ensure that subsequent textfields don't overwrite each other)
	//   mc - a reference to the movieclip in which to add the text wrapper movieclip; if
	//     it is not provided the wrapper movieclip will be added to 'this'
	//   name - the name to give the text wrapper movieclip; if it is not provided the name
	//     will be the string "_textWrapper_" plus depth (e.g. "_textWrapper_913001")
	//   x y - if x or y are provided the wrapper movieclip will be positioned at those coordinates;
	//     otherwise the wrapper is placed at the origin
	//   vAlign - this property determines how the text is arranged vertically with respect to the
	//     wrapper movieclip's origin; it can be either "center" (default), "top", or "bottom"
	//   hAlign - this property determines how the text is arranged horizontally with respect to the
	//     wrapper movieclip's origin; it can be either "center" (default), "left", or "right"
	//   embedFonts - if this is provided all the textfields will have their embedFonts property
	//     set to this value; if this is set to true all the necessary characters of the font specified
	//     in the textFormat parameter must be exported with the movie; the default is false
	//   textFormat - the TextFormat object to use for the text; if it is not provided the default
	//     format generated with createTextField is used (12pt Times); this style applies to both
	//     the sub/superscript and normal textfields, with the exception that sub/superscripts are
	//     rendered at a smaller font size determined by sizeRatio
	//   sizeRatio - the ratio of the normal font size (which is specified in the textFormat parameter)
	//     to the sub/superscript font size; the default is 1.5
	//   subscriptPosition - this affects the positioning of the subscripts; the default is 0px;
	//     negative values bring the subscripts closer to the center of the line, while positive
	//     values push the subscripts away from the center (in pixel units)
	//   superscriptPosition - this affects the positioning of the superscripts; the default is 0px;
	//     negative values bring the superscripts closer to the center of the line, while positive
	//     values push the superscripts away from the center (in pixel units)
	//   extraSpacing - sometimes it seems that the gap between sub/superscript and normal
	//     textfields is too narrow, so extraSpacing was introduced to put a little bit of
	//     extra room between fields; the default is 0.5px

 
Number Functions
 numberFunctions002view, link (47 KB, 700500) source (128.5 KB)Mon, 27 Feb 06, 9:20am CST 
 

Two important fixes to the toScientific function have been made. The first fix makes it so the function now accepts negative values. The second fix takes care of a potential rounding problem. Suppose the number is 9.999e6 and we want to show it with two significant digits. The previous version would return "10.0e6". This version returns "1.0e7".

 
Interface Components
 interfaceComponents006view, link (19.5 KB, 600500) source (139 KB)Thu, 24 Aug 06, 9:34am CDT 
 

Fixed an oversight were it was possible to open the about and help popups by tabs (no mouse) but not to close them.

 
Shutter Component
 shutterComponent009view, link (27.6 KB, 600500) source (296.5 KB)Fri, 19 May 06, 12:07pm CDT 
Radial Velocity Component
 radialVelocityComponent010view, link (34.5 KB, 900400) source (352 KB)Fri, 19 May 06, 5:07pm CDT 
Binary System Component
 binSysComponent005view, link (37.6 KB, 950600) source (276.5 KB)Tue, 23 May 06, 9:59am CDT 
Binary System Lightcurve Component
 lightcurveComponent001view, link (61.1 KB, 980600) source (409.5 KB)Fri, 14 Apr 06, 4:25pm CDT 
HR Diagram Component
 hrDiagramComponent043view, link (104.4 KB, 1050670) source (1.5 MB)Mon, 18 Aug 08, 4:15pm CDT 
 

Fixed the label positioning problem on mac.

 
 hrDiagramComponent041   Fri, 2 Mar 07, 5:09pm CST 
 

Changed class names and linkage names to avoid problems when a movie loads swfs with different versions of this component. Otherwise, this component should be functionally identical to version 040.

 
 hrDiagramComponent040   Fri, 9 Feb 07, 10:35am CST 
 

updated documentation

Major changes:

  • The biggest change is that the internal conversion functions (e.g. getTypeFromLogTemp) have been updated to better fit real data. These functions can be tweaked more if necessary (a newly created editor makes this relatively easy).
  • Made changes to how the distance modulus shifting occurs. The property apparentMagnitudeOffset has been removed and the property distanceModulus behaves differently now. Any existing implementations of the component that use these properties will need to be rewritten.
  • Updated the star lists and changed the default appearance of these groups.
  • Improved and standardized the way styles are set for some things (e.g. the spectral type style settings). There are potential backwards-compatibility issues with some of the changes, but I doubt if anyone was using the old methods.
  • Added the ability to add a group of stars from a list when using addObjectLayer.
  • Added the removeObjectLayer and removeAllObjects functions.
  • Modified updateObjects so one can now update just a subset of parameters.
  • Updated the live preview and fixed it so that the component can be added by attachMovie.
  • Added a property skipInitUpdate, which if true will cause the component not to update itself after initialization. It can be set in the init object if using attachMovie or at the bottom of the live update panel in the authoring environment. This should improve efficiency if you're going to immediately change the component settings after initialization.
  • Address issues with the luminosity class lines.
  • Compatibility problems with AS2 have been fixed.
  • Numerous bug fixes.

 
Error Function
 errorFunction001view, link (18 KB, 550100) source (96.5 KB)Thu, 7 Sep 06, 12:29pm CDT 
Random MBD Number Generator
 randomMaxwell003view, link (39 KB, 800650) source (195 KB)Thu, 7 Sep 06, 10:27pm CDT 
Star Field Component
 starFieldComponent002view, link (42.6 KB, 800350) source (148 KB)Tue, 26 Sep 06, 2:44pm CDT 
Sinusoid Component II
 sinusoidComponentII004view, link (11.5 KB, 400200) source (204.5 KB)Thu, 21 Sep 06, 9:39am CDT 
 

Slight changes have been made to the component: a change in how the size is set when attaching using attachMovie and the inclusion of more embedded characters for the default label.

Besides these changes to the component this demonstration swf has been changed so that the appearance of the example sinusoid can be set using flashvars. The width and height of the component will adjust to the size of the stage (ie. the swf size specified in the embedding html block).

All of the following flashvars are optional:

  • amplitude - in pixels, default is 60
  • wavelength - in pixels, default is 80
  • offset - in pixels, default is 0
  • showAxis - can be 'T' or 'F' (or '1' or '0'), default is 'T'
  • curveThickness - default is 1
  • curveColor - in hex (without '#' or '0x' in front), default is '999999'
  • curveAlpha - default is 100
  • axisThickness - default is 1
  • axisColor - in hex, default is 'cccccc'
  • axisAlpha - default is 100

Labels are added at positions posZ where Z denotes the label number, running consecutively from 1. The position should be given in pixels. Each label can be customized with the following optional flashvars:

  • colorZ - in hex, default is 'd00000'
  • textZ - default is no text
  • textAngleZ - in degrees clockwise from up, default is 0
  • textRadiusZ - in pixels, default is 7
  • textSizeZ - in points, default is 12
  • dotRadiusZ - in pixels, default is 3

 
 sinusoidComponentII003   Mon, 18 Sep 06, 3:38pm CDT 
 

notes:

amplitude, wavelength, offset - These properties determine the shape of the curve. Values are in pixels.

width, height - These properties set the dimensions of the plot area.

addLabel(linkageName, name, position, initObj, depth) - This function adds a label (movieclip) to the curve. If the linkage name is null or undefined the "SCII Default Label" found in the resources folder is used. name should be a valid actionscript identifier since it will be used to provide a reference to the movieclip. The position is the x-coordinate of the label. The optional argument initObj will be used when attaching the label movieclip. The last argument, depth, is also optional.

The "SCII Default Label" movieclip has the following properties:

  • labelColor - the color of the label (both the text and dot)
  • text - the text to place next to the label
  • textAngle - in degrees, clockwise from up, default is 0
  • textRadius - approximate distance, in pixels, between the text and the dot, default is 7
  • textSize - point size of text font, default is whatever the text size is in the embedded font field
  • dotRadius - radius of dot, in pixels, default is 3

These properties can be set by defining them on an initObject and passing it to addLabel. Afterwards, they can be set on directly on the the movieclip instance. Call update on the label movieclip after changing these properties.

setLabelPosition(name, position) - Sets the position (x-coordinate in pixels) of a label.

removeLabel(name) - Removes the label.

showVerticalAxis,showHorizontalAxis - Properties toggle visibility of the axes.

setAxisStyle(thickness, color, alpha) - Sets the linestyle of the axes. Use null to leave a parameter unchanged.

setCurveStyle(thickness, color, alpha) - Sets the linestyle of the sine curve. Use null to leave a parameter unchanged.

 
Maxwell-Boltzmann Distribution Plot Component
 maxwellPlotComponent004view, link (33.9 KB, 900400) source (331 KB)Mon, 20 Nov 06, 10:22am CST 
drawDashedLine Function
 drawDashedLine001view, link (498 B) source (16.5 KB)Fri, 3 Nov 06, 3:43pm CST 
 

Here is all the code contained in the movie above:


MovieClip.prototype.drawDashedLine = function(startX, startY, endX, endY, dashLength, gapLength) {
	// this function will draw a dashed line between the indicated endpoints; the given dash
	// length and gap length will be approximated as closely as possible such that there is
	// a complete dash touching both endpoints
	var dx = endX-startX;
	var dy = endY-startY;
	var length = Math.sqrt(dx*dx+dy*dy);
	var n = Math.round((length-dashLength)/(dashLength+gapLength));
	var f = dashLength/(dashLength+gapLength);
	var mx = dx/(n+f);
	var my = dy/(n+f);
	var lx = f*mx;
	var ly = f*my;
	for (var i=0; i<=n; i++) {
		var x = startX + i*mx;
		var y = startY + i*my;
		this.moveTo(x, y);
		this.lineTo(x+lx, y+ly);
	}
};

var mc = this.createEmptyMovieClip("exampleMC", 1);

mc.lineStyle(0, 0x000000);
mc.drawDashedLine(70, 12, 169, 183, 4, 2);

mc.lineStyle(0, 0xff0000);
mc.drawDashedLine(169, 183, 392, 302, 3, 3);

mc.lineStyle(0, 0x000000);
mc.drawDashedLine(392, 302, 447, 110, 2, 6);

mc.lineStyle(0, 0x0000ff);
mc.drawDashedLine(447, 110, 70, 12, 12, 12);

 
drawPhaseDisc Function
 drawPhaseDisc001view, link (41.2 KB, 1050600) source (155.5 KB)Fri, 19 Jan 07, 4:53pm CST 
 

Just drag the "drawPhaseDisc Function" clip to the library to use the following function:

MovieClip.prototype.drawPhaseDisc = function(definition, optionsObj) {
	// definition - the desired phase can be given in two ways:
	//		- if 'definition' is a number it is assumed to be the phase angle in degrees;
	//		the phase angle is the angle between the observer and illumination directions
	//		as measured CCW from the the observer direction (e.g. an angle of 90 means
	//		that the right half appears illuminated, ie. first quarter)
	//		- if 'definition' is an object with x0, y0, x1, y1, x2, and y2 properties the function
	//		will calculate the phase angle assuming that these are the screen coordinates for the
	//		illuminator, observer, and observed body respectively; that is, the disc will be drawn
	//		for an observer at body 1 looking at body 2, being illuminated by body 0
	// possible properties for the optionsObj object (all optional):
	//		radius - disc radius (default 70)
	//		lightColor = the color for the illuminated part of the disc (default 0xe0e0e0)
	//		darkColor = the color for the unilluminated part of the disc (default 0x404040)
	//		x, y - the coordinates for the center of the disc (defaults are 0, 0)
	//		lineThickness, lineColor, lineAlpha - the outline style (defaults are 1, 0x202020, and 0)
	//		doClear - boolean specifies whether to clear the mc before drawing (default true)
	// note: the function returns the phase angle in degrees in the range [0, 360) - this may be
	// useful when giving object positions for the definition