//Copyright Julian Tenney 2004 //Released under the GNU Public License import flash.filters.*; import KeyDetection; import mx.transitions.*; import flash.external.ExternalInterface; import DistortImage; import flash.geom.Matrix; import flash.display.BitmapData; Key._listeners = []; //handle toolkits / standalone modes var FileLocation = _level0.FileLocation; var templatePath = _level0.templatePath; if (templatePath == undefined){ templatePath = FileLocation; } engine = this; engine.editMode = false; Stage.scaleMode = "noScale"; Stage.align = "TL"; function createStylesObj(visuals) { STYLES = new Object(); visuals == 1 ? STYLES.stageColour=0x666666 : STYLES.stageColour=0xFFFFFF; visuals == 2 ? STYLES.buttonFillColour=0xFFFFFF : STYLES.buttonFillColour=0x456287; visuals == 2 ? STYLES.fillColour = 0xFFFFFF : STYLES.fillColour = 0xD6E0EC; //themeColour STYLES.statusBarColour = statusBarColour = 0x456287; //themeColour STYLES.statusBarAlpha = 100; STYLES.titleBarColour = titleBarColour=0x84A2C6; //themeColour STYLES.titleBarAlpha = 100; visuals == 1 ? STYLES.defaultColour='#2E415A' : STYLES.defaultColour='#000000'; //theme colour STYLES.defaultFont = STYLES.initFont = "Verdana"; STYLES.defaultSize = 12; STYLES.defaultBold = false; STYLES.titleColour = 0xFFFFFF; //themeColour STYLES.titleFont = "Arial"; STYLES.titleSize = 14; STYLES.titleBold = false; //STYLES.pageTitleColour = 0xFFFFFF; //themeColour STYLES.pageTitleFont = "Arial"; STYLES.pageTitleSize = 24; STYLES.pageTitleBold = true; visuals == 2 ? STYLES.statusColour = 0x456287 : STYLES.statusColour = 0xFFFFFF; //themeColour STYLES.statusTextColour = 0xFFFFFF; STYLES.statusFont = "Verdana"; STYLES.statusSize = 12; STYLES.statusBold = false; visuals == 1 ? STYLES.inputColour='#2E415A' : STYLES.inputColour='#000000'; //theme colour STYLES.inputFont = "Verdana"; STYLES.inputSize = 12; STYLES.inputBold = false; visuals == 1 ? STYLES.glossaryColour='#0000FF' : STYLES.glossaryColour='#006699'; //theme colour visuals == 1 ? STYLES.labelColour=0x2E415A : STYLES.labelColour=0x000000; //theme colour //STYLES.buttonOutlineColour = 0xFFFFFF; //themeColour - same as buttonTextColour STYLES.textSelected = 0xFFFFFF; //themeColour - same as statusTextCol visuals == 2 ? STYLES.textUnselected = 0x456287 : STYLES.textUnselected = 0xFFFFFF; //themeColour - same as titleTextCol //for interface controls visuals == 2 ? STYLES.buttonTextColour = 0x456287 : STYLES.buttonTextColour = 0xFFFFFF; //themeColour globalStyleFormat.face = STYLES.buttonFillColour; globalStyleFormat.arrow = 0xFFFFFF; globalStyleFormat.border = 0xFFFFFF; globalStyleFormat.textColor = 0xFFFFFF; globalStyleFormat.textDisabled = 0x999999; globalStyleFormat.textFont = "Tahoma"; globalStyleFormat.highlight3D = 0xFFFFFF; globalStyleFormat.highlight = 0xFFFFFF; globalStyleFormat.focusRectInner = 0xFFFF00; globalStyleFormat.focusRectOuter = 0xFFFF00; globalStyleFormat.applyChanges(); //colours for text statusTextColour = '#'+STYLES.statusTextColour.toString(16); titleTextColour = '#'+STYLES.titleTextColour.toString(16); buttonTextColour = '#'+STYLES.buttonTextColour.toString(16); white = 0xFFFFFF; } //ICON SUPERCLASS -- all icons inherit from this generic class ICON = function () { //xml data this.XMLElement = new Object(); this.titleBarHeight = 0; this.statusBarHeight = 0; }; ICON.prototype = new MovieClip(); ICON.prototype.drawBorder = function(width, colour, alpha) { this.lineStyle(width, colour, alpha); this.drawRect(0, 0, this.w, this.h); }; ICON.prototype.fillIcon = function(colour, alpha) { if (arguments.length == 0) { this.beginFill(STYLES.fillColour, 100); } else { this.beginFill(colour, 100); } this.drawRect(0, this.titleBarHeight, Number(this.w), this.h-this.statusBarHeight - this.titleBarHeight); this.endFill(); }; ICON.prototype.drawTitleBar = function(colour, alpha, height) { if (arguments.length == 0) { this.beginFill(STYLES.titleBarColour, STYLES.titleBarAlpha); } else { this.beginFill(colour, alpha); this.titleBarHeight = height; } this.drawRect(0, 0, Number(this.w), this.titleBarHeight); this.endFill(); }; ICON.prototype.drawStatusBar = function(colour, alpha, height) { if (arguments.length == 0) { this.beginFill(STYLES.statusBarColour, STYLES.statusBarAlpha); } else { this.beginFill(colour, alpha); this.statusBarHeight = height; } this.drawRect(0, this.h-this.statusBarHeight, number(this.w), this.statusBarHeight); this.endFill(); }; ICON.prototype.display = function() { this._visible = true; }; ICON.prototype.erase = function() { this._visible = false; }; ICON.prototype.remove = function() { removeMovieClip(this); }; ICON.prototype.move = function(x, y) { this._x = x; this._y = y; }; ICON.prototype.setRotation = function(degrees) { this._rotation = degrees; }; ICON.prototype.rotateTo = function(degrees, step, clockwise) { this.onEnterFrame = function() { clockwise != false ? this._rotation += step : this._rotation -= step; this.broadcast('onRotateTo'); if (this._rotation == degrees) { delete this.onEnterFrame; this.broadcast('onRotateToComplete'); } }; }; ICON.prototype.fadeTo = function(fade, step) { if (this._alpha>fade) { this.onEnterFrame = function() { this.broadcast('onFadeTo'); this._alpha -= step; if (this._alpha<=fade) { delete this.onEnterFrame; this.broadcast('onFadeToComplete'); } }; } else { this.onEnterFrame = function() { this._alpha += step; this.broadcast('onFadeTo'); if (this._alpha>=fade) { delete this.onEnterFrame; this.broadcast('onFadeToComplete'); } }; } }; ICON.prototype.setScale = function(percent) { this._xscale = percent; this._yscale = percent; }; ICON.prototype.scaleTo = function(target, step) { if (this._xscale>target) { this.onEnterFrame = function() { this._xscale -= step; this._yscale -= step; if (this._xscale<=target) { delete this.onEnterFrame; this.broadcast('onScaleToComplete'); } }; } else { this.onEnterFrame = function() { this._xscale += step; this._yscale += step; if (this._xscale>=target) { delete this.onEnterFrame; this.broadcast('onScaleToComplete'); } }; } }; ICON.prototype.animate = function(newX, newY, speed, style, overUnder) { //overUnder only used for bezier styles and determines whether the objects animates above or below the centre point between x1y1 and x2y2 var x = this._x; var y = this._y; var dx = newX-x; var dy = newY-y; var t = 0; var NFRAMES = speed; //see helpers for extended math functions from Robert Penner this.onEnterFrame = function() { if (t++= y){ if (this.startEvent != true){ this.startEvent = true; this.broadcast('onStartDrag'); } this.broadcast('onDrag'); this._y -= change; } if (Key.isDown(98) && this._y - change <= y + h){ if (this.startEvent != true){ this.startEvent = true; this.broadcast('onStartDrag'); } this.broadcast('onDrag'); this._y += change; } if (Key.isDown(100) && this._x - change >= x){ if (this.startEvent != true){ this.startEvent = true; this.broadcast('onStartDrag'); } this.broadcast('onDrag'); this._x -= change; } if (Key.isDown(102)&& this._x + change <= x + w){ if (this.startEvent != true){ this.startEvent = true; this.broadcast('onStartDrag'); } this.broadcast('onDrag'); this._x += change; } if (Key.isDown(13)){ this.startEvent = false; this.broadcast('onStopDrag'); } } this.onSetFocus = function(){ speak(this._accProps.description); Key.addListener(this); } this.onKillFocus = function(){ this.startEvent = false; Key.removeListener(this); } this.onPress = function(){ this.broadcast('onStartDrag'); this.startDrag(false,x,y,w - this._width,h - this._height); this.onMouseMove = function(){ this.broadcast('onDrag'); updateAfterEvent(); } } this.onRelease = this.onReleaseOutside = function(){ delete this.onMouseMove; this.broadcast('onStopDrag'); this.stopDrag(); } } else { //it's false this.draggable = false; delete this.onPress delete this.onRelease; delete this.onReleaseOutside; delete this.onKillFocus; delete this.onMouseMove; this.onSetFocus = function(){ speak(this._accProps.description); } Key.removeListener(this); } } ICON.prototype.addDraw = function(x, y, w, h, fill) { this.levels++; this.attachMovie("DRAW_Helper", "DRAW"+this.levels, this.levels).init(x, y, w, h,fill); return (this["DRAW"+this.levels]); }; ICON.prototype.addColourPicker = function(x, y) { this.levels++; this.attachMovie("COLPICK", "picker"+(16000+this.levels), 16000+this.levels).init(x, y); return this["picker"+(16000+this.levels)]; }; ICON.prototype.maskObject = function(object) { this.levels++; var mask = this.createEmptyMovieClip('mask'+this.levels, this.levels); mask.beginFill(0x00FF00,60); mask.drawRect(object._x, object._y, object._width, object._height); object.setMask(mask); }; ICON.prototype.snapToGrid = function(xspan, yspan, xgridRef, ygridRef){ this._x = Math.round((this._x+xgridRef)/xspan)*xspan-xgridRef; this._y = Math.round((this._y+ygridRef)/yspan)*yspan-ygridRef; return {x:Math.round((this._x-xgridRef)/xspan), y:Math.round((this._y-ygridRef)/yspan)}; } ICON.prototype.drawPanel = function(x,y,w,h,colour,title,drag){ this.levels++; var pnl = this.createEmptyMovieClip('panel' + this.levels, this.levels); pnl._x = x; pnl._y = y; pnl.createEmptyMovieClip('outerPanel', 0); pnl.outerPanel.beginFill(colour,90); pnl.outerPanel.drawRect(0,0,w,h,5); pnl.outerPanel.bevel(1,90,0xFFFFFF,0x000000); pnl.outerPanel.dropShadow(3,90,0x999999,100); pnl.outerPanel.blendMode = 'multiply'; pnl.createEmptyMovieClip('innerPanel', 1); pnl.innerPanel.beginFill(0xFFFFFF,100); pnl.innerPanel.drawRect(10,30,w-20,h-40); pnl.innerPanel.dropShadow(1,90,0x999999,100); pnl.createTextField('title',3,10,7,100,20); pnl.title.selectable = false; pnl.title.text = title; pnl.title.setTextFormat(new TextFormat('Verdana',10,0x111111,true)); if (drag == true){ pnl.outerPanel.onPress = function(){ this._parent._parent.startDrag(); this._parent._parent.broadcast('onStartDrag'); this.onMouseMove = function(){ this._parent._parent.broadcast("onDrag"); updateAfterEvent(); } } pnl.outerPanel.onRelease = pnl.outerPanel.onReleaseOutside = function(){ this._parent._parent.stopDrag(); this._parent._parent.broadcast("onStopDrag"); delete this.onMouseMove; } } } ICON.prototype.preloadMedia = function(node){ //find all media in this icon's XML this.mediaURLs = new Array(); this.findMedia(node == undefined ? this.XMLElement : node, this); this.preloadCount = this.mediaURLs.length; this.broadcast('onPreloadInit'); this.preload(); } ICON.prototype.findMedia = function(node, callingIcon){ if (node.nodeName == 'DIS' && node.attributes.type == 'ext'){ if (callingIcon.mediaURLs.contains(expression(node.attributes.url, engine)) == false){ callingIcon.mediaURLs.push(expression(node.attributes.url, engine)); } } if (node.nodeName == 'SND' && node.attributes.type == 'ext'){ if (callingIcon.mediaURLs.contains(expression(node.attributes.url, engine)) == false){ callingIcon.mediaURLs.push(expression(node.attributes.url, engine)); } } if (node.nodeName == 'MOV'){ if (callingIcon.mediaURLs.contains(expression(node.attributes.url, engine)) == false){ callingIcon.mediaURLs.push(expression(node.attributes.url, engine)); } } for (var i = 0; i < node.childNodes.length; i++){ this.findMedia(node.childNodes[i], callingIcon); } } ICON.prototype.getProperty = function(prop){ return this.XMLElement.attributes[prop]; } ICON.prototype.preload = function(){ var n = 0; this.createEmptyMovieClip('holder', ++this.levels); this.holder._x = 1600; var loader = new MovieClipLoader(); loader.loadClip(this.mediaURLs[n], this.holder); this.onLoadInit = function(mc){ n++; this.broadcast('onPreloadItem'); if (n < this.mediaURLs.length){ loader.loadClip(this.mediaURLs[n], this.holder); } else { this.holder.removeMovieClip(); delete loader; this.broadcast('onPreloadComplete'); } } loader.addListener(this); } ICON.prototype.constrain = function(w, h){ var p = this._width / this._height; if (p > 1){ //this is landscape if (this._width > w){ this._width = w; this._height = this._width / p; } //is it still too tall? if (this._height > h){ //still too tall this._height = h; this._width = this._height * p; } } else { //this is portrait if (this._height > h){ this._height = h; this._width = this._height * p; } //is it still too wide? if (this._width > w){ this._width = w; this._height = this._width / p; } } } ICON.prototype.getYTile = function(){ return Math.round(this._y + this._height); } ICON.prototype.addProperty("_ytile", ICON.prototype.getYTile, null); Object.registerClass('ICON_Helper', ICON); //DRAW CLASS//This is the SAME class as in drawEdit.fla, and drawEdit is the source - there should be no difference between the two instances//////////////// DRAW = function () {}; DRAW.prototype = new ICON();//this is different... ALSO different is the paths in image() and setData() for image as it uses engine.FileLocation, not drawEdit.FileLocation DRAW.prototype.init = function(x, y, w, h,fill) { this.lineWidth = 0; this.lineColour = 0x000000; this.lineAlpha = 100; this.fillColour = 0xFFFFFF; this.fillAlpha = 100; this.polySides = 3; this.font = 'Arial'; this.fontSize = 12; this.fontBold = 0; this.levels = 10; this.shapes = new Array(); this.currentClip = null; this.selectedShapes = new Array(); this.mode = 'draw'; this._x = x; this._y = y; this.lineStyle(1, 0x000000, 0); this.beginFill(0xFFFFFF, fill == undefined ? 100 : 0); this.drawRect(-w,-h, w*2, h*2); }; DRAW.prototype.initDrawing = function() { delete this.onPress; delete this.onRelease; delete this.onEnterFrame; for (var i = 0; i < this.selectedShapes.length; i++){ this.selectedShapes[i].selection.removeMovieClip(); } this.onMouseUp = function() { this.onEnterFrame = null; }; }; DRAW.prototype.nonEdit = function(){ for (var i = 0; i < this.shapes.length; i++){ this.shapes[i].onPress = null; this.shapes[i].useHandCursor = false; delete this.shapes[i].onRelease; } } DRAW.prototype.allowShapeEvents = function(){ for (var i = 0; i < this.shapes.length; i++){ this.shapes[i].onRelease = function(){ this._parent.currentShape = this; this._parent.broadcast('onShapeRelease'); } this.shapes[i].onRollOver = function(){ this._parent.currentShape = this; this._parent.broadcast('onShapeOver'); } this.shapes[i].onRollOut = function(){ this._parent.currentShape = this; this._parent.broadcast('onShapeOut'); } } } DRAW.prototype.makeAccessible = function(){ //give each shape tab control and fire an event onFOcus this.tabEnabled = false; this.tabChildren = true; for (var i = 0; i < this.shapes.length; i++){ shape = this.shapes[i]; shape.tabEnabled = true; shape.tabIndex = _level0.engine.getTabIndex(); } } DRAW.prototype.selectShape = function(shape) { //manage the selection... if (!Key.isDown(Key.SHIFT)){ this.clearSelectedShapes(); } //select it this.drawSelection(shape); this.selectedShapes.push(shape); this.currentClip = shape; //select any other shapes in the group if (shape.group != "" && !Key.isDown(Key.SHIFT)){ for (i = 0; i < this.shapes.length; i++){ if (this.shapes[i].group == shape.group){ this.drawSelection(this.shapes[i]); this.selectedShapes.push(this.shapes[i]); } } } }; DRAW.prototype.drawSelection = function(shape){ shape.selection.clear(); var bounds = shape.getBounds(shape); shape.createEmptyMovieClip('selection', 1); shape.selection._x = bounds.xMin; shape.selection._y = bounds.yMin; shape.selection.lineStyle(0, 0xFFFF00, 100); shape.selection.drawRect(0,0,bounds.xMax - bounds.xMin, bounds.yMax - bounds.yMin); } DRAW.prototype.selection = function(){ this.mode = 'select'; this.onPress = function() { this.clearSelectedShapes(); this.createEmptyMovieClip('rectSelection', 987); this.rectSelection._x = this._xmouse; this.rectSelection._y = this._ymouse; this.onEnterFrame = function(){ this.rectSelection.clear(); this.rectSelection.lineStyle(0,0xFFFF00,100); this.rectSelection.drawRect(0,0, this.rectSelection._xmouse,this.rectSelection._ymouse); }; }; this.onRelease = function(){ this.clearSelectedShapes(); for (var i = 0; i < this.shapes.length; i++){ if (this.shapes[i].hitTest(this.rectSelection)){ this.drawSelection(this.shapes[i]); this.selectedShapes.push(this.shapes[i]); } } this.rectSelection.removeMovieClip(); delete this.onEnterFrame; delete this.onPress; delete this.onRelease; } } DRAW.prototype.alignShapes = function(align){ for (var i = 1; i < this.selectedShapes.length; i++){ if (align == 'top'){ //works var top = Math.ceil(this.selectedShapes[0].getBounds(this).yMin); var yError = this.selectedShapes[i]._y - Math.ceil(this.selectedShapes[i].getBounds(this).yMin); this.selectedShapes[i]._y = top + yError; } if (align == 'middle'){ var middle = Math.ceil(this.selectedShapes[0].getBounds(this).yMin) + (this.selectedShapes[0]._height / 2); var yError = this.selectedShapes[i]._y - Math.ceil(this.selectedShapes[i].getBounds(this).yMin); this.selectedShapes[i]._y = middle + yError - this.selectedShapes[i]._height / 2; } if (align == 'bottom'){ var bottom = Math.ceil(this.selectedShapes[0].getBounds(this).yMax); var yError = this.selectedShapes[i]._y - Math.ceil(this.selectedShapes[i].getBounds(this).yMin); this.selectedShapes[i]._y = bottom + yError - this.selectedShapes[i]._height; } if (align == 'left'){ //works var left = this.selectedShapes[0]._x - (this.selectedShapes[0]._x - Math.ceil(this.selectedShapes[0].getBounds(this).xMin)); var xError = this.selectedShapes[i]._x - Math.ceil(this.selectedShapes[i].getBounds(this).xMin); this.selectedShapes[i]._x = left + xError; } if (align == 'centre'){ var middle = Math.ceil(this.selectedShapes[0].getBounds(this).xMin) + (this.selectedShapes[0]._width / 2); var xError = this.selectedShapes[i]._x - Math.ceil(this.selectedShapes[i].getBounds(this).xMin); this.selectedShapes[i]._x = middle + xError - this.selectedShapes[i]._width / 2; } if (align == 'right'){ var right = Math.ceil(this.selectedShapes[0].getBounds(this).xMax); var xError = this.selectedShapes[i]._x - Math.ceil(this.selectedShapes[i].getBounds(this).xMin); this.selectedShapes[i]._x = right + xError - this.selectedShapes[i]._width; } } } DRAW.prototype.clearSelectedShapes = function(){ for (var i = 0; i < this.selectedShapes.length; i++){ this.selectedShapes[i].selection.removeMovieClip(); } this.selectedShapes = new Array(); } DRAW.prototype.addShape = function(type) { this.levels++; this.createEmptyMovieClip('shape'+this.levels, this.levels); var shape = this['shape'+this.levels]; shape.type = type; shape.lw = this.lineWidth; shape.lc = this.lineColour; shape.la = this.lineAlpha; shape.fc = this.fillColour; shape.fa = this.fillAlpha; shape.label = ""; shape.info = ""; shape.group = ""; shape.index = ""; shape.objDraw = this; this.shapes.push(shape); shape.manageSelection = function(){ if (this.objDraw.selectedShapes.findValue(this) == -1){ this.objDraw.selectShape(this); this.objDraw._parent.setProperties(this); } else { //already selected - so remove from selection if (Key.isDown(Key.SHIFT)){ this.objDraw.selectedShapes.deleteAtIndex(this.objDraw.selectedShapes.findValue(this)); this.selection.removeMovieClip(); //remove any other shapes in the group if (this.group != ""){ for (var i = 0; i < this.objDraw.selectedShapes.length; i++){ if (this.objDraw.selectedShapes[i].group == this.group){ this.objDraw.selectedShapes[i].selection.removeMovieClip() this.objDraw.selectedShapes.deleteAtIndex(i); i--; } } } } } } shape.onPress = function() { if (this.objDraw.mode == 'select') { this.manageSelection(); } if (this.objDraw.mode == 'move'){ this.manageSelection(); //allow movement to cease... this.onRelease = this.onReleaseOutside = function() { for (var i = 0; i < this._parent.selectedShapes.length; i++){ delete this._parent.selectedShapes[i].onMouseMove; } this.objDraw.lineWidth = this.lw; this.objDraw.lineColour = this.lc; this.objDraw.lineAlpha = this.la; this.objDraw.fillColour = this.fc; this.objDraw.fillAlpha = this.fa; this.objDraw._parent.setProperties(this); }; //make 'em move... for (var i = 0; i < this._parent.selectedShapes.length; i++){ //cant's drag more than one shape, so have to use onMouseMove... this._parent.selectedShapes[i].xDiff = this._parent.selectedShapes[i]._x - this._parent._xmouse; this._parent.selectedShapes[i].yDiff = this._parent.selectedShapes[i]._y - this._parent._ymouse; this._parent.selectedShapes[i].onMouseMove = function(){ if (!Key.isDown(Key.SHIFT)){ this._x = this._parent._xmouse + this.xDiff; this._y = this._parent._ymouse + this.yDiff; updateAfterEvent(); } }; } } if (this.objDraw.mode == 'rotate') { this.manageSelection(); this.onRelease = this.onReleaseOutside = function() { for (var i = 0; i < this._parent.selectedShapes.length; i++){ delete this._parent.onMouseMove; } }; this._parent.lastYMouse = this._parent._ymouse; this._parent.onMouseMove = function(){ var fac = this.lastYMouse - this._ymouse; this.lastYMouse = this._ymouse; for (var i = 0; i < this.selectedShapes.length; i++){ this.selectedShapes[i]._rotation += fac; updateAfterEvent(); } } } }; shape.refreshShape = function(lw,lc,la,fc,fa){ //params are optional - only used from public calls from outside. Draw class only uses () this.clear(); if (lw == undefined){ this.objDraw.resetStyles(); } else { this.lineStyle(lw,lc,la); this.beginFill(fc,fa); } if (this.type == 'line'){ this.moveTo(0,0); this.lineTo(this.x2,this.y2); } if (this.type == 'curve'){ this.beginFill(); this.moveTo(0,0); this.curveTo(this.x3,this.y3,this.x2,this.y2); } if (this.type == 'free'){ this.beginFill(); var coordData = this.p.split("~"); this.moveTo(0,0); for (var j = 1 ; j < coordData.length; j++){ this.lineTo(coordData[j].split(",")[0], coordData[j].split(",")[1]); } } if (this.type == 'pen'){ this.moveTo(0,0); var points = this.p.split('~'); for (var i = 0; i < points.length; i++){ this.curveTo(points[i].split(',')[2], points[i].split(',')[3], points[i].split(',')[0], points[i].split(',')[1]); } } if (this.type == 'ngon'){ var coordData = this.p.split("~"); this.moveTo(0,0); for (var j = 1 ; j < coordData.length; j++){ this.lineTo(coordData[j].split(",")[0], coordData[j].split(",")[1]); } } if (this.type == 'rect') { this.drawRect(0,0, this.x2, this.y2); } if (this.type == 'oval') { this.drawOval(0, 0, this.x2, this.y2); } if (this.type == 'poly') { this.drawPoly(0, 0, this.n, this.x2); } if (this.type == 'star') { this.drawStar(0,0, this.n, this.x2, this.y2, 0); } if (this.type == 'burst') { this.drawBurst(0,0, this.n, this.x2, this.y2, 0); } if (this.type == 'gear') { this.drawGear(0,0, this.n, this.x2, this.y2, 0); } if (this.type == 'wedge') { this.drawWedge(0,0,0, this.y2, this.x2); } if (this.type == 'arrow') { this.drawArrow(0,0,this.x2, this.y2); } if (this.type == 'text') { this.txt.setTextFormat(new TextFormat(this.f, this.n, this.lc)); } } return shape; }; DRAW.prototype.dragStage = function(){ this.onPress = function(){ this.startDrag(false); } this.onRelease = function(){ delete this.onPress; delete this.onRelease; this.stopDrag(); } } DRAW.prototype.freehand = function(col, width) { this.initDrawing(); this.onPress = function() { this.currentClip = this.addShape('free'); this.currentClip._x = this._xmouse; this.currentClip._y = this._ymouse; this.currentClip.p = "0,0"; this.currentClip.moveTo(0,0); this.currentClip.lineStyle(this.lineWidth, this.lineColour, this.lineAlpha); this.onEnterFrame = function() { this.currentClip.p += "~" + this.currentClip._xmouse+','+this.currentClip._ymouse; this.currentClip.lineTo(this.currentClip._xmouse, this.currentClip._ymouse); }; }; }; DRAW.prototype.line = function() { this.initDrawing(); this.onPress = function() { this.currentClip = this.addShape('line'); this.currentClip._x = this.initX =this._xmouse; this.currentClip._y = this.initY = this._ymouse; this.resetStyles(); this.onEnterFrame = function() { this.currentClip.clear(); this.resetStyles(); this.currentClip.moveTo(0, 0); this.currentClip.x2 = this.currentClip._xmouse; this.currentClip.y2 =this.currentClip._ymouse; if (Key.isDown(Key.SHIFT)) { //which way are we going... vertical or horizontal... if (this._xmouse-this.initX > this._ymouse-this.initY) { this.currentClip.lineTo(this.currentClip.x2, 0); this.currentClip.y2 = 0; //catch right values, not _xmouse / _ymouse } else { this.currentClip.lineTo(0, this.currentClip.y2); this.currentClip.x2 = 0; } } else { this.currentClip.lineTo(this.currentClip.x2,this.currentClip.y2); } }; }; }; DRAW.prototype.curve = function() { this.initDrawing(); this.onPress = function() { //step one this.currentClip = this.addShape('curve'); this.currentClip._x = this.initX=this._xmouse; this.currentClip._y = this.initY=this._ymouse; this.resetStyles(); //step one - draw the line this.onEnterFrame = function() { this.currentClip.clear(); this.resetStyles(); this.currentClip.moveTo(0, 0); this.currentClip.lineTo(this._xmouse-this.initX, this._ymouse-this.initY); }; }; //override the default behavious this.onMouseUp = function() { this.currentClip.x2 = this.currentClip._xmouse; this.currentClip.y2 = this.currentClip._ymouse; this.onMouseDown = function() { this.onEnterFrame = null; }; this.onEnterFrame = function() { this.currentClip.clear(); this.currentClip.lineStyle(this.lineWidth, this.lineColour, this.lineAlpha); this.currentClip.x3 = this.currentClip._xmouse; this.currentClip.y3 = this.currentClip._ymouse; this.currentClip.moveTo(0, 0); this.currentClip.curveTo(this.currentClip.x3, this.currentClip.y3, this.currentClip.x2, this.currentClip.y2); }; delete this.onMouseUp; delete this.onPress; }; }; DRAW.prototype.image = function(path){ this.currentClip = this.addShape('image'); this.currentClip.createEmptyMovieClip('img', 0); this.currentClip.p = path; this.currentClip.img.loadMovie(engine.FileLocation + path); } DRAW.prototype.freeShape = function(){ this.initDrawing(); this.onRelease = function() { //step one this.currentClip = this.addShape('ngon'); this.currentClip._x = this.initX = this._xmouse; this.currentClip._y = this.initY = this._ymouse; this.currentClip.p = "0,0"; this.resetStyles(); //step one - draw the line this.onEnterFrame = function(){ this.currentClip.clear(); this.resetStyles(); this.currentClip.moveTo(0,0); this.currentClip.lineTo(this.currentClip._xmouse, this.currentClip._ymouse); } this.onRelease = function(){ this.onEnterFrame = function(){ this.currentClip.clear(); this.resetStyles(); this.currentClip.moveTo(0,0); var points = this.currentClip.p.split('~'); for (var i = 1; i < points.length; i++){ this.currentClip.lineTo(points[i].split(',')[0], points[i].split(',')[1]); } this.currentClip.lineTo(this.currentClip._xmouse, this.currentClip._ymouse); this.currentClip.lineStyle(); } //are we done yet? if (this.currentClip._xmouse > -5 && this.currentClip._xmouse <5 && this.currentClip._ymouse > -5 && this.currentClip._ymouse <5){ this.currentClip.p += '~0,0'; delete this.onEnterFrame; delete this.onRelease; } else { this.currentClip.p += '~' + this.currentClip._xmouse + "," + this.currentClip._ymouse; } } }; } DRAW.prototype.pen = function(){ this.initDrawing(); this.penMode = 'init'; this.onRelease = function() { //step one if (this.penMode == 'init'){ this.currentClip = this.addShape('pen'); this.currentClip._x = this.initX = this._xmouse; this.currentClip._y = this.initY = this._ymouse; this.currentClip.p = ""; this.penMode = 'line'; } else if (this.penMode == 'line'){ this.currentClip.lastX = this.currentClip._xmouse; this.currentClip.lastY = this.currentClip._ymouse; //are we done... if (this.currentClip.lastX > -5 && this.currentClip.lastX < 5 && this.currentClip.lastY > -5 && this.currentClip.lastY < 5){ this.currentClip.lastX = 0; this.currentClip.lastY = 0; this.currentClip.p += '0,0'; } else { this.currentClip.p += this.currentClip._xmouse + ',' + this.currentClip._ymouse; } this.penMode = 'curve'; } else if (this.penMode == 'curve'){ this.currentClip.p += ',' + this.currentClip._xmouse + ',' + this.currentClip._ymouse + '~'; this.penMode = 'line'; } this.onEnterFrame = function(){ //draw the shape this.currentClip.clear(); this.resetStyles(); //draw all the points in currentClip.p: this.currentClip.moveTo(0,0); var points = this.currentClip.p.split('~'); for (var i = 0; i < points.length - 1; i++){ this.currentClip.curveTo(points[i].split(',')[2], points[i].split(',')[3], points[i].split(',')[0], points[i].split(',')[1]); } //draw the last bit to the cursor which may be moving... if (this.penMode == 'line'){ if (this.currentClip.lastX == 0 && this.currentClip.lastY == 0){ //don't do any more... delete this.onEnterFrame; delete this.onRelease; } else { this.currentClip.lineTo(this.currentClip._xmouse, this.currentClip._ymouse); } } else if (this.penMode == 'curve') { this.currentClip.curveTo(this.currentClip._xmouse, this.currentClip._ymouse, this.currentClip.lastX, this.currentClip.lastY);//,0);//points[points.length-1].split(',')[2], points[points.length-1].split(',')[3]);//, this.currentClip._xmouse, this.currentClip._ymouse ); } this.currentClip.lineStyle(); } } } DRAW.prototype.rectangle = function() { this.initDrawing(); this.onPress = function() { this.currentClip = this.addShape('rect'); this.currentClip._x = this.initX = this._xmouse; this.currentClip._y = this.initY = this._ymouse; this.resetStyles(); this.onEnterFrame = function(){ this.currentClip.clear(); this.resetStyles(); this.currentClip.x2 = this.currentClip._xmouse; this.currentClip.y2 = this.currentClip._ymouse; if (Key.isDown(Key.SHIFT)) { this.currentClip.y2 = this.currentClip.x2; this.currentClip.drawRect(0,0, this.currentClip.x2, this.currentClip.x2, this.cornerRadius); } else { this.currentClip.drawRect(0,0, this.currentClip.x2, this.currentClip.y2, this.cornerRadius); } }; }; }; DRAW.prototype.circle = function() { this.initDrawing(); this.onPress = function() { this.currentClip = this.addShape('oval'); this.currentClip._x = this.initX=this._xmouse; this.currentClip._y = this.initY=this._ymouse; this.resetStyles(); this.onEnterFrame = function() { this.currentClip.clear(); this.currentClip.x2 = Math.abs(this.initX-this._xmouse); this.currentClip.y2 = Math.abs(this.initY-this._ymouse); this.resetStyles(); if (Key.isDown(Key.SHIFT)) { this.currentClip.y2 = this.currentClip.x2; this.currentClip.drawOval(0, 0, this.currentClip.x2, this.currentClip.x2); } else { this.currentClip.drawOval(0, 0, this.currentClip.x2, this.currentClip.y2); } }; }; }; DRAW.prototype.poly = function() { this.initDrawing(); this.onPress = function() { this.currentClip = this.addShape('poly'); this.currentClip._x = this.initX=this._xmouse; this.currentClip._y = this.initY=this._ymouse; this.currentClip.n = this.polySides; this.currentClip.x2 = Math.abs(this.initX-this._xmouse); this.resetStyles(); this.onEnterFrame = function() { this.currentClip.clear(); this.resetStyles(); this.currentClip.x2 = Math.abs(this.initX-this._xmouse); this.currentClip.drawPoly(0, 0, this.currentClip.n, this.currentClip.x2); }; }; }; DRAW.prototype.star = function(){ this.initDrawing(); this.onPress = function() { //step one this.currentClip = this.addShape('star'); this.currentClip._x = this.initX = this._xmouse; this.currentClip._y = this.initY = this._ymouse; this.currentClip.n = this.polySides; this.currentClip.x2 = 0; this.currentClip.y2 = 0; this.resetStyles(); //step one - draw the line this.onEnterFrame = function() { this.currentClip.clear(); this.resetStyles(); this.currentClip.x2 = Math.abs(this.initY-this._ymouse); this.currentClip.drawStar(0,0, this.currentClip.n, this.currentClip.x2, this.currentClip.x2, 0); }; }; //override the default behavious this.onMouseUp = function() { this.currentClip.y2 = Math.abs(this.initY-this._ymouse); this.onMouseDown = function() { this.onEnterFrame = null; }; this.onEnterFrame = function() { this.currentClip.clear(); this.resetStyles(); this.currentClip.y2 = Math.abs(this.initY-this._ymouse); this.currentClip.drawStar(0,0, this.currentClip.n, this.currentClip.x2, this.currentClip.y2, 0); }; delete this.onMouseUp; delete this.onPress; }; } DRAW.prototype.burst = function(){ this.initDrawing(); this.onPress = function() { //step one this.currentClip = this.addShape('burst'); this.currentClip._x = this.initX = this._xmouse; this.currentClip._y = this.initY = this._ymouse; this.currentClip.n = this.polySides; this.currentClip.x2 = 0; this.currentClip.y2 = 0; this.resetStyles(); //step one - draw the line this.onEnterFrame = function() { this.currentClip.clear(); this.resetStyles(); this.currentClip.x2 = Math.abs(this.initY-this._ymouse); this.currentClip.drawBurst(0,0, this.currentClip.n, this.currentClip.x2, this.currentClip.x2, 0); }; }; //override the default behavious this.onMouseUp = function() { this.currentClip.y2 = Math.abs(this.initY-this._ymouse); this.onMouseDown = function() { this.onEnterFrame = null; }; this.onEnterFrame = function() { this.currentClip.clear(); this.resetStyles(); this.currentClip.y2 = Math.abs(this.initY-this._ymouse); this.currentClip.drawBurst(0,0, this.currentClip.n, this.currentClip.x2, this.currentClip.y2, 0); }; delete this.onMouseUp; delete this.onPress; }; } DRAW.prototype.gear = function(){ this.initDrawing(); this.onPress = function() { //step one this.currentClip = this.addShape('gear'); this.currentClip._x = this.initX = this._xmouse; this.currentClip._y = this.initY = this._ymouse; this.currentClip.n = this.polySides; this.currentClip.x2 = 0; this.currentClip.y2 = 0; this.resetStyles(); //step one - draw the line this.onEnterFrame = function() { this.currentClip.clear(); this.resetStyles(); this.currentClip.x2 = Math.abs(this.initY-this._ymouse); this.currentClip.drawGear(0,0, this.currentClip.n, this.currentClip.x2, this.currentClip.x2, 0); }; }; //override the default behavious this.onMouseUp = function() { this.currentClip.y2 = Math.abs(this.initY-this._ymouse); this.onMouseDown = function() { this.onEnterFrame = null; }; this.onEnterFrame = function() { this.currentClip.clear(); this.resetStyles(); this.currentClip.y2 = Math.abs(this.initY-this._ymouse); this.currentClip.drawGear(0,0, this.currentClip.n, this.currentClip.x2, this.currentClip.y2, 0); }; delete this.onMouseUp; delete this.onPress; }; } DRAW.prototype.wedge = function(){ this.initDrawing(); this.onPress = function() { //step one this.currentClip = this.addShape('wedge'); this.currentClip._x = this.initX = this._xmouse; this.currentClip._y = this.initY = this._ymouse; this.currentClip.n = this.polySides; this.currentClip.x2 = 0; this.currentClip.y2 = 0; this.resetStyles(); //step one - draw the line this.onEnterFrame = function() { //gert radius this.currentClip.clear(); this.resetStyles(); this.currentClip.x2 = Math.abs(this.initX-this._xmouse); this.currentClip.moveTo(0,0); this.currentClip.lineTo(this.currentClip.x2, 0); }; }; //override the default behavious this.onMouseUp = function() { this.currentClip.y2 = Math.abs(this.initY-this._ymouse); this.onMouseDown = function() { this.onEnterFrame = null; }; this.onEnterFrame = function() { this.currentClip.clear(); this.resetStyles(); this.currentClip.y2 = Math.abs(this.initY-this._ymouse); this.currentClip.drawWedge(0,0,0, this.currentClip.y2, this.currentClip.x2); }; delete this.onMouseUp; delete this.onPress; }; } DRAW.prototype.arrow = function(){ this.initDrawing(); this.onPress = function() { this.currentClip = this.addShape('arrow'); this.currentClip._x = this.initX = this._xmouse; this.currentClip._y = this.initY = this._ymouse; this.resetStyles(); this.onEnterFrame = function(){ this.currentClip.clear(); this.resetStyles(); this.currentClip.x2 = this.currentClip._xmouse; this.currentClip.y2 = this.currentClip._ymouse; this.currentClip.drawArrow(0,0, this.currentClip.x2, this.currentClip.y2); }; }; } DRAW.prototype.text = function() { this.initDrawing(); this.onPress = function() { this.stopDraw(); this.currentClip = this.addShape('text'); this.currentClip.s = this.fontSize; if (this.fontSize == undefined) trace("FONT SIZE UNDEFINED"); this.currentClip.f = this.font; this.currentClip.b = (this.fontBold == true ? 1 : 0); this.addTextField(this._xmouse, this._ymouse,100, 'Text', this.font, this.fontSize, this.lineColour, this.fontBold); }; }; DRAW.prototype.addTextField = function(x,y,w,text,font,size,col,weight){ this.currentClip._x = this.initX = x; this.currentClip._y = this.initY = y; this.currentClip.x2 = w; delete this.currentClip.onPress; this.currentClip.createTextField("txt", 0, 0, 0, w, 20); this.currentClip.txt.type = 'input'; this.currentClip.txt.selectable = true; this.currentClip.txt.wordWrap = true; this.currentClip.txt.multiline = true; this.currentClip.txt.autoSize = "left"; this.currentClip.txt.text = text; this.currentClip.txt.setTextFormat(new TextFormat(font, size, col, weight == 1 ? true : false));// this.lineColour)); //draw a resize handle this.currentClip.createEmptyMovieClip('sizer', 90); this.currentClip.sizer.beginFill(0xFFFFFF, 50); this.currentClip.sizer.lineStyle(0, 0x000000, 100); this.currentClip.sizer.drawRect(0, 0, 10, 10); this.currentClip.sizer._x = this.currentClip.txt._width-5; this.currentClip.sizer._y = this.currentClip.txt._y-5; //draw a move handle this.currentClip.createEmptyMovieClip('mover', 100); this.currentClip.mover.beginFill(0xFFFFFF, 50); this.currentClip.mover.lineStyle(0, 0x000000, 100); this.currentClip.mover.drawRect(0, 0, 10, 10); this.currentClip.mover._x = -5; this.currentClip.mover._y = -5; this.currentClip.mover._visible = false; this.currentClip.sizer._visible = false; this.currentClip.sizer.onPress = function() { this.startDrag(false, -5, this._y, 1000, this._y); this.onMouseMove = function() { this._visible = true; this._parent.txt._width = this._x+5; this._parent._parent.drawSelection(this._parent); }; }; this.currentClip.sizer.onRelease = this.currentClip.sizer.onReleaseOutside=function () { this.stopDrag(); this._parent.x2 = this._parent.txt._width; delete this.onMouseMove; }; this.currentClip.mover.onPress = function() { this._visible = true; this._parent.sizer._visible = true; this._parent.startDrag(); }; this.currentClip.mover.onRelease = this.currentClip.mover.onReleaseOutside = function () { this._parent.stopDrag(); }; this.currentClip.txt.onSetFocus = function() { this._parent.sizer._visible = true; this._parent.mover._visible = true; //select it this._parent._parent.selectShape(this._parent); //set the properties drawEdit.props.shapeX.text = this._parent._x; drawEdit.props.shapeY.text = this._parent._y; drawEdit.props.shapeX2.text = this._parent.x2; drawEdit.props.shapeLabel.text = (this._parent.label != undefined ? this._parent.label : ""); drawEdit.props.shapeGroup.text = (this._parent.group != undefined ? this._parent.group : ""); drawEdit.props.shapeIndex.text = (this._parent.index != undefined ? this._parent.index : ""); drawEdit.props.shapeInfo.text = (this._parent.info != undefined ? this._parent.info : ""); drawEdit.props.linePicker.setColour(this._parent.lc); drawEdit.props.cboFont.selectedItem = this._parent.f; for (var i = 0; i < drawEdit.props.cboFont.length; i++){ if (drawEdit.props.cboFont.getItemAt(i).label == this._parent.f){ drawEdit.props.cboFont.selectedIndex = i; break; } } drawEdit.props.txtFontSize.text = this._parent.s; drawEdit.props.chkBold.selected = this._parent.b == 1 ? true : false; drawEdit.props.enableControls('text'); }; this.currentClip.txt.onKillFocus = function(newObj) { this._parent.sizer._visible = false; this._parent.mover._visible = false; }; this.currentClip.txt.onChanged = function() { this._parent._parent.drawSelection(this._parent); }; this.resetStyles(); } DRAW.prototype.resetStyles = function() { //store the fill and line settings for re-drawing this.currentClip.lw = this.lineWidth; this.currentClip.lc = (this.lineColour == undefined ? -1 : this.lineColour); this.currentClip.la = this.lineAlpha; this.currentClip.fc = (this.fillColour == undefined ? -1 : this.fillColour); this.currentClip.fa = this.fillAlpha; if (this.currentClip.lc == -1){ this.currentClip.lineStyle(); } else { this.currentClip.lineStyle(this.lineWidth, this.lineColour, this.lineAlpha); } if (this.currentClip.fc == -1){ this.currentClip.beginFill(); } else { this.currentClip.beginFill(this.fillColour, this.fillAlpha); } }; DRAW.prototype.setMode = function(mode) { this.stopDraw(); this.mode = mode; }; DRAW.prototype.stopDraw = function() { delete this.onMouseUp; delete this.onPress; delete this.onMouseMove; }; DRAW.prototype.duplicateShape = function() { for (var i = 0; i < this.selectedShapes.length; i++){ this.shapes.push(this.shapes[this.shapes.findValue(this.selectedShapes[i])]); } this.setData(this.getData()); }; DRAW.prototype.rotateCW = function() { this.currentClip._rotation += 90; }; DRAW.prototype.rotateCCW = function() { this.currentClip._rotation -= 90; }; DRAW.prototype.hFlip = function() { this.currentClip._xscale = this.currentClip._xscale*-1; }; DRAW.prototype.vFlip = function() { this.currentClip._yscale = this.currentClip._yscale*-1; }; DRAW.prototype.undoDraw = function() { if (this.levels>0) { this.shapes.pop(); this['shape'+this.levels].removeMovieClip(); this.levels--; } }; DRAW.prototype.sendBack = function() { var index = this.shapes.findValue(this.currentClip); if (index>0) { var temp = this.shapes[index]; this.shapes[index] = this.shapes[index-1]; this.shapes[index-1] = temp; //rebuild the display layers - needs to send them away, and bring back to prevent losing event handlers for (var i = 0; i < this.shapes.length; i++){ this.shapes[i].swapDepths(-i); } for (var i = 0; i < this.shapes.length; i++){ this.shapes[i].swapDepths(i); } } }; DRAW.prototype.bringForward = function() { var index = this.shapes.findValue(this.currentClip); if (index'; } this.shapeData += ""; this.shapeXML = new XML(this.shapeData); for (var i = 0; i < this.shapeXML.firstChild.childNodes.length; i++){ //strip out all default values var params = this.shapeXML.firstChild.childNodes[i].attributes; if (params.lw == '0') delete params.lw; if (params.lc == '0') delete params.lc; if (params.la == '100') delete params.la; if (params.fc == '16777215') delete params.fc; if (params.fa == '100') delete params.fa; if (params.r == '0') delete params.r; if (params.xs == '100') delete params.xs; if (params.ys == '100') delete params.ys; if (params.label == '') delete params.label; if (params.group == '') delete params.group; if (params.index == '') delete params.index; for (var j = 0; j < params.length; j++){ if (params[j] == 'undefined') delete params[j]; } } trace(this.shapeXML.toString()); this.setData(this.shapeXML.toString()); return this.shapeXML.toString(); } DRAW.prototype.setData = function(xmlData){ this.eraseAll(); var shapeData = new XML(xmlData); shapeData = shapeData.firstChild; for (var i = 0; i < shapeData.childNodes.length; i++){ var params = shapeData.childNodes[i].attributes; //plug in the defaults if (params.lw == undefined) params.lw = '0'; if (params.lc == undefined) params.lc = '0'; if (params.la == undefined) params.la = '100'; if (params.fc == undefined) params.fc = '16777215'; if (params.fa == undefined) params.fa = '100'; if (params.r == undefined) params.r = '0'; if (params.xs == undefined) params.xs = '100'; if (params.ys == undefined) params.ys = '100'; if (params.label == undefined) params.label = ''; if (params.group == undefined) params.group = ''; if (params.index == undefined) params.index = ''; this.setLinesAndFills(shapeData.childNodes[i]); this.currentClip = this.addShape(params.type); this.resetStyles(); this.currentClip._x = Number(params.x); this.currentClip._y = Number(params.y); this.currentClip.x2 = Number(params.x2); this.currentClip.y2 = Number(params.y2); this.currentClip.p = params.p; this.currentClip.label = params.label; this.currentClip.group = params.group; this.currentClip.index = params.index; if (shapeData.childNodes[i].firstChild.nodeValue != undefined){ this.currentClip.info = shapeData.childNodes[i].firstChild.nodeValue; } else { this.currentClip.info = ''; } if (params.type == 'image'){ this.currentClip.createEmptyMovieClip('img', 0); var loader = new MovieClipLoader(); loader.loadClip(engine.FileLocation + this.currentClip.p, this.currentClip.img); this.currentClip.onLoadInit = function(mc){ this._parent.broadcast('onLoadImage'); } loader.addListener(this.currentClip); } if (params.type == 'free'){ this.currentClip.beginFill(); var coordData = params.p.split("~"); this.currentClip.moveTo(0,0); for (var j = 1 ; j < coordData.length; j++){ this.currentClip.lineTo(coordData[j].split(",")[0], coordData[j].split(",")[1]); } } if (params.type == 'ngon'){ var coordData = params.p.split("~"); this.currentClip.moveTo(0,0); for (var j = 1 ; j < coordData.length; j++){ this.currentClip.lineTo(coordData[j].split(",")[0], coordData[j].split(",")[1]); } } if (params.type == 'pen'){ this.moveTo(0,0); var points = params.p.split('~'); for (var j = 0; j < points.length - 1; j++){ this.currentClip.curveTo(points[j].split(',')[2], points[j].split(',')[3], points[j].split(',')[0], points[j].split(',')[1]); } } if (params.type == 'line'){ this.currentClip.moveTo(0,0); this.currentClip.lineTo(params.x2,params.y2); } if (params.type == 'curve'){ this.currentClip.beginFill(); this.currentClip.x3 = params.x3; this.currentClip.y3 = params.y3; this.currentClip.moveTo(0,0); this.currentClip.curveTo(params.x3,params.y3,params.x2,params.y2); } if (params.type == 'rect'){ this.currentClip.drawRect(0, 0,Number(params.x2),Number(params.y2)); } if (params.type == 'oval'){ this.currentClip.drawOval(0, 0, Number(params.x2),Number(params.y2)); } if (params.type == 'poly'){ this.currentClip.n = params.n; this.currentClip.drawPoly(0, 0, params.n, params.x2); } if (params.type == 'star'){ this.currentClip.n = params.n; this.currentClip.drawStar(0,0, params.n, params.x2, params.y2, 0); } if (params.type == 'burst'){ this.currentClip.n = params.n; this.currentClip.drawBurst(0,0, params.n, params.x2, params.y2, 0); } if (params.type == 'gear'){ this.currentClip.n = params.n; this.currentClip.drawGear(0,0, params.n, params.x2, params.y2, 0); } if (params.type == 'wedge'){ this.currentClip.drawWedge(0,0,0, params.y2, params.x2); } if (params.type == 'text'){ this.currentClip.s = params.s; this.currentClip.f = params.f; this.currentClip.b = params.b; this.addTextField(params.x, params.y, params.x2, params.t, params.f,params.s, params.lc, params.b); } if (params.type == 'arrow'){ this.currentClip.drawArrow(params.x, params.y, params.x2, params.y2); } this.currentClip._rotation = params.r; this.currentClip._xscale = params.xs; this.currentClip._yscale = params.ys; } } DRAW.prototype.changeDimensions = function(){ this.currentClip.clear(); this.resetStyles(); if (this.currentClip.type == 'rect'){ this.currentClip.drawRect(0, 0,this.currentClip.x2,this.currentClip.y2); } if (this.currentClip.type == 'oval'){ this.currentClip.drawOval(0, 0, this.currentClip.x2,this.currentClip.y2); } if (this.currentClip.type == 'poly'){ this.currentClip.drawPoly(0, 0, this.currentClip.n, this.currentClip.x2); } if (this.currentClip.type == 'star'){ this.currentClip.drawStar(0,0, this.currentClip.n, this.currentClip.x2, this.currentClip.y2, 0); } if (this.currentClip.type == 'burst'){ this.currentClip.drawBurst(0,0, this.currentClip.n, this.currentClip.x2, this.currentClip.y2, 0); } if (this.currentClip.type == 'gear'){ this.currentClip.drawGear(0,0, this.currentClip.n, this.currentClip.x2, this.currentClip.y2, 0); } if (this.currentClip.type == 'wedge'){ this.currentClip.drawWedge(0, 0, 0, this.currentClip.y2, this.currentClip.x2); } if (this.currentClip.type == 'arrow'){ this.currentClip.drawArrow(0, 0, this.currentClip.x2, this.currentClip.y2); } if (this.currentClip.type == 'text'){ this.currentClip.txt._width = this.currentClip.x2; this.currentClip.sizer._x = this.currentClip.x2; } this.selectShape(this.currentClip); } DRAW.prototype.setLinesAndFills = function(xmlNode){ this.lineWidth = xmlNode.attributes.lw; this.lineColour = xmlNode.attributes.lc; this.lineAlpha = xmlNode.attributes.la; this.fillColour = xmlNode.attributes.fc this.fillAlpha = xmlNode.attributes.fa; } DRAW.prototype.displayOnly = function(){ for ( var i = 0; i < this.shapes.length; i++){ delete this.shapes[i].onPress; delete this.shapes[i].onRelease; if (this.shapes[i].type == 'text'){ delete this.shapes[i].txt.onSetFocus; this.shapes[i].txt.selectable = false; } } } DRAW.prototype.getShapeList = function(rootName){ this.getData(); //sets this.shapeXML which we need return this.shapeXML; } DRAW.prototype.getShapeTree = function(rootName){ this.getData(); //sets this.shapeXML which we need this.shapeTree = new XML(); for (var i = 0; i < this.shapeXML.firstChild.childNodes.length; i++){ if (this.shapeXML.firstChild.childNodes[i].attributes.label == rootName){ var tempNode = this.shapeXML.firstChild.childNodes[i].cloneNode(); tempNode.attributes.index = i; this.shapeTree.appendChild(tempNode); //the root } } //call the recursive builder function this.buildTree(this.shapeTree.firstChild); return this.shapeTree; } DRAW.prototype.buildTree = function(node){ //recursive function //find all children of node in shapeXML, clone and append to node in shapeTree for (var i = 0; i < this.shapeXML.firstChild.childNodes.length; i++){ if (this.shapeXML.firstChild.childNodes[i].attributes.group == node.attributes.label && node.attributes.label != undefined){ var tempNode = this.shapeXML.firstChild.childNodes[i].cloneNode(); tempNode.attributes.index = i; node.appendChild(tempNode); } } //recurse through all children for (var i = 0; i < node.childNodes.length; i++){ this.buildTree(node.childNodes[i]); } } Object.registerClass('DRAW_Helper', DRAW); //COLOUR PICKER//////////////////////////////////////////////////////// COLOURPICKER = function () { }; COLOURPICKER.prototype = new ICON(); COLOURPICKER.prototype.init = function(x, y) { this._x = x; this._y = y; this.colour = '0xFFFFFF'; this.alpha = 100; this.colourRefs = new Array('00', '33', '66', '99', 'CC', 'FF'); this.counter = 0; this.gridVisible = false; this.beginFill(0xFFFFFF, 100); this.drawRect(0, 0, 18, 18); this.btn = this.attachMovie('btnCol', 'btnCol', 0); this.btn.beginFill(0xFFFFFF, 100); this.btn.drawRect(0, 0, 18, 18); this.btn.onRelease = function() { if (this._parent.gridVisible == false) { this._parent.drawGrid(); this._parent.gridVisible = true; } else { this._parent.grid.removeMovieClip(); this._parent.gridVisible = false; } }; }; COLOURPICKER.prototype.setColour = function(colour) { this.colour = colour; this.btn.clear(); this.btn.beginFill(this.colour, this.alpha); this.btn.drawRect(0, 0, 18, 18); this.broadcast('colourChange'); }; COLOURPICKER.prototype.setAlpha = function(alpha) { this.alpha = alpha; this.btn.clear(); this.btn.beginFill(this.colour, this.alpha); this.btn.drawRect(0, 0, 18, 18); this.broadcast('alphaChange'); }; COLOURPICKER.prototype.drawGrid = function() { this.createEmptyMovieClip("grid", 2); //background this.grid.lineStyle(1, 0x333333, 100); this.grid.beginFill(0x999999, 100); this.grid.drawRect(21, 0, 191, 145); //alpha this.grid.createTextField('alpha', 999, 42, 125, 28, 15); this.grid.alpha.selectable = true; this.grid.alpha.type = 'input'; this.grid.alpha.border = true; this.grid.alpha.borderColor = 0x000000; this.grid.alpha.background = true; this.grid.alpha.backgroundColor = 0xFFFFFF; this.grid.alpha.text = this.alpha; this.grid.alpha.restrict = "0-9"; this.grid.alpha.maxChars = 3; this.grid.alpha.setTextFormat(new TextFormat('Arial', 10, 0x000000)); this.grid.alpha.onChanged = function() { this._parent._parent.setAlpha(this.text); }; //manual entry... this.grid.createTextField('manual', 998, 75, 125, 65, 15); this.grid.manual.selectable = true; this.grid.manual.type = 'input'; this.grid.manual.border = true; this.grid.manual.borderColor = 0x000000; this.grid.manual.background = true; this.grid.manual.backgroundColor = 0xFFFFFF; this.grid.manual.text = this.colour; this.grid.manual.restrict = "A-F 0-9 x"; this.grid.manual.maxChars = 8; this.grid.manual.setTextFormat(new TextFormat('Arial', 10, 0x000000)); this.grid.manual.onChanged = function() { this._parent._parent.setColour(this.text) }; //greys for (var i = 0; i<6; i++) { this.addSwatchToGrid(22, i*10, this.colourRefs[i], this.colourRefs[i], this.colourRefs[i]); } //pure and half tones this.addSwatchToGrid(22, 60, 'FF', '00', '00'); this.addSwatchToGrid(22, 70, '00', 'FF', '00'); this.addSwatchToGrid(22, 80, '00', '00', 'FF'); this.addSwatchToGrid(22, 90, 'FF', 'FF', '00'); this.addSwatchToGrid(22, 100, 'FF', '00', 'FF'); this.addSwatchToGrid(22, 110, '00', 'FF', 'FF'); //no colour this.counter++; tempMC = this.grid.createEmptyMovieClip("null", this.counter); tempMC._x = 25; tempMC._y = 125; tempMC.beginFill("0xFFFFFF",100); tempMC.drawRect(0, 0, 15, 15); tempMC.lineStyle(1,0xFF0000,100); tempMC.moveTo(0,0); tempMC.lineTo(15,15); tempMC.moveTo(15,0); tempMC.lineTo(0,15); tempMC.onPress = function(){ this._parent._parent.setColour(undefined); var tempMC = this._parent._parent.btn; tempMC.clear(); tempMC.beginFill(0xFFFFFF); tempMC.drawRect(0, 0, 18, 18); tempMC.lineStyle(1,0xFF0000,100); tempMC.moveTo(2,2); tempMC.lineTo(19,16); tempMC.moveTo(19,2); tempMC.lineTo(2,16); this._parent._parent.gridVisible = false; this._parent.removeMovieClip(); this._parent._parent.gridVisible = false; } //216 colours for (var i = 0; i<6; i++) { for (var j = 0; j<6; j++) { for (var k = 0; k<6; k++) { var x = 32+(i*60)+(j*10); if (i>2) { x -= 180; } var y = k*10; if (i>2) { y += 60; } var r = this.colourRefs[i]; var g = this.colourRefs[j]; var b = this.colourRefs[k]; this.addSwatchToGrid(x, y, r, g, b); } } } }; COLOURPICKER.prototype.addSwatchToGrid = function(x, y, r, g, b) { this.counter++; tempMC = this.grid.createEmptyMovieClip("col"+this.counter, this.counter); tempMC._x = x; tempMC._y = y; //store the properties tempMC.r = r; tempMC.g = g; tempMC.b = b; tempMC.onPress = function() { this._parent._parent.setColour("0x"+this.r+this.g+this.b); this._parent._parent.gridVisible = false; this._parent.removeMovieClip(); }; //draw the right colour in the swatch tempMC.beginFill("0x"+r+g+b); tempMC.drawRect(0, 0, 10, 10); tempMC.endFill(); }; Object.registerClass('COLPICK', COLOURPICKER); ////////////////////////////////////////////////////////////////////////////// //FRAMEWORK CLASS// FRAMEWORK = function () { //not used in favour of init function }; //make it an icon; FRAMEWORK.prototype = new ICON(); //FW Constructor FRAMEWORK.prototype.init = function(swf, ifc) { this.currentPage = 0; this.pages = new Array(); this.levels = 0; if (swf != undefined) { this.createEmptyMovieClip('controller', ++this.levels); this.controller.swapDepths(32000); this.controller.loadMovie(swf); } if (ifc != undefined) { //draw a panel based on the ifc colours at x,y of w,h and add controllers for back, next, and a title var coords = ifc.split(','); var x = Number(coords[0]); var y = Number(coords[1]); var w = Number(coords[2]); var h = Number(coords[3]); var fill = coords[4]; this.lineStyle(2, STYLES.statusBarColour, 100); this.beginFill(STYLES.fillColour, 100); this.drawRect(x, y, w, h); this.lineStyle(); this.beginFill(STYLES.statusBarColour, 100); this.drawRect(x, y+h-35, w, 35); this.beginFill(fill, 100); this.drawRect(x, y, w, h-35); this.attachMovie("backButtonSmall", "backBtn", ++this.levels); this.backBtn._x = x+w-65; this.backBtn._y = y+h-30; this.backBtn.onRelease = function() { this._parent.prevPage(); }; this.backBtn.tabIndex = getTabIndex(); var col = new Color(this.backBtn); col.setRGB(STYLES.statusTextColour); this.backBtn.onSetFocus = function() { speak("Back Button"); }; this.backBtn._accProps = new Object(); this.backBtn._accProps.name = "Back Button"; Accessibility.updateProperties(); this.attachMovie("nextButtonSmall", "nextBtn", ++this.levels); this.nextBtn._x = x+w-30; this.nextBtn._y = y+h-30; this.nextBtn.onRelease = function() { this._parent.nextPage(); }; this.nextBtn.tabIndex = getTabIndex(); var col = new Color(this.nextBtn); col.setRGB(STYLES.statusTextColour); this.nextBtn.onSetFocus = function() { speak("Next Button"); }; this.nextBtn._accProps = new Object(); this.nextBtn._accProps.name = "Next Button"; Accessibility.updateProperties(); } }; //Framework Methods///////////////////////////////////////////////////////////// //showPage - called from below... FRAMEWORK.prototype.killPage = function() { //remove all content from the page using removeMovieClip(); stopSounds, etc... by calling the page's dive function for (var i = 0; i0) { this.closePage(); this.currentPage--; this.openPage(); } }; FRAMEWORK.prototype.firstPage = function() { if (this.currentPage>0) { this.closePage(); this.currentPage = 0; this.openPage(); } }; FRAMEWORK.prototype.lastPage = function() { if (this.currentPage != this.pages.length-1) { this.closePage(); this.currentPage = this.pages.length-1; this.openPage(); } }; FRAMEWORK.prototype.gotoPage = function(pageNum) { this.closePage(); this.currentPage = pageNum; this.openPage(); }; FRAMEWORK.prototype.exit = function() { //move down the flowline... for (var i = this.XMLElement.index()+1; i= 1) { //this.pages[0]._visible = true; //} if (transition == undefined){ this.pages[0]._visible = true; } this["PG_MC"+this.levels].helpString = helpString; if (transition != undefined){ if (transition.substr(0,1) == '{'){ this["PG_MC"+this.levels].transition = engine[transition.substr(1,transition.length - 2)]; } else { this["PG_MC"+this.levels].transition = transition; } } return this["PG_MC"+this.levels]; }; FRAMEWORK.prototype.addEntryFrame = function() { this.levels++; this.attachMovie("PAGE_Helper", "FW_ENT", this.levels).init(); this["FW_ENT"]._visible = true; return this["FW_ENT"]; }; FRAMEWORK.prototype.getPageCount = function() { if (this.XMLElement.firstChild.nodeName == 'FW_ENT') { return this.XMLElement.childNodes.length-1; } else { return this.XMLElement.childNodes.length; } }; FRAMEWORK.prototype.addProperty("pageCount", FRAMEWORK.prototype.getPageCount, null); Object.registerClass("FW_Helper", FRAMEWORK); //DONE FRAMEWORK CLASS - extend it for an interface class/////////////// INTERFACE = function () { }; INTERFACE.prototype = new FRAMEWORK(); INTERFACE.prototype.init = function(x, y, w, h, buttons, swf, helpfile, displayMode) { this._x = x; this._y = y; this.w = w; this.h = h; if (buttons >= 1) { this.titleBarHeight = 50; this.titleBannerHeight = 14; } else { this.titleBarHeight = 0; this.titleBannerHeight = 0; } this.statusBarHeight = 20; this.toc_x = 100; this.toc_y = 100; this.toc_w = 300; this.toc_h = 250; this.toc = false; this.help_x = 200; this.help_y = 200; this.help_w = 200; this.help_h = 300; this.help = false; this.glos_x = 200; this.glos_y = 200; this.glos_w = 250; this.glos_h = 180; this.glos = false; this.currentPage = 0; this.pages = new Array(); this.controls = new Array(); this.masks = new Array(); this.levels = 0; //visuals... this.drawStage(); this.TTSEnabled = false; //draw visuals or not??? if (buttons != 0) { this.visuals = true; if (buttons == 2) { this.clean = true; } else { this.clean = false; } this.drawFW(); //this.levels++; //this.attachMovie("logo", "logo", this.levels); //this.logo._x = 15; //this.logo._y = 7; //var col = new Color(this.logo); //col.setRGB(STYLES.titleColour); //title and status bar... this.levels++; this.createTextField("FWTitle", this.levels, 20, 5, this.w-10, 20); this.FWTitle.selectable = false; this.FWTitle.multiline = true; this.FWTitle.html = true; this.FWTitle.autoSize = "left"; if (this.clean) { this.FWTitle._visible = false; } //pageTitle this.levels++; this.createTextField("pageTitle", this.levels, 20, 17, this.w-10, 20); this.pageTitle.selectable = false; this.pageTitle.multiline = true; this.pageTitle.html = true; this.pageTitle.autoSize = "left"; this.pageTitle.setTextFormat(STYLES.pageTitleFormat); if (this.clean) { this.pageTitle._visible = false; } //textfield for status this.levels++; this.createTextField("FWStatus", this.levels, 5, this.h-this.statusBarHeight, this.w-10, 20); this.FWStatus.selectable = false; this.FWStatus.multiline = true; this.FWStatus.autoSize = "left"; if (this.clean) { this.FWStatus._visible = false; } //navigation buttons this.attachMaskedButton('nextButton', 'nextBtn', this.w-50, 3).onRelease = function() { this._parent.nextPage(); }; this.nextBtn.onSetFocus = function() { speak("Next Page Button"); }; this.nextBtn.tabIndex = 64001; this.controls.push(this.nextBtn); //progress indicator... this.levels += 2; //need to pace the clip first for width / height for mask this.attachMovie("progressIndicator", "progress", this.levels); this.progress._x = this.w-110; this.progress._y = 5; this.progress.createTextField("currentPage", 0, 2, 2, 20, 20); this.progress.currentPage.selectable = false; this.progress.createTextField("pageCount", 1, 16, 20, 20, 20); this.progress.pageCount.selectable = false; this.controls.push(this.progress); //draw the BG to the progress meter... this.createEmptyMovieClip("progBG", this.levels-1); this.progBG.lineStyle(0, 0x000000, 0); this.progBG.beginFill(STYLES.buttonFillColour, 100); this.progBG.moveTo(this.progress._x+1, this.progress._y+1); this.progBG.lineTo(this.progress._x+38, this.progress._y+1); this.progBG.lineTo(this.progress._x+38, this.progress._y+this.progress._height-2); this.progBG.lineTo(this.progress._x+1, this.progress._y+this.progress._height-2); this.progBG.lineTo(this.progress._x+1, this.progress._y+1); this.progBG.endFill(); //previous this.attachMaskedButton('backButton', 'backBtn', this.w-170, 3).onRelease = function() { this._parent.prevPage(); }; this.backBtn.onSetFocus = function() { speak("Previous Page Button"); }; this.backBtn.tabIndex = 64002; this.controls.push(this.backBtn); //toc this.attachMaskedButton('contentsButton', 'tocBtn', this.w-225, 3).onRelease = function() { this._parent.showTOC(); }; this.tocBtn.onSetFocus = function() { speak("Contents Button"); }; this.tocBtn.tabIndex = 64003; this.controls.push(this.tocBtn); //help if (helpfile != undefined){ this.helpfile = helpfile; this.attachMaskedButton('helpButton', 'helpBtn', this.w-280, 3).onRelease = function() { getURL(this._parent.helpfile, "_blank"); }; } this.helpBtn.onSetFocus = function() { speak("Help Button"); }; this.helpBtn.tabIndex = 64007; this.controls.push(this.helpBtn); //continue arrows this.levels += 1; this.attachMovie("continueButton", "contButton", this.levels); this.contButton._x = this.w-120; this.contButton._y = this.h-20; this.contButton.onRelease = function() { this._parent.nextPage(); }; this.contButton.onSetFocus = function() { speak("Continue Button"); }; var col = new Color(this.contButton); col.setRGB(STYLES.statusColour); this.contButton.tabIndex = 64020; //we want this last in the tab order. //this.controls.push(this.contButton); //accessibility button this.attachMovie("FCheckBoxSymbol", "access", ++this.levels); this.access.setLabel("Text to Speech"); this.access._x = 455; this.access._y = this.h - 17; //583; this.access.setSize(110); this.access.setValue(false); this.access.setChangeHandler("toggleVoice"); this.access.tabIndex = 64012; this.access.ifcCtrl = true; this.access.onSetFocus = function() { speak("Text to Speech"); }; //this.themes.setStyleProperty("textSelected", STYLES.titleTextColour); this.access.setStyleProperty("textColor", STYLES.textUnselected); if (_level0.browser == 'ie') { this.access._visible = true; engine.selfVoice = false; } else { this.access._visible = false; engine.selfVoice = false; } this.attachMovie("FComboBoxSymbol", "themes", ++this.levels); this.themes._x = 10; this.themes._y = this.h - 19; this.themes.setSize(120); this.themes.addItem('--Colour Scheme--'); this.themes.addItem('default'); this.themes.addItem('grey'); this.themes.addItem('red'); this.themes.addItem('orange'); this.themes.addItem('purple'); this.themes.addItem('blue'); this.themes.addItem('green'); this.themes.addItem('high contrast 1'); this.themes.addItem('high contrast 2'); this.themes.setChangeHandler('changeTheme'); this.themes.setStyleProperty("background", STYLES.statusBarColour); this.themes.setStyleProperty("selection", STYLES.titleBarColour); this.themes.setStyleProperty("textColor", STYLES.textUnselected); this.themes.setStyleProperty("textSelected", STYLES.textSelected); this.themes.tabEnabled = true; this.themes.onSetFocus = function() { speak("Colour Options"); }; this.themes.tabIndex = 64008; this.themes.ifcCtrl = true; if (this.clean) { this.themes._visible = false; } this.attachMovie("FComboBoxSymbol", "sizes", ++this.levels); this.sizes._x = 140; this.sizes._y = this.h-19; this.sizes.addItem('--Screen Size--'); this.sizes.addItem('default'); this.sizes.addItem('large'); this.sizes.addItem('larger'); this.sizes.addItem('full screen'); this.sizes.addItem('fill window'); this.sizes.setChangeHandler('getSize'); this.sizes.setStyleProperty("background", STYLES.statusBarColour); this.sizes.setStyleProperty("selection", STYLES.titleBarColour); this.sizes.setStyleProperty("textColor", STYLES.textUnselected); this.sizes.setStyleProperty("textSelected", STYLES.textSelected); this.sizes.tabIndex = 64009; this.sizes.onSetFocus = function() { speak("Screen Size Options"); }; this.sizes.ifcCtrl = true; if (this.clean) { this.sizes._visible = false; } this.attachMovie("FComboBoxSymbol", "fonts", ++this.levels); this.fonts._x = 250; this.fonts._y = this.h-19; this.fonts.addItem('--Text Font--'); this.fonts.addItem('default'); var fontList = TextField.getFontList(); fontList.sort(); for (var i = 0; i < fontList.length; i++){ this.fonts.addItem(fontList[i]); } this.fonts.setStyleProperty("background", STYLES.statusBarColour); this.fonts.setStyleProperty("selection", STYLES.titleBarColour); this.fonts.setStyleProperty("textColor", STYLES.textUnselected); this.themes.setStyleProperty("textSelected", STYLES.textSelected); this.fonts.setSize(95); this.fonts.setChangeHandler('changeFont'); this.fonts.onSetFocus = function() { speak("Font Options"); }; this.fonts.tabIndex = 64010; this.fonts.ifcCtrl = true; if (this.clean) { this.fonts._visible = false; } //text size this.attachMovie("FComboBoxSymbol", "txtSize", ++this.levels); this.txtSize._x = 355; this.txtSize._y = this.h-19; this.txtSize.addItem('--Text Size--'); this.txtSize.addItem('default'); this.txtSize.addItem('small'); this.txtSize.addItem('medium'); this.txtSize.addItem('large'); this.txtSize.addItem('larger'); this.txtSize.setStyleProperty("background", STYLES.statusBarColour); this.txtSize.setStyleProperty("selection", STYLES.titleBarColour); this.txtSize.setStyleProperty("textColor", STYLES.textUnselected); this.txtSize.setStyleProperty("textSelected", STYLES.textSelected); this.txtSize.setSize(90); this.txtSize.setChangeHandler('changeTextSize'); this.txtSize.tabIndex = 64011; this.txtSize.onSetFocus = function() { speak("Text Size Options"); }; this.txtSize.ifcCtrl = true; if (this.clean) { this.txtSize._visible = false; } //volume control globalSound = new Sound(); globalSound.setVolume(70); this.createEmptyMovieClip('volControl', ++this.levels); if (_level0.browser == 'ie') { this.volControl._x = 595; } else { this.volControl._x = 485; } this.volControl._y = this.h-17; this.volControl.tabIndex = 64012; this.volControl.onSetFocus = function(){ this.lineStyle(2,0xFFFF00,100); this.drawRect(-1,-1,67, 16); this.onKeyDown = function(){ if (Key.isDown(Key.UP)){ if (this.volSlider._x <= 45){ this.volSlider._x += 5; } else { this.volSlider._x = 50; } globalSound.setVolume(this.volSlider._x * 2); } if (Key.isDown(Key.DOWN)){ if (this.volSlider._x >= 5){ this.volSlider._x -= 5; } else { this.volSlider._x = 0; } globalSound.setVolume(this.volSlider._x * 2); } Selection.setFocus(this); } } this.volControl.onKillFocus = function(){ this.clear(); delete this.onKeyDown; } this.volControl._focusrect = false; this.volControl.createTextField('lbl', 0, -26,-2,30,20); this.volControl.lbl.text = 'Vol:'; //this.volControl.lbl.setTextFormat(new TextFormat('Tahoma', 12, 0xFFFFFF)); if (this.clean) { this.volControl.lbl.setTextFormat(new TextFormat('Tahoma', 12, STYLES.statusColour)); } else { this.volControl.lbl.setTextFormat(new TextFormat('Tahoma', 12, STYLES.textUnselected)); } this.volControl.lbl.setTextFormat(new TextFormat('Tahoma', 12, STYLES.textUnselected)); this.volControl.createEmptyMovieClip('volTrack', 2); this.volControl.createEmptyMovieClip('volSlider', 3); this.volControl.volSlider._x = 35; this.volControl.drawControl = function(fill, title){ this.volTrack.beginFill(fill,100); this.volTrack.lineStyle(0,0xFFFFFF,100); this.volTrack.drawRect(0,2,57,10); this.volSlider.beginFill(title,100); this.volSlider.lineStyle(1,0xFFFFFF,100); this.volSlider.drawRect(0,0,7,14); } if (this.clean) { this.volControl.drawControl(STYLES.statusColour,STYLES.statusColour); } else { this.volControl.drawControl(STYLES.fillColour,STYLES.titleBarColour); } this.volControl.volTrack.onRelease = function(){ this._parent.volSlider._x = this._xmouse; globalSound.setVolume(this._xmouse * 2); } this.volControl.volSlider.onPress = function(){ this.startDrag(false, 0,0,50,0); } this.volControl.volSlider.onRelease = this.volControl.volSlider.onReleaseOutside = function(){ this.stopDrag(); globalSound.setVolume(this._x * 2); } } else { } //end visuals //load custom controller based on frameworktemplate.fla if (swf != undefined) { this.createEmptyMovieClip('controller', this.levels++); this.controller.swapDepths(64000); this.loader = new MovieClipLoader(); this.loader.loadClip(swf, this.controller); this.loader.addListener(this.loader); this.loader.ifc = this; this.loader.onLoadInit = function(){ this.ifc.broadcast('onLoad'); } } this.setButtonColour(STYLES.buttonTextColour, STYLES.buttonFillColour); //one handler for key presses this.onKeyDown = function() { this.broadcast('onKeyPress'); if (this.visuals == true && Key.isDown(Key.PGDN)) { this.nextPage(); } if (this.visuals == true && Key.isDown(Key.PGUP)) { this.prevPage(); } if (this.visuals == true && Key.isDown(Key.HOME)) { //this.firstPage(); } if (this.visuals == true && Key.isDown(Key.END)) { //this.lastPage(); } }; this.onKeyUp = function() { this.broadcast('onKeyRelease'); }; Key.addListener(this); var keyDet = new KeyDetection(); keyDet.addCombination("showTOC", Key.SHIFT, Key.HOME); keyDet.addCombination("showHelp", Key.SHIFT, Key.ENTER); this.onKeyCombination = function(name) { if (this.visuals == true){ switch (name) { case "showTOC" : this.showTOC(); break; case "showHelp" : this.showHelp(); break; } } }; if (displayMode != undefined && _parent.runType != 'editor'){ disInt = setInterval(this, 'setDisplayMode', 0, displayMode); } keyDet.addListener(this); }; INTERFACE.prototype.toggleVoice = function() { if (this.TTSEnabled == false){ this.TTSEnabled = true; ExternalInterface.call('enableTTS'); } if (engine.selfVoice == true) { speak(''); engine.selfVoice = false; } else { engine.selfVoice = true; } }; INTERFACE.prototype.changeTheme = function(cbo) { var pageNum = this.currentPage; if (cbo.getValue() == 'default') { //[fill,defaultText,titleBar,titleBarText,statusBar,statusBarText,buttonFill,buttonText,glossary,label, input] var theme = defaultTheme; } if (cbo.getValue() == 'blue') { //[fill,defaultText,titleBar,titleBarText,statusBar,statusBarText,buttonFill,buttonText,glossary,label, input] var theme = [0xD6E0EC, '#2E415A', 0x84A2C6, 0xFFFFFF, 0x456287, 0xFFFFFF, 0x456287, 0xFFFFFF, '#0000FF', 0x2E415A, 0x2E415A]; } if (cbo.getValue() == 'green') { var theme = [0xE6EED7, '#4E5D30', 0xB5CC88, 0xFFFFFF, 0x758C48, 0xFFFFFF, 0x758C48, 0xFFFFFF, '#0000FF', 0x4E5D30, 0x4E5D30]; } if (cbo.getValue() == 'red') { var theme = [0xEFD3D2, '#602826', 0xC57B79, 0xFFFFFF, 0x903C39, 0xFFFFFF, 0x903C39, 0xFFFFFF, '#0000FF', 0x602826, 0x602826]; } if (cbo.getValue() == 'orange') { var theme = [0xFCE6D4, '#7A4E2B', 0xF7B580, 0xFFFFFF, 0xB77540, 0xFFFFFF, 0xB77540, 0xFFFFFF, '#0000FF', 0x7A4E2B, 0x7A4E2B]; } if (cbo.getValue() == 'grey') { var theme = [0xD8D8D8, '#7F7F7F', 0xA5A5A5, 0xFFFFFF, 0x8C8C8C, 0xFFFFFF, 0x8C8C8C, 0xFFFFFF, '#0000FF', 0x7F7F7F, 0x7F7F7F]; } if (cbo.getValue() == 'purple') { //old nice 'muted' scheme... //var theme = [0xFFFFF0, '#000000', 0x666699, 0xFFFFFF, 0xD0D8DE, 0x333366, 0x333366, 0xFFFFFF, '#FF0000', 0x000000, 0x000000] var theme = [0xDED7E6, '#3F424F', 0x9E8BB6, 0xFFFFFF, 0x5F4B77, 0xFFFFFF, 0x3F324F, 0xFFFFFF, '#0000FF', 0x3F424F, 0x3F424F]; } if (cbo.getValue() == 'high contrast 1') { //var theme = [0x000000, '#FFFFFF', 0x008000, 0xFFFFFF, 0x5F4B77, 0xFFFFFF, 0x000000, 0xFFFFFF, '#FFFF00', 0xFFFFFF, 0xFFFFFF] var theme = [0x000000, '#FFFF00', 0x000000, 0xFFFF00, 0xFFFF00, 0x000000, 0x000000, 0xFFFF00, '#FFFF00', 0xFFFF00, 0xFFFF00]; } if (cbo.getValue() == 'high contrast 2') { var theme = [0x000000, '#FFFFFF', 0x008000, 0xFFFFFF, 0x5F4B77, 0xFFFFFF, 0x000000, 0xFFFFFF, '#FFFF00', 0xFFFFFF, 0xFFFFFF]; } if (cbo.getValue() != '--Colour Scheme--') { STYLES.fillColour = fillColour=theme[0]; STYLES.defaultColour = theme[1]; STYLES.inputColour = replace(theme[1], '#', '0x'); STYLES.titleBarColour = titleBarColour=theme[2]; STYLES.titleTextColour = theme[3]; STYLES.titleTextFormat.color = theme[3]; STYLES.pageTitleFormat.color = theme[3]; STYLES.statusBarColour = statusBarColour=theme[4]; STYLES.statusTextColour = theme[5]; STYLES.statusTextFormat.color = theme[5]; STYLES.buttonFillColour = theme[6]; //STYLES.buttonOutlineColour = theme[7]; STYLES.buttonTextColour = theme[7]; STYLES.glossaryColour = theme[8]; STYLES.labelColour = theme[9]; STYLES.inputColour = theme[10]; STYLES.textSelected = theme[3]; STYLES.textUnselected = theme[5]; //colours for text engine.statusTextColour = '#'+STYLES.statusTextColour.toString(16); engine.titleTextColour = '#'+STYLES.titleTextColour.toString(16); engine.buttonTextColour = '#'+STYLES.buttonTextColour.toString(16); //a 'no' colour for panels if (cbo.getValue() == 'high contrast') { engine.white = 0x000000; } else { engine.white = 0xFFFFFF; } this.FWTitle.setTextFormat(STYLES.titleTextFormat); this.pageTitle.setTextFormat(STYLES.pageTitleFormat); this.drawFW(); //var col = new Color(this.logo); //col.setRGB(theme[3]); var col = new Color(this.contButton); col.setRGB(theme[5]); this.setButtonColour(STYLES.buttonTextColour, STYLES.buttonFillColour); globalStyleFormat.face = STYLES.buttonFillColour; globalStyleFormat.selection = STYLES.titleBarColour; globalStyleFormat.textColor = STYLES.labelColour; globalStyleFormat.textSelected = STYLES.textSelected; globalStyleFormat.applyChanges(); cbo.setStyleProperty("background", STYLES.statusBarColour); cbo.setStyleProperty("selection", STYLES.titleBarColour); cbo.setStyleProperty("textColor", STYLES.textUnselected); cbo.setStyleProperty("textSelected", STYLES.textSelected); this.sizes.setStyleProperty("background", STYLES.statusBarColour); this.sizes.setStyleProperty("selection", STYLES.titleBarColour); this.sizes.setStyleProperty("textColor", STYLES.textUnselected); this.sizes.setStyleProperty("textSelected", STYLES.textSelected); this.fonts.setStyleProperty("background", STYLES.statusBarColour); this.fonts.setStyleProperty("selection", STYLES.titleBarColour); this.fonts.setStyleProperty("textColor", STYLES.textUnselected); this.fonts.setStyleProperty("textSelected", STYLES.textSelected); this.txtSize.setStyleProperty("background", STYLES.statusBarColour); this.txtSize.setStyleProperty("selection", STYLES.titleBarColour); this.txtSize.setStyleProperty("textColor", STYLES.textUnselected); this.txtSize.setStyleProperty("textSelected", STYLES.textSelected); this.access.setStyleProperty("textColor", STYLES.statusTextColour); this.volControl.lbl.setTextFormat(new TextFormat('Tahoma', 12, STYLES.textUnselected)); this.volControl.drawControl(STYLES.fillColour,STYLES.titleBarColour); //re-parse the page from the top this.closePage(); intID = setInterval(this, 'refreshPage', 50); } }; INTERFACE.prototype.changeFont = function(cbo) { if (cbo.defaultFont == undefined) cbo.defaultFont = STYLES.defaultFont; if (cbo.getValue() != '--Text Font--') { if (cbo.getValue() == 'default'){ STYLES.defaultFont = cbo.defaultFont; } else { STYLES.defaultFont = cbo.getValue() } this.closePage(); intID = setInterval(this, 'refreshPage', 50); } } INTERFACE.prototype.changeTextSize = function(cbo) { if (cbo.defaultSize == undefined) cbo.defaultSize = STYLES.defaultSize; if (cbo.getValue() != '--Text Size--') { if (cbo.getValue() == 'default'){ STYLES.defaultSize = STYLES.inputSize = cbo.defaultSize; } if (cbo.getValue() == 'small'){ STYLES.defaultSize = STYLES.inputSize = 10; } if (cbo.getValue() == 'medium'){ STYLES.defaultSize = STYLES.inputSize = 12; } if (cbo.getValue() == 'large'){ STYLES.defaultSize = STYLES.inputSize = 14; } if (cbo.getValue() == 'larger'){ STYLES.defaultSize = STYLES.inputSize = 18; } this.closePage(); intID = setInterval(this, 'refreshPage', 50); } } INTERFACE.prototype.refreshPage = function() { //used when changing themes to ensure the page refreshes properly - essentially this.openPage, but with a clearInterval clearInterval(intID); this.openPage(); this.broadcast("onThemeChange"); }; INTERFACE.prototype.getSize = function(cbo) { if (cbo.getValue() != '--Select Size--' && _parent.runType != 'editor') { this.setDisplayMode(cbo.getValue()); } }; INTERFACE.prototype.setDisplayMode = function(size){ clearInterval(disInt); for (var i = 0; i < this.sizes.getLength(); i++){ if (this.sizes.getItemAt(i).label == type){ this.sizes.setSelectedIndex(i); this.changeSize(size); break; } } //make the change happen... if (size == 'default') { fscommand('resize', engine.stageWidth + ',' + engine.stageHeight); Stage.scaleMode = "noScale"; _level0.engine._xscale = 100; _level0.engine._yscale = 100; } if (size == 'large') { fscommand('resize', engine.stageWidth*1.2 + ',' + engine.stageHeight*1.2); Stage.scaleMode = "noScale"; _level0.engine._xscale = 120; _level0.engine._yscale = 120; } if (size == 'larger') { fscommand('resize', engine.stageWidth*1.44 + ',' + engine.stageHeight*1.44); Stage.scaleMode = "noScale"; _level0.engine._xscale = 144; _level0.engine._yscale = 144; } if (size == 'full screen') { fscommand('fullscreen'); Stage.scaleMode = "showAll"; _level0.engine._xscale = 1600 / engine.stageWidth * 100; _level0.engine._yscale = 1200 / engine.stageHeight * 100; } if (size == 'fill window') { fscommand('fullscreen'); Stage.scaleMode = "exactFit"; _level0.engine._xscale = 1600 / engine.stageWidth * 100; _level0.engine._yscale = 1200 / engine.stageHeight * 100; } } //helpers... INTERFACE.prototype.attachMaskedButton = function(buttonID, instanceName, x, y) { //attach the button - must do this first for height and width this.levels += 3; this.attachMovie(buttonID, instanceName, this.levels); this[instanceName]._x = x; this[instanceName]._y = y; //draw a square MC of fillColour to mask this.createEmptyMovieClip("maskee"+this.levels, this.levels-2); this["maskee"+this.levels]._x = this[instanceName]._x; this["maskee"+this.levels]._y = this[instanceName]._y; //fill it with BG Color this["maskee"+this.levels].beginFill(STYLES.buttonFillColour, 100); this["maskee"+this.levels].moveTo(this.button_mc._x); this["maskee"+this.levels].lineTo(this[instanceName]._width, 0); this["maskee"+this.levels].lineTo(this[instanceName]._width, this[instanceName]._height); this["maskee"+this.levels].lineTo(0, this[instanceName]._height); this["maskee"+this.levels].lineTo(0, 0); this["maskee"+this.levels].endFill(); this.maskees.push(this["maskee"+this.levels]); //attach the mask this.attachMovie("buttonMask", "mask"+this.levels, this.levels-1); this["mask"+this.levels]._x = x; this["mask"+this.levels]._y = y; this["maskee"+this.levels].setMask(this["mask"+this.levels]); this.masks.push(this["maskee"+this.levels]); //return the button instance return this[instanceName]; }; INTERFACE.prototype.drawStage = function() { //draw the stage - a rectangle of stage colour this.beginFill(STYLES.stageColour); this.drawRect(0, 0, 1600, 1200); this.endFill(); }; INTERFACE.prototype.drawFW = function() { this.drawBorder(); //ICON method this.fillIcon(); //ICON method if (!this.clean) { this.drawTitleBar(); //ICON this.drawStatusBar(); //ICON this.drawTitleBanner(); //IFC method } else { this.drawTitleBar(STYLES.fillColour, 100, this.titleBarHeight); this.drawStatusBar(STYLES.fillColour, 100, this.statusBarHeight); this.drawTitleBanner(STYLES.fillColour, 100); } }; INTERFACE.prototype.drawTitleBanner = function(colour, alpha) { if (arguments.length == 0) { this.lineStyle(0, STYLES.statusBarColour); this.beginFill(STYLES.statusBarColour, 100); } else { this.lineStyle(0, colour); this.beginFill(colour, alpha); } this.moveTo(this.w-1, this.titleBarHeight); this.lineTo(this.w-1, this.titleBarHeight+this.titleBannerHeight); this.lineTo(0, this.titleBarHeight+this.titleBannerHeight); this.lineTo(0, this.titleBarHeight); this.lineTo(this.w-1, this.titleBarHeight); this.endFill(); }; INTERFACE.prototype.setTitleText = function(text) { this.FWTitle.text = text; this.FWTitle.setTextFormat(STYLES.titleTextFormat); }; INTERFACE.prototype.setPageTitle = function(txt) { this.pageTitle.text = txt; this.pageTitle.setTextFormat(STYLES.pageTitleFormat); }; INTERFACE.prototype.setStatusText = function(text) { this.FWStatus.text = text; this.FWStatus.setTextFormat(STYLES.titleTextFormat); }; INTERFACE.prototype.setProgress = function() { this.progress.currentPage.text = this.currentPage+1; this.progress.currentPage.setTextFormat(STYLES.titleTextFormat); this.progress.pageCount.text = this.pages.length; this.progress.pageCount.setTextFormat(STYLES.titleTextFormat); speak('Page '+(this.currentPage+1)+' of '+this.pages.length+'. '+this.pages[this.currentPage].XMLElement.attributes.title); }; INTERFACE.prototype.hideNext = function() { this.contButton._visible = false; }; INTERFACE.prototype.showNext = function() { this.contButton._visible = true; }; INTERFACE.prototype.enableControls = function(bool, alpha) { for (var i = 0; i1) { this.controls[i]._alpha = alpha; } } }; INTERFACE.prototype.hideControls = function() { for (var i = 0; i 200) { // Assume this is a (transparent) banner this.target.logo._x = 1; this.target.logo._y = 1; } else { this.target.logo._x = 20; this.target.logo._y = 2; this.target.FWTitle._x = this.target.logo._x + this.target.logo._width + 5; this.target.pageTitle._x = this.target.logo._x + this.target.logo._width + 5; } delete this.onLoadComplete; } return this.logo; } INTERFACE.prototype.slideNext = function() { this.contButton._x = -100; this.contButton._visible = true; this.onEnterFrame = function() { this.contButton._x += 60; if (this.contButton._x == this.w-120) { delete this.onEnterFrame; this.broadcast('onSlideNextComplete'); } }; }; INTERFACE.prototype.setStyle = function(property, value) { //get current page to return to when the styles have been set var currentPage = this.currentPage; //set the style STYLES[property] = value; //rebuild the interface parseXML(_parent.contentXML.firstChild.firstChild); //do not parse the first child with style info... //return the user to the page this.gotoPage(this.currentPage); }; FRAMEWORK.prototype.showTOC = function() { if (this.toc == false) { this.toc = true; this.levels++; //create the main window... this.attachMovie("WIN_Helper", "toc_mc", 200).init(this.toc_x, this.toc_y, this.toc_w, this.toc_h, "Table of Contents"); //add a clip for the titles var col = new Color(this.toc_mc.closeButton); col.setRGB(STYLES.buttonTextColour); this.toc_mc.attachMovie('FListBoxSymbol', 'tocList', 8); this.toc_mc.tocList._x = 5; this.toc_mc.tocList._y = 25; this.toc_mc.tocList.width = 291; this.toc_mc.tocList.height = 196; this.toc_mc.tocList.setStyleProperty("background", STYLES.statusBarColour); this.toc_mc.tocList.setStyleProperty("selection", STYLES.titleBarColour); this.toc_mc.tocList.setStyleProperty("textColor", STYLES.statusTextColour); this.toc_mc.tocList.setStyleProperty("textFont", "Verdana"); this.toc_mc.tocList.setStyleProperty("textSize", 12); this.toc_mc.tocList.setStyleProperty("face", STYLES.titleBarColour); this.toc_mc.tocList.setStyleProperty("scrollTrack", STYLES.statusBarColour); this.toc_mc.tocList.setStyleProperty("border", STYLES.statusBarColour); this.toc_mc.tocChange = function() { var index = this.tocList.getSelectedIndex(); speak(this.tocList.getItemAt(index).label); }; //change handler for accessibility... this.toc_mc.tocList.setChangeHandler("tocChange"); //set up the list box for (var i = 0; i"; this.help_mc.rect.helpText.htmlText = myHTMLString+this.pages[this.currentPage].XMLElement.attributes.help+""; this.help_mc.setSize(this.help_w, this.help_mc.rect.helpText._height+this.help_mc.rect.helpText._y+37); //trap x and y for next time... this.help_mc.onUnload = function() { this._parent.help_x = this._x; this._parent.help_y = this._y; this._parent.help = false; }; this.help_mc.closeButton.tabIndex = 64009; this.help_mc.closeButton.onSetFocus = function() { speak("Press space to close help."); }; Selection.setFocus(this.help_mc.rect); this.broadcast('onShowHelp'); } }; INTERFACE.prototype.showGlosTerm = function(index) { this.attachMovie("WIN_Helper", "glos_mc", 200).init(this.glos_x, this.glos_y, this.glos_w, this.glos_h, 'Glossary'); this.glos_mc.createTextField('glosText', 5, 7, 27, this.glos_w-12, 20); this.glos_mc.glosText.html = true; this.glos_mc.glosText.multiline = true; this.glos_mc.glosText.autoSize = "left"; this.glos_mc.glosText.wordWrap = true; this.glos_mc.glosText.selectable = false; var myHTMLString = ""; this.glos_mc.glosText.htmlText = myHTMLString+""+Glossary.terms[index]+"

