mirror of
https://github.com/scratchfoundation/scratch-flash.git
synced 2024-12-04 21:21:06 -05:00
commit
3597aa9a49
37 changed files with 65 additions and 65 deletions
|
@ -976,7 +976,7 @@ public class Scratch extends Sprite {
|
|||
return true;
|
||||
}
|
||||
// -----------------------------
|
||||
// Flash sprite (helps connect a sprite on thestage with a sprite library entry)
|
||||
// Flash sprite (helps connect a sprite on the stage with a sprite library entry)
|
||||
//------------------------------
|
||||
|
||||
public function flashSprite(spr:ScratchSprite):void {
|
||||
|
|
|
@ -767,7 +767,7 @@ public class Block extends Sprite {
|
|||
/* Menu */
|
||||
|
||||
public function menu(evt:MouseEvent):void {
|
||||
// Note: Unlike most menu() mehtods, this method invokes
|
||||
// Note: Unlike most menu() methods, this method invokes
|
||||
// the menu itself rather than returning a menu to the caller.
|
||||
if (MenuHandlerFunction == null) return;
|
||||
if (isEmbeddedInProcHat()) MenuHandlerFunction(null, parent);
|
||||
|
|
|
@ -160,7 +160,7 @@ public class BlockArg extends Sprite {
|
|||
|
||||
if (!label && (value is Number) && ((value - epsilon) is int)) {
|
||||
// Append '.0' to numeric values that are exactly epsilon
|
||||
// greather than an integer. See comment in textChanged().
|
||||
// greater than an integer. See comment in textChanged().
|
||||
field.text = (value - epsilon) + '.0';
|
||||
}
|
||||
textChanged(null);
|
||||
|
|
|
@ -335,7 +335,7 @@ public class BlockShape extends Shape {
|
|||
}
|
||||
|
||||
private function curve(p1x:int, p1y:int, p2x:int, p2y:int, roundness:Number = 0.42):void {
|
||||
// Compute the Bezier control point by following an orthogal vector from the midpoint
|
||||
// Compute the Bezier control point by following an orthogonal vector from the midpoint
|
||||
// of the line between p1 and p2 scaled by roundness * dist(p1, p2). The default roundness
|
||||
// approximates a circular arc. Negative roundness gives a concave curve.
|
||||
|
||||
|
|
|
@ -50,20 +50,20 @@ package com.hangunsworld.util{
|
|||
|
||||
|
||||
/**
|
||||
* Flood fills on an image starting at an (x, y) cordinate and filling with a specific color.
|
||||
* Flood fills on an image starting at an (x, y) coordinate and filling with a specific color.
|
||||
* The floodFill() method is similar to the paint bucket tool in various paint programs.
|
||||
*
|
||||
* @param bd The BitmapData to modify.
|
||||
* @param x The x cordinate of the image.
|
||||
* @param y The y cordinate of the image.
|
||||
* @param x The x coordinate of the image.
|
||||
* @param y The y coordinate of the image.
|
||||
* @param color The color with which flood fills the image.
|
||||
* @param tolerance The similarity of colors. Ranges from 0 to 255. [OPTIONAL]
|
||||
* @param contiguous The continueity of the area to be filled. [OPTIONAL]
|
||||
* @param contiguous The continuity of the area to be filled. [OPTIONAL]
|
||||
*
|
||||
* @return A modified BitmapData.
|
||||
*/
|
||||
public static function floodFill(bd:BitmapData, x:uint, y:uint, color:uint, tolerance:uint=0, contiguous:Boolean=false):BitmapData{
|
||||
// Varlidates the (x, y) cordinates.
|
||||
// Validates the (x, y) coordinates.
|
||||
x = Math.min(bd.width-1, x);
|
||||
y = Math.min(bd.height-1, y);
|
||||
// Validates the tolerance.
|
||||
|
@ -95,7 +95,7 @@ package com.hangunsworld.util{
|
|||
// Fills the connected area with white.
|
||||
temp_bd.floodFill(x, y, 0xFFFFFF);
|
||||
|
||||
// Uese threshold() to get the white pixels only.
|
||||
// Use threshold() to get the white pixels only.
|
||||
var rect:Rectangle = new Rectangle(0, 0, w, h);
|
||||
var pnt:Point = new Point(0, 0);
|
||||
temp_bd.threshold(temp_bd, rect, pnt, "<", 0xFF666666, 0xFF000000);
|
||||
|
@ -274,4 +274,4 @@ package com.hangunsworld.util{
|
|||
|
||||
}// end class
|
||||
|
||||
}// end package
|
||||
}// end package
|
||||
|
|
|
@ -326,7 +326,7 @@ public class ExtensionManager {
|
|||
value = ext.stateVars[sensorName];
|
||||
}
|
||||
else if(Scratch.app.jsEnabled) {
|
||||
// Javascript
|
||||
// JavaScript
|
||||
value = ExternalInterface.call('ScratchExtensions.getReporter', ext.name, sensorName, args);
|
||||
}
|
||||
if (value == undefined) value = 0; // default to zero if missing
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ScratchExtension {
|
|||
public var menus:Object = {};
|
||||
public var thumbnailMD5:String = ''; // md5 has for extension image shown in extension library
|
||||
public var url:String = ''; // URL for extension documentation page (with helper app download link, if appropriate)
|
||||
public var javascriptURL:String = ''; // URL to load a javascript extension
|
||||
public var javascriptURL:String = ''; // URL to load a JavaScript extension
|
||||
public var tags:Array = []; // tags for the extension library filter
|
||||
|
||||
// Runtime state
|
||||
|
|
|
@ -50,9 +50,9 @@
|
|||
// session would run that long, this code doesn't deal with clock wrapping.
|
||||
// Since Scratch only runs at discrete intervals, timed commands may be resumed a few
|
||||
// milliseconds late. These small errors accumulate, causing threads to slip out of
|
||||
// synchronization with each other, a problem especially noticable in music projects.
|
||||
// This problem is addressed by recording the amount of time slipage and shortening
|
||||
// subsequent timed commmands slightly to "catch up".
|
||||
// synchronization with each other, a problem especially noticeable in music projects.
|
||||
// This problem is addressed by recording the amount of time slippage and shortening
|
||||
// subsequent timed commands slightly to "catch up".
|
||||
// Delay times are rounded to milliseconds, and the minimum delay is a millisecond.
|
||||
|
||||
package interpreter {
|
||||
|
|
|
@ -235,7 +235,7 @@ public class LooksPrims {
|
|||
private function primSize(b:Block):Number {
|
||||
var s:ScratchSprite = interp.targetSprite();
|
||||
if (s == null) return 100;
|
||||
return Math.round(s.getSize()); // reporter returns rounded size, as in Scrath 1.4
|
||||
return Math.round(s.getSize()); // reporter returns rounded size, as in Scratch 1.4
|
||||
}
|
||||
|
||||
private function primShow(b:Block):void {
|
||||
|
|
|
@ -303,7 +303,7 @@ public class MotionAndPenPrims {
|
|||
|
||||
private function turnAwayFromEdge(s:ScratchSprite):Boolean {
|
||||
// turn away from the nearest edge if it's close enough; otherwise do nothing
|
||||
// Note: comparisions are in the stage coordinates, with origin (0, 0)
|
||||
// Note: comparisons are in the stage coordinates, with origin (0, 0)
|
||||
// use bounding rect of the sprite to account for costume rotation and scale
|
||||
var r:Rectangle = s.getRect(app.stagePane);
|
||||
// measure distance to edges
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
// Internally, a costume consists of a base image and an optional text layer.
|
||||
// If a costume has a text layer, the text image is stored as a separate
|
||||
// bitmap and composited with the base image to create the costume bitmap.
|
||||
// Storing the text layer separately allows the text to be changed indpendent
|
||||
// Storing the text layer separately allows the text to be changed independent
|
||||
// of the base image. Saving the text image means that costumes with text
|
||||
// do not depend on the fonts available on the viewer's computer. (However,
|
||||
// editing the text *does* depend on the user's fonts.)
|
||||
|
@ -269,7 +269,7 @@ public class ScratchCostume {
|
|||
return ((B.x-A.x)*(C.y-A.y)-(B.y-A.y)*(C.x-A.x));
|
||||
}
|
||||
|
||||
/* make a convex hull of boundary of forground object in the binary
|
||||
/* make a convex hull of boundary of foreground object in the binary
|
||||
image */
|
||||
/* in some case L[0]=R[0], or L[ll]=R[rr] if first line or last line of
|
||||
object is composed of
|
||||
|
@ -526,7 +526,7 @@ public class ScratchCostume {
|
|||
costumeName = jsonObj.costumeName;
|
||||
baseLayerID = jsonObj.baseLayerID;
|
||||
if (jsonObj.baseLayerID == undefined) {
|
||||
if (jsonObj.imageID) baseLayerID = jsonObj.imageID; // slighly older .sb2 format
|
||||
if (jsonObj.imageID) baseLayerID = jsonObj.imageID; // slightly older .sb2 format
|
||||
}
|
||||
baseLayerMD5 = jsonObj.baseLayerMD5;
|
||||
if (jsonObj.bitmapResolution) bitmapResolution = jsonObj.bitmapResolution;
|
||||
|
|
|
@ -220,7 +220,7 @@ public class ScratchObj extends Sprite {
|
|||
|
||||
protected function adjustForRotationCenter():void {
|
||||
// Adjust the offset of img relative to it's parent. If this object is a
|
||||
// ScratchSprite, then img is adusted based on the costume's rotation center.
|
||||
// ScratchSprite, then img is adjusted based on the costume's rotation center.
|
||||
// If it is a ScratchStage, img is centered on the stage.
|
||||
var costumeObj:DisplayObject = img.getChildAt(0);
|
||||
if (isStage) {
|
||||
|
|
|
@ -80,7 +80,7 @@ public class ScratchRuntime {
|
|||
return;
|
||||
}
|
||||
|
||||
if (recording) saveFrame(); // Recording a Youtube video? Old / Unused currently.
|
||||
if (recording) saveFrame(); // Recording a YouTube video? Old / Unused currently.
|
||||
app.extensionManager.step();
|
||||
if (motionDetector) motionDetector.step(); // Video motion detection
|
||||
|
||||
|
@ -474,7 +474,7 @@ public class ScratchRuntime {
|
|||
p.x = 15;
|
||||
p.y = ScratchObj.STAGEH - p.height - 5;
|
||||
app.stagePane.addChild(p);
|
||||
setTimeout(p.grabKeyboardFocus, 100); // work-dround for Window keyboard event handling
|
||||
setTimeout(p.grabKeyboardFocus, 100); // workaround for Window keyboard event handling
|
||||
}
|
||||
|
||||
public function hideAskPrompt(p:AskPrompter):void {
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ScratchSprite extends ScratchObj {
|
|||
public var penColorCache:Number = 0xFF;
|
||||
|
||||
private var cachedBitmap:BitmapData; // current costume, rotated & scaled
|
||||
private var cachedBounds:Rectangle; // bounds of non-tranparent cachedBitmap in stage coords
|
||||
private var cachedBounds:Rectangle; // bounds of non-transparent cachedBitmap in stage coords
|
||||
|
||||
public var localMotionAmount:int = -2;
|
||||
public var localMotionDirection:int = -2;
|
||||
|
|
|
@ -276,11 +276,11 @@ public class ScratchStage extends ScratchObj {
|
|||
if(Scratch.app.isIn3D)
|
||||
Scratch.app.render3D.getUIContainer().transform.matrix = transform.matrix.clone();
|
||||
|
||||
return; // scrolling backround support is disabled; see note below
|
||||
return; // scrolling background support is disabled; see note below
|
||||
|
||||
// NOTE: The following code supports the scrolling backgrounds
|
||||
// feature, which was explored but removed before launch.
|
||||
// This prototype implemenation renders SVG backdrops to a bitmap
|
||||
// This prototype implementation renders SVG backdrops to a bitmap
|
||||
// (to allow wrapping) but that causes pixelation in presentation mode.
|
||||
// If the scrolling backgrounds feature is ever resurrected this code
|
||||
// is a good starting point but the pixelation issue should be fixed.
|
||||
|
|
|
@ -173,7 +173,7 @@ public class TalkBubble extends Sprite {
|
|||
}
|
||||
|
||||
private function arc(x:int, y:int):void {
|
||||
// Draw a curve between two points. Compute control point by following an orthogal vector
|
||||
// Draw a curve between two points. Compute control point by following an orthogonal vector
|
||||
// from the midpoint of the L between p1 and p2 scaled by roundness * dist(p1, p2).
|
||||
// If concave is true, invert the curvature.
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ public class NotePlayer extends ScratchSoundPlayer {
|
|||
next = (result <= 32767 ? result : result - 65536);
|
||||
}
|
||||
var sample:Number = (curr + (frac * (next - curr))) / 100000; // xxx 32000; attenuate...
|
||||
if (samplesRemaining < 1000) sample *= (samplesRemaining / 1000.0); // relaase phease
|
||||
if (samplesRemaining < 1000) sample *= (samplesRemaining / 1000.0); // release phase
|
||||
updateEnvelope();
|
||||
return envelopeValue * volume * sample;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
//
|
||||
// A collection of instrument and drum resources to support the note and drum commands.
|
||||
//
|
||||
// Old (8-bit) nstruments and drums: 118k
|
||||
// Old (8-bit) instruments and drums: 118k
|
||||
// New Instruments and Drums: 1555k (Instruments: 1286k; drums: 269k)
|
||||
|
||||
package sound {
|
||||
|
@ -355,7 +355,7 @@ public class SoundBank {
|
|||
['Crash', -8],
|
||||
['Tom', 10, 7260, 7483, 2.7], // 50
|
||||
['HiHatOpen', -2], // ride cymbal 1
|
||||
['Crash', -11], // chinese cymbal
|
||||
['Crash', -11], // Chinese cymbal
|
||||
['HiHatOpen', 2], // ride bell
|
||||
['Tambourine', 0],
|
||||
['Crash', 0, 3.5], // splash cymbal
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// SqueakSoundDecoder.as
|
||||
// John Maloney, November 2010
|
||||
//
|
||||
// Decode a Flash/Squeak ADPCM compressed sounds with 2, 3, 4, or 5 bits pers sample.
|
||||
// Decode a Flash/Squeak ADPCM compressed sounds with 2, 3, 4, or 5 bits per sample.
|
||||
|
||||
package sound {
|
||||
import flash.utils.*;
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
// SqueakSoundPlayer.as
|
||||
// John Maloney, June 2010
|
||||
//
|
||||
// Decode and play a Squeak ADPCM compressed sound with 2, 3, 4, or 5 bits pers sample.
|
||||
// Decode and play a Squeak ADPCM compressed sound with 2, 3, 4, or 5 bits per sample.
|
||||
// Note: To make old projects open more quickly, sounds compressed in the old Squeak ACPDM
|
||||
// format are not converted to WAV format immediately. Such sounds are coverted to WAV format
|
||||
// format are not converted to WAV format immediately. Such sounds are converted to WAV format
|
||||
// if and when the project is saved. Meanwhile, this module allows these sounds to be played.
|
||||
|
||||
package sound {
|
||||
|
|
|
@ -25,7 +25,7 @@ public class WAVFile {
|
|||
|
||||
public static function empty():ByteArray {
|
||||
// Return sound containing a single zero-valued sample.
|
||||
// Note: A totally empty WAV file is considered broken by Quicktime and perhaps other sound tools.
|
||||
// Note: A totally empty WAV file is considered broken by QuickTime and perhaps other sound tools.
|
||||
var data:ByteArray = new ByteArray();
|
||||
data.writeShort(0);
|
||||
return encode(data, 1, 22050, false);
|
||||
|
|
|
@ -63,7 +63,7 @@ public class WaveformView extends Sprite implements DragClient {
|
|||
private var condensedSamples:Vector.<int> = new Vector.<int>();
|
||||
private var samplesPerCondensedSample:int = 32;
|
||||
|
||||
private var scrollStart:int; // first visible condensedSample
|
||||
private var scrollStart:int; // first visible condensedSample
|
||||
private var selectionStart:int; // first selected condensedSample
|
||||
private var selectionEnd:int; // last selected condensedSample
|
||||
|
||||
|
@ -577,7 +577,7 @@ public class WaveformView extends Sprite implements DragClient {
|
|||
if (Math.abs(startOffset - selectionStart) < close) startOffset = selectionStart;
|
||||
if (mousePastEnd()) startOffset = condensedSamples.length;
|
||||
} else {
|
||||
// Clicks close to start or end of slection adjust the selection.
|
||||
// Clicking close to the start or end of a selection adjusts the selection.
|
||||
if (Math.abs(startOffset - selectionStart) < close) selectMode = 'start';
|
||||
else if (Math.abs(startOffset - selectionEnd) < close) selectMode = 'end';
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ John:
|
|||
[x] deactivate when media library showing (so cursor doesn't disappear)
|
||||
[ ] snap costume center to grid
|
||||
[ ] allow larger pens (make size slider be non-linear)
|
||||
[ ] when converting stage from bm to vector, trim white area (?)
|
||||
[ ] when converting stage from bitmap to vector, trim white area (?)
|
||||
[ ] minor: small shift when baking in after moving selection
|
||||
[ ] add readout for pen size
|
||||
[ ] add readout for zoom
|
||||
|
|
|
@ -253,7 +253,7 @@ package svgeditor.tools {
|
|||
toggleHandles(!!targetObj);
|
||||
if(targetObj) {
|
||||
targetObj.toggleHighlight(true);
|
||||
// Add to the displaylist of the object's parent
|
||||
// Add to the display list of the object's parent
|
||||
targetObj.addEventListener(MouseEvent.MOUSE_DOWN, moveHandler, false, 0, true);
|
||||
// Add the move cursor
|
||||
//trace('adding events');
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
// John Maloney, April 2012.
|
||||
//
|
||||
// An SVGDisplayRender converts an SVGElement tree (the result of importing an SVG file)
|
||||
// into a Flash Sprite with children respresenting the visual elements of the SVG as
|
||||
// into a Flash Sprite with children representing the visual elements of the SVG as
|
||||
// Flash DisplayObjects. For example, SVG image elements become Bitmaps, path elements
|
||||
// become Shapes, and text elements become TextFields. For efficiency, multiple path
|
||||
// elements are drawn onto a single Shape. This speeds up drawing the sprite and also
|
||||
// saves a little memory.
|
||||
//
|
||||
// SVGDisplayRender is optimied for for displaying an SVG image as a Scratch costume
|
||||
// SVGDisplayRender is optimized for for displaying an SVG image as a Scratch costume
|
||||
// or scene, possibly scaled or rotated. A vector graphics editor would use a different
|
||||
// internal representation optimized for editing.
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
// Style attributes (e.g. style="stroke:none; fill:#FF0000") are broken into individual attributes.
|
||||
// Attributes with units are converted to unitless numbers in pixels (e.g. "10cm" -> 354.3307).
|
||||
// Percentage attributes are converted to simple numbers (e.g. "50%" -> 0.5).
|
||||
// Reference attrbutes (e.g. "url(#gradient1)") are resolved by replacing the URL with the
|
||||
// Reference attributes (e.g. "url(#gradient1)") are resolved by replacing the URL with the
|
||||
// SVGElement to which it refers.
|
||||
//
|
||||
// All vector elements (circles, ellipses, lines, paths, polygons, polylines, and rects) are converted
|
||||
|
@ -220,7 +220,7 @@ public class SVGImporter {
|
|||
}
|
||||
|
||||
// -----------------------------
|
||||
// Attribute Inheritence
|
||||
// Attribute Inheritance
|
||||
//------------------------------
|
||||
|
||||
private function inheritAttributes(el:SVGElement, parentList:Array):void {
|
||||
|
@ -234,7 +234,7 @@ public class SVGImporter {
|
|||
if (attrVal) el.attributes[k] = attrVal;
|
||||
}
|
||||
}
|
||||
// Compute the cummulative opacity.
|
||||
// Compute the cumulative opacity.
|
||||
var alpha:Number = el.getAttribute('opacity', 1);
|
||||
for each (var parentEl:SVGElement in parentList) {
|
||||
alpha = alpha * parentEl.getAttribute('opacity', 1);
|
||||
|
|
|
@ -637,7 +637,7 @@ public dynamic class SVGPath extends Array {
|
|||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// From anchorpoints to Bezier
|
||||
// From anchor points to Bezier
|
||||
/////////////////////////////////////////////////////
|
||||
public function fromAnchorPoints(points:Array):void {
|
||||
var first:Point = points[0];
|
||||
|
@ -670,7 +670,7 @@ public dynamic class SVGPath extends Array {
|
|||
var g:Graphics = s.graphics;
|
||||
var lastCP:Point = new Point();
|
||||
|
||||
// Pre-render to get ther path bounds
|
||||
// Pre-render to get their path bounds
|
||||
g.lineStyle(0.5);
|
||||
for each(var cmd:Array in this)
|
||||
renderPathCmd(cmd, g, lastCP);
|
||||
|
@ -883,7 +883,7 @@ public dynamic class SVGPath extends Array {
|
|||
}
|
||||
|
||||
// functions below were take from com.lorentz.SVG.utils.Bezier
|
||||
// and addapted for our purposes
|
||||
// and adapted for our purposes
|
||||
private function getQuadraticBezierPoints(a:Point, b:Point, c:Point, d:Point, ctx:PathDrawContext):void {
|
||||
// find intersection between bezier arms
|
||||
var s:Point = intersect2Lines(a, b, c, d);
|
||||
|
|
|
@ -115,7 +115,7 @@ public class Translator {
|
|||
}
|
||||
|
||||
private static function setFontsFor(lang:String):void {
|
||||
// Set the rightToLeft flag and font sizes the given langauge.
|
||||
// Set the rightToLeft flag and font sizes the given language.
|
||||
|
||||
currentLang = lang;
|
||||
isEnglish = (lang == 'en');
|
||||
|
|
|
@ -56,7 +56,7 @@ public class BlockPalette extends ScrollFrameContents {
|
|||
// Delete blocks and stacks dropped onto the palette.
|
||||
var c:ScratchComment = obj as ScratchComment;
|
||||
if (c) {
|
||||
c.x = c.y = 20; // postion for undelete
|
||||
c.x = c.y = 20; // position for undelete
|
||||
c.deleteComment();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public class SpriteThumbnail extends Sprite {
|
|||
}
|
||||
|
||||
public function showHighlight(flag:Boolean):void {
|
||||
// Display a highlight if flag is true (e.g. to show broadcast sender/eceivers).
|
||||
// Display a highlight if flag is true (e.g. to show broadcast senders/receivers).
|
||||
highlightFrame.visible = flag;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class ScriptsPart extends UIPart {
|
|||
}
|
||||
|
||||
public function step():void {
|
||||
// Update the mouse reaadouts. Do nothing if they are up-to-date (to minimize CPU load).
|
||||
// Update the mouse readouts. Do nothing if they are up-to-date (to minimize CPU load).
|
||||
var target:ScratchObj = app.viewedObj();
|
||||
if (target.isStage) {
|
||||
if (xyDisplay.visible) xyDisplay.visible = false;
|
||||
|
|
|
@ -264,7 +264,7 @@ public class StagePart extends UIPart {
|
|||
private function updateRunStopButtons():void {
|
||||
// Update the run/stop buttons.
|
||||
// Note: To ensure that the user sees at least a flash of the
|
||||
// on button, it stays on a minumum of two display cycles.
|
||||
// on button, it stays on a minimum of two display cycles.
|
||||
if (app.interp.threadCount() > 0) threadStarted();
|
||||
else { // nothing running
|
||||
if (runButtonOnTicks > 2) {
|
||||
|
@ -278,7 +278,7 @@ public class StagePart extends UIPart {
|
|||
private var lastX:int, lastY:int;
|
||||
|
||||
private function updateMouseReadout():void {
|
||||
// Update the mouse reaadouts. Do nothing if they are up-to-date (to minimize CPU load).
|
||||
// Update the mouse readouts. Do nothing if they are up-to-date (to minimize CPU load).
|
||||
if (stage.mouseX != lastX) {
|
||||
lastX = app.stagePane.scratchMouseX();
|
||||
xReadout.text = String(lastX);
|
||||
|
@ -366,7 +366,7 @@ public class StagePart extends UIPart {
|
|||
private function showPlayButton():void {
|
||||
// The play button is a YouTube-like button the covers the entire stage.
|
||||
// Used by the player to ensure that the user clicks on the SWF to start
|
||||
// the project, which ensurs that the SWF gets keyboard focus.
|
||||
// the project, which ensures that the SWF gets keyboard focus.
|
||||
if (!playButton) {
|
||||
playButton = new Sprite();
|
||||
playButton.graphics.beginFill(0, 0.3);
|
||||
|
|
|
@ -66,7 +66,7 @@ public class CursorTool {
|
|||
}
|
||||
|
||||
private static function hideSoftwareCursor():void {
|
||||
// Hide the current cursor and revert to using the hardward cursor.
|
||||
// Hide the current cursor and revert to using the hardware cursor.
|
||||
if (currentCursor && currentCursor.parent) currentCursor.parent.removeChild(currentCursor);
|
||||
currentCursor = null;
|
||||
Mouse.cursor = MouseCursor.AUTO;
|
||||
|
|
|
@ -187,12 +187,12 @@ public class IconButton extends Sprite {
|
|||
offImage = new Sprite();
|
||||
var g:Graphics = Sprite(offImage).graphics;
|
||||
g.lineStyle(1, color);
|
||||
g.beginFill(0, 0); // transarent fill allows button to get mouse clicks
|
||||
g.beginFill(0, 0); // transparent fill allows button to get mouse clicks
|
||||
g.drawCircle(6, 6, 6);
|
||||
onImage = new Sprite();
|
||||
g = Sprite(onImage).graphics;
|
||||
g.lineStyle(1, color);
|
||||
g.beginFill(0, 0); // transarent fill allows button to get mouse clicks
|
||||
g.beginFill(0, 0); // transparent fill allows button to get mouse clicks
|
||||
g.drawCircle(6, 6, 6);
|
||||
g.beginFill(color);
|
||||
g.drawCircle(6, 6, 4);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
// John Maloney, November 2010
|
||||
//
|
||||
// A ScrollFrame allows the user to view and scroll it's contents, an instance
|
||||
// of ScrollFrameContents or one of its sublasses. The frame can have an outer
|
||||
// of ScrollFrameContents or one of its subclasses. The frame can have an outer
|
||||
// frame or be undecorated. The default corner radius can be changed (make it
|
||||
// zero for square corners).
|
||||
|
||||
|
@ -261,7 +261,7 @@ public class ScrollFrame extends Sprite implements DragClient {
|
|||
}
|
||||
|
||||
private function step(evt:Event):void {
|
||||
// Implements intertia after releasing the mouse when dragScrolling.
|
||||
// Implements inertia after releasing the mouse when dragScrolling.
|
||||
xVelocity = decayFactor * xVelocity;
|
||||
yVelocity = decayFactor * yVelocity;
|
||||
if (Math.abs(xVelocity) < stopThreshold) xVelocity = 0;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
// c. instantiate stage, sprite, costume, sound, and watcher objects
|
||||
// d. dereference object references (Ref objects) in the fields list of
|
||||
// user-classes and in fixed-format collection objects.
|
||||
// e. initalize variable and list watchers
|
||||
// e. initialize variable and list watchers
|
||||
// f. initialize costumes and sounds
|
||||
//
|
||||
// Typically, the client calls readObjTable(), then scans the processed object table to
|
||||
|
|
|
@ -221,7 +221,7 @@ public class ListWatcher extends Sprite {
|
|||
//------------------------------
|
||||
|
||||
public function updateWatcher(i:int, readOnly:Boolean, interp:Interpreter):void {
|
||||
// Colled by list primitives. Reccord access to entry at i and if list contents has changed.
|
||||
// Called by list primitives. Record access to entry at i and if list contents has changed.
|
||||
// readOnly should be true for read operations, false for operations that change the list.
|
||||
// Note: To reduce the cost of list operations, this function merely records changes,
|
||||
// leaving the more time-consuming work of updating the visual feedback to step(), which
|
||||
|
@ -472,7 +472,7 @@ public class ListWatcher extends Sprite {
|
|||
}
|
||||
|
||||
private function cellNumWidth():int {
|
||||
// Return the estimated maxium cell number width. We assume that a list
|
||||
// Return the estimated maximum cell number width. We assume that a list
|
||||
// can display at most 20 elements, so we need enough width to display
|
||||
// firstVisibleIndex + 20. Take the log base 10 to get the number of digits
|
||||
// and measure the width of a textfield with that many zeros.
|
||||
|
@ -483,7 +483,7 @@ public class ListWatcher extends Sprite {
|
|||
}
|
||||
|
||||
private function removeAllCells():void {
|
||||
// Remove all children except the mask. Reycle ListCells and TextFields.
|
||||
// Remove all children except the mask. Recycle ListCells and TextFields.
|
||||
while (cellPane.numChildren > 1) {
|
||||
var o:DisplayObject = cellPane.getChildAt(1);
|
||||
if (o is ListCell) cellPool.push(o);
|
||||
|
@ -539,8 +539,8 @@ public class ListWatcher extends Sprite {
|
|||
//------------------------------
|
||||
|
||||
private function textChanged(e:Event):void {
|
||||
// Triggered by editing the contents of a cell. Copy the
|
||||
// the cell contents into the underlying list.
|
||||
// Triggered by editing the contents of a cell.
|
||||
// Copy the cell contents into the underlying list.
|
||||
var cellContents:TextField = e.target as TextField;
|
||||
for (var i:int = 0; i < visibleCells.length; i++) {
|
||||
var cell:ListCell = visibleCells[i];
|
||||
|
|
Loading…
Reference in a new issue