"+Glossary.definitions[index]+"
"; this.glos_mc.setSize(this.glos_w, this.glos_mc.glosText._height+this.glos_mc.glosText._y+10); //trap x and y for next time... this.glos_mc.onMouseUp = function() { this._parent.glos_x = this._x; this._parent.glos_y = this._y; this._parent.glos = false; }; this.glos_mc.closeButton.tabIndex = 2; }; INTERFACE.prototype.setButtonColour = function(outline, fill) { for (var i = 0; i=0; i--) { //we need to check we are at the right fw - there may be preceeding icons to exit //before the correct fw is rendered - and therefore can be navigated. FWs //must be rendered before they can be navigated for (var j = 0; j0) { this.start(0, this.loop); } else { this.start(); } } }; this.sounds[this.sounds.length-1].attachSound(soundID); return this.sounds[this.sounds.length-1]; }; PAGE.prototype.loadSound = function(link, play, loop, wait, controls, eraseChildren, stream, eraseOnReset) { //use a decision icon and return it's id: the sound is dec.sound - this makes synching easy //because we can use the decision icon's abilities to control the paging. if (eraseChildren == undefined) { eraseChildren = 0; } var dec = this.addDecision('all', 'sequence', 0, 0, eraseChildren, 0); this.children.push(dec); //path,pause,erase,eraseOnExit dec.sound = new Sound(this); dec.sound.loop = loop; dec.sound.play = play; dec.sound.icon = dec; dec.eraseOnReset = (eraseOnReset != 1 ? true : false); if (play == 1) { dec.sound.paused = false; } else { dec.sound.paused = true; } dec.loadSound = function(url, stream) { this.sound.loadSound(url, stream != true ? false : true); this.makeLoadProgress(); }; dec.sound.pause = 0; dec.sound.onLoad = function() { this.icon.broadcast('onLoad'); if (this.play == '1') { if (this.loop > 0) { this.start(0, this.loop); } else { this.pause = 0; this.paused = true; this.icon.play(); } } this.onLoadID = setInterval(this, "onLoadHandler",200); }; clearInterval(this.resetID); dec.sound.onSoundComplete = function() { this.icon.broadcast('onSoundComplete'); }; dec.sound.onLoadHandler = function(){ clearInterval(this.onLoadID); this.icon.broadcast('onLoad'); } if (wait == 1) { dec.createEmptyMovieClip("waitWatcher", ++this.levels); dec.waitWatcher.onEnterFrame = function() { if (this._parent.sound.duration == this._parent.sound.position) { this._parent.exit(); delete this.onEnterFrame; } }; } dec.addPage = function(help, synchPoint, transition) { //overrides the normal addPage method of decision icons this.levels++; this.attachMovie("PAGE_Helper", "PG_MC"+this.levels, this.levels).init(); this.pages.push(this["PG_MC"+this.levels]); this.tracking.push(0); this["PG_MC"+this.levels].synchPoint = synchPoint; this["PG_MC"+this.levels].makeTracker = function() { this.createEmptyMovieClip('synchManager', 99); this.synchManager.onEnterFrame = function(){ if (this._parent._parent.sound.position > this._parent.synchPoint && this._parent._parent.sound.paused != true){ this._parent._parent.nextPage(); delete this.onEnterFrame; } } }; this["PG_MC"+this.levels].makeTracker(); return this["PG_MC"+this.levels]; }; //reset is done in two parts to avoid isues with timing. //otherwise the synchManager.onEnterframe appears to persist, even when it should be deleted //allowed 200 m/s to let everything clear out. dec.reset = function() { this.stopButton._visible = false; this.playButton._visible = true; this.slider._x = this.ffwdButton._x+this.ffwdButton._width; delete this.slider.onEnterFrame; //kill the content for (var i = 0; i < this.pages.length; i++) { delete this.pages[i].synchManager.onEnterFrame; this.pages[i].synchManager.removeMovieClip(); if (this.eraseOnReset == true){ for (var j = 0; j