ࡱ>  Root Entry p|YrRASH'|B=Contents0Page 1Symbol 2 $) &%'(*+./5123476<89:G;HRoot Entry p|YrRASHPS=Contents=Page 1 Symbol 2!$)"#,%*+.-/56<;>?@ABCDEFICPicPage CPicLayer CPicFrame (y 4F4F8X8#8t<6})0U00`85? backgroundO CPicSprited trailerParent? trailerParent3CPicTexthz)T@jArial3"this version of the trailer has everything a respectable trailer engine needs: configurable spawn rate for new objects in the trail, a configurable lifespan for each trail object, a configurable leader for the trail, an automatic trail-extermination system, and even the option to leave 1 or more trail objects on screen. no fancy effects, just the essentials... ? explanationO h+@ Arial"spawnRate +@Arial"lifespan '+@Arial"residue?ui {$W@=Arial" duplicateMovieClip,spawnRate,lifespan,killFunction.parameters Symbol 7 cCSymbol 8BSymbol 95?Symbol 10iUf$0@Arial@"a basic trailer engine b-@XArial@"when executed in test movie mode, this movie will look choppy due to the trace functions p @hArial" ms  @hArial" ms?titleOO 2onClipEvent (enterFrame) { _root.doTrail(); } processClip?processO?O // -=-==-=-=-=-=-=-=-=-=-=-==-=--==-- // moock trailer engine // version 1.0.1 // =-==-=-==-=-=-=-==-=-=-=-=-=-=-=-= // ############# // user settings // ############# var spawnRate = 50; // how often to add an object to the trail (milliseconds) var defaultLifespan = 2000; // the default lifespan of each trail object (milliseconds) var leaderX = function() { return _xmouse; }; // store the leader's coords in functions so the leader CPicPage CPicLayer CPicFrame (y 4F4F8X8#8t<6})0U00`85? backgroundO CPicSprited trailerParent   !"#$%&'()*+,-./012346789:;<=>?@ABCDEFGHIKLMNOPQRSTUVWXYZ[\]^_`abdefghojklmnpqr? trailerParent3CPicTexthz)T@jArial3"this version of the trailer has everything a respectable trailer engine needs: configurable spawn rate for new objects in the trail, a configurable lifespan for each trail object, a configurable leader for the trail, an automatic trail-extermination system, and even the option to leave 1 or more trail objects on screen. no fancy effects, just the essentials... ? explanationO h+@ Arial"spawnRate +@Arial"lifespan '+@Arial"residue?ui {$W@=Arial" duplicateMovieClip,spawnRate,lifespan,killFunction.parameters f$0@Arial@"a basic trailer engine b-@XArial@"when executed in test movie mode, this movie will look choppy due to the trace functions p @hArial" ms  @hArial" ms?titleOO 2onClipEvent (enterFrame) { _root.doTrail(); } processClip?processO?O // -=-==-=-=-=-=-=-=-=-=-=-==-=--==-- // moock trailer engine // version 1.0.1 // =-==-=-==-=-=-=-==-=-=-=-=-=-=-=-= // ############# // user settings // ############# var spawnRate = 50; // how often to add an object to the trail (milliseconds) var defaultLifespan = 2000; // the default lifespan of each trail object (milliseconds) var leaderX = function() { return _xmouse; }; // store the leader's coords in functions so the leader var leaderY = function() { return _ymouse; }; // can be changed easily. we might not be following the mouse! var trailResidue = 0; // number of objects in the trail to leave on screen when leader is idling // ############################# // system code // ############################# // internal globals var trailers = new Array(); // a list of trail objects var lastSpawn = 0; // the time we last added an object to the trail var currentTime = 0; // the current time var trailerID = 0; // a unique number assigned to each trailer object var oldestTrailer = 0; // ID of the oldest trailer on screen // use currentLeaderPos and lastLeaderPos objects // to track whether or not the leader is moving var currentLeaderPos = { x:leaderX(), y:leaderY() }; var lastLeaderPos = { x:leaderX(), y:leaderY() }; // creates a new trail clip function makeTrailer() { // make the trailer clip duplicateMovieClip(trailerParent, "trailer" + trailerID , trailerID); // add a reference to the new clip to our trailers array trailers[trailerID] = _root["trailer" + trailerID]; // remember when this clip was created trailers[trailerID].birth = getTimer(); // set this clip's lifespan trailers[trailerID].lifespan = defaultLifeSpan; } // place any trail clip function placeTrailer(trailerID, x, y) { trailers[trailerID]._x = x; trailers[trailerID]._y = y; } // remove a specified trail clip function killTrailer(trailerID) { removeMovieClip(trailers[trailerID]); // k var leaderY = function() { return _ymouse; }; // can be changed easily. we might not be following the mouse! var trailResidue = 0; // number of objects in the trail to leave on screen when leader is idling // ############################# // system code // ############################# // internal globals var trailers = new Array(); // a list of trail objects var lastSpawn = 0; // the time we last added an object to the trail var currentTime = 0; // the current time var trailerID = 0; // a unique number assigned to each trailer object var oldestTrailer = 0; // ID of the oldest trailer on screen // use currentLeaderPos and lastLeaderPos objects // to track whether or not the leader is moving var currentLeaderPos = { x:leaderX(), y:leaderY() }; var lastLeaderPos = { x:leaderX(), y:leaderY() }; // creates a new trail clip function makeTrailer() { // make the trailer clip duplicateMovieClip(trailerParent, "trailer" + trailerID , trailerID); // add a reference to the new clip to our trailers array trailers[trailerID] = _root["trailer" + trailerID]; // remember when this clip was created trailers[trailerID].birth = getTimer(); // set this clip's lifespan trailers[trailerID].lifespan = defaultLifeSpan; } // place any trail clip function placeTrailer(trailerID, x, y) { trailers[trailerID]._x = x; trailers[trailerID]._y = y; } // remove a specified trail clip function killTrailer(trailerID) { removeMovieClip(trailers[trailerID]); // kSymbol 3>Symbol 4}Symbol 6J1Symbol 5 CPicPage CPicLayer CPicFrame}445J45HˀH44ˀJ4?Layer 1OCPicPage CPicLayer CPicFrame CPicShaCPicPage CPicLayer CPicFrame?0?r:z fs Xp<0?Layer 1Oth; function setNewFactor () { stopDraCPicPage CPicLayer CPicFrame CPicSprite  sliderBar?barOonClipEvent (load) { // set maximum life span var maxLifeSpan = 7000; // set location of drag Handle var lifeSpanPercent = _root.defaultLifeSpan / maxLifeSpan; _x = lifeSpanPercent * _parent._width; sliderOutput = _root.defaultLifeSpan; // function to change residue amount // based on slider handle position // this function is called by the release event of the drag Handle function setNewFactor () { var newPos = _x; var endPos = _parent.sliderBar._width; var handlePercent = newPos/endPos; var newLifeSpan = Math.round(maxLifeSpan * handlePercent); if (newLifeSpan <= 5) { newLifeSpan = 5; } _root.deill the appropriate clip delete trailers[trailerID]; // get rid of the reference to the clip in the trailers array // find new oldest trailer for (var i = oldestTrailer; i < trailers.length; i++) { if (trailers[i] != undefined) { oldestTrailer = i; break; } } trace(" trailer " + trailerID + " killed. new oldest trailer is: " + oldestTrailer + ""); } // make a trail of clips that follows a moving x and y coordinate function doTrail () { trace ("doTrail called"); // get the leader's latest location currentLeaderPos.x = leaderX(); currentLeaderPos.y = leaderY(); // set a flag stating whether or not leader has moved var leaderHasMoved = currentLeaderPos.x != lastLeaderPos.x || currentLeaderPos.y != lastLeaderPos.y; // check when we last added to the trail currentTime = getTimer(); var timeSinceLastSpawn = currentTime - lastSpawn; // add to the trail if enough time has passed and the leader has moved lately if ((timeSinceLastSpawn >= spawnRate) &ill the appropriate clip delete trailers[trailerID]; // get rid of the reference to the clip in the trailers array // find new oldest trailer for (var i = oldestTrailer; i < trailers.length; i++) { if (trailers[i] != undefined) { oldestTrailer = i; break; } } trace(" trailer " + trailerID + " killed. new oldest trailer is: " + oldestTrailer + ""); } // make a trail of clips that follows a moving x and y coordinate function doTrail () { trace ("doTrail called"); // get the leader's latest location currentLeaderPos.x = leaderX(); currentLeaderPos.y = leaderY(); // set a flag stating whether or not leader has moved var leaderHasMoved = currentLeaderPos.x != lastLeaderPos.x || currentLeaderPos.y != lastLeaderPos.y; // check when we last added to the trail currentTime = getTimer(); var timeSinceLastSpawn = currentTime - lastSpawn; // add to the trail if enough time has passed and the leader has moved lately if ((timeSinceLastSpawn >= spawnRate) && leaderHasMoved) { trailerID++; makeTrailer(); placeTrailer(trailerID, leaderX(), leaderY()); lastSpawn = currentTime; trace(" made trailer: " + trailerID); } // kill any trail objects that have exceeded their lifespan for(var i = trailerID - trailResidue; i >= oldestTrailer; i--) { if(trailers[i] != undefined) { // don't bother checking gaps in the trail... if (getTimer() - trailers[i].birth >= trailers[i].lifespan) { killTrailer(i); } } } // record theLayer 1Opeq3Wx;\2#111?Layer 1OCPicPage CPicLayer CPicFrame CPicShapeR8fs Xp<0?R8fs Xp<0?R8fs Xp<& leaderHasMoved) { trailerID++; makeTrailer(); placeTrailer(trailerID, leaderX(), leaderY()); lastSpawn = currentTime; trace(" made trailer: " + trailerID); } // kill any trail objects that have exceeded their lifespan for(var i = trailerID - trailResidue; i >= oldestTrailer; i--) { if(trailers[i] != undefined) { // don't bother checking gaps in the trail... if (getTimer() - trailers[i].birth >= trailers[i].lifespan) { killTrailer(i); } } } // record the location of the leader so we can check against it next time lastLeaderPos.x = currentLeaderPos.x; lastLeaderPos.y = currentLeaderPos.y; } // ####################################### // CREATE DEMO INTERFACE // this is not part of the trailer engine // ####################################### _root.attachMovie("spawnDragBar", "spawnDragBar", 10000000); spawnDragBar._x = 76; spawnDragBar._y = 226; _root.attachMovie("lifeDragBar", "lifeDragBar", 10000001); lifeDragBar._x = 255; lifeDragBar._y = 226; _root.attachMovie("residueDragBar", "residueDragBar", 10000002); residueDragBar._x = 427; residueDragBar._y = 226;scriptsO ?Layer 1Oxx fk ` 3(0000faultLifeSpan = newLifeSpan; sliderOutput = newLifeSpan; } } dragHandle?handleOOion to change residue amount // based on slider handle positCPicPage CPicLayer CPicFrame CPicSprite  sliderBar?barOonClipEvent (load) { // set maximum number of trailers left on screen var maxResidue = 20; // set location of drag Handle var residuePercent = _root.trailResidue / maxResidue; _x = residuePercent * _parent._width; sliderOutput = _root.trailResidue; // function to change residue amount // based on slider handle position // this function is called by the release event of the drag Handle function setNewFactor () { var newPos = _x; var endPos = _parent.sliderBar._width; var handlePercent = newPos/endPos; var newResidue = Math.round(maxResidue * handlePercent); if (newResidue < 0) { newResidue = 0; } _root.trailResidue = newResidue; sliderOutput = newResidue; } } dragHandle location of the leader so we can check against it next time lastLeaderPos.x = currentLeaderPos.x; lastLeaderPos.y = currentLeaderPos.y; } // ####################################### // CREATE DEMO INTERFACE // this is not part of the trailer engine // ####################################### _root.attachMovie("spawnDragBar", "spawnDragBar", 10000000); spawnDragBar._x = 76; spawnDragBar._y = 226; _root.attachMovie("lifeDragBar", "lifeDragBar", 10000001); lifeDragBar._x = 255; lifeDragBar._y = 226; _root.attachMovie("residueDragBar", "residueDragBar", 10000002); residueDragBar._x = 427; residueDragBar._y = 226;scriptsO Symbol 7 dragHandleMC99 Symbol 6 spawnDragBar9) spawnDragBar͈9 Symbol 9residueDragBar 9-residueDragBar?handleOO CPicPage CPicLayer CPicFrame CPicSprite  sliderBar?barOonClipEvent (load) { // set maximum spawn rate var maxSpawnRate = 1100; // set location of spawn Handle var spawnPercent = _root.spawnRate / maxSpawnRate; _x = spawnPercent * _parent._width; sliderOutput = _root.spawnRate; function setNewFactor () { var newPos = _x; var endPos = _parent.sliderBar._width; var handlePercent = newPos/endPos; var newSpawnRate = Math.round(maxSpawnRate * handlePercent); trace ("newPos:::::::::::::  CDocumentPage Page 1Scene 1?+9Z9 Symbol 10 sliderBar z9%9%9 Symbol 7 dragHandleMCz999 Symbol 6 spawnDragBarz99) spawnDragBar9 Symbol 9residueDragBar z99-residueDragBarœ9 Symbol 8 lifeDragBarz99+ lifeDragBarT9 Symbol 5 dragHandlez9d99 Symbol 2 process clip@+9@+9 Symbol 3 trailerParentˡ9Ρ9 Symbol 4 little circle͡9~ߡ9 *@hhhhh(Vector::Template"PublishFormatProperties::generator CColorDef 3P fP0 PH P` Px 3 33( 3f<0 3CH 3F` 3Hx 3 33x f3d0 3]H 3Z` 3Xx 33 3330 3f3PPH 33Px` 33Px 33P f0 3f0 ffx0 fkH fd` f`x 3f0 33fPH 3ffxPH 3fdx` 3f]x 3fZ H 3H fH xH ̙n` hx 3H 33x` 3fx` 3xx` 3̙kx 3d ` 3` f` ` x` px 3` 33x 3fx 3x 3xx 3n x 3x fx x x xx 3x 33 3f 3 3 3x f0 f30 ff(0 f5H f<` f@x H 3 H fH (H 2` 8x f30 f33PH ff3(PH f3<x` f3Cx f3F 3H ::::::::::::::::::::::::::::::::::::::::::::::::::" + newPos); trace ("endPos:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" + endPos); trace ("handlePercent:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" + handlePercent); trace ("newSpawnRate:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" + newSpawnRate); if (newSpawnRate <= 5) { newSpawnRate = 5; } _root.spawnRate = newSpawnRate; sliderOutput = newSpawnRate; } } dragHandle?handleOO:::::::::::::::CPicPage CPicLayer CPicFrame CPicButtonvon (press) { this.startDrag(5,0,0,_parent.sliderBar._width); } on (release) { stopDrag(); setNewFactor(); }CPicText33x` f3x` 3(x` 35x 3< ff0 f3fPH fff` ffP0x ffPx ffP fH 3fx` ff0x f(0x f<x fC fH f3x` ff0x fx0x f̙dx f] H 3x` f0x  ̙PP P f` f3x ffx fx fxx fk ` 3x fx P xP d fx f3 ff f f fx x 3 f   x ` 3 ` f` ̙` (` 0x x 3x fx x  x (x 3` 33x f3 x ̙3x 3(x 32 3x 33 f3 3 3 3( f` 3fx ffx ̙fx f(x f5 fx 3f ff f f f( ` 3x fx ̙P ̙(P < x 3 f  ̙ ( ` 3x fx ̙P  P x 3 f   ( x 3 f ̙  x x 3 f     3330 fff`    x Px x (x xx ?Layer 1OderPos.y; } // ####################################### // CREATE DEMO INTERFACE // this is not part of the trailer engine // ####################################### _root.attachMovie("spawnDragBar", "spawnDragBar", 10000000); spawnDragBar._x = 76; spawnDragBar._y = 226; _root.attachMovie("lifeDragBar", "lifeDragBar", 10000001); lifeDragBar._x = 255; lifeDrag t; sliderOutputArial"CPicPage CPicLayer CPicFrame CPicShapefqHP(0?Layer 1Oxx fk ` 3(0000  CDocumentPage Page 1Scene 1?+9Z9 Symbol 10 sliderBar z9%9%9 Symbol 7 dragHandleMCz999 Symbol 6 spawnDragBarz99) spawnDragBar9 Symbol 9residueDragBar z99-residueDragBarœ9 Symbol 8 lifeDragBarz99+ lifeDragBarT9 Symbol 5 dragHandlez9d99 Symbol 2 process clip@+9@+9 Symbol 3 trailerParentˡ9Ρ9 Symbol 4 little circle͡9~ߡ9 *@hhhhh(Vector::Template"PublishFormatProperties::generator CColorDef 3P fP0 PH P` Px 3 33( 3f<0 3CH 3F` 3Hx 3 33x f3d0 3]H 3Z` 3Xx 33 3330 3f3PPH 33Px` 33Px 33P f0 3f0 ffx0 fkH fd` f`x 3f0 33fPH 3ffxPH 3fdx` 3f]x 3fZ H 3H fH xH ̙n` hx 3H 33x` 3fx` 3xx` 3̙kx 3d ` 3` f` ` x` px 3` 33x 3fx 3x 3xx 3n x 3x fx x x xx 3x 33 3f 3 3 3x f0 f30 ff(0 f5H f<` f@x H 3 H fH (H 2` 8x f30 f33PH ff3(PH f3<x` f3Cx f3F 3H 33x` f3x` 3(x` 35x 3< ff0 f3fPH fff` ffP0x ffPx ffP fH 3fx` ff0x f(0x f<x fC fH f3x` ff0x fx0x f̙dx f] H 3x` f0x  ̙PP P f` f3x ffx fx fxx fk ` 3x fx P xP d fx f3 ff f f fx x 3 f   x ` 3 ` f` ̙` (` 0x x 3x fx x  x (x 3` 33x f3 x ̙3x 3(x 32 3x 33 f3 3 3 3( f` 3fx ffx ̙fx f(x f5 fx 3f ff f f f( ` 3x fx ̙P ̙(P < x 3 f  ̙ ( ` 3x fx ̙P  P x 3 f   ( x 3 f ̙  x x 3 f     3330 fff`    x Px x (x xx x (  Y1 }      *](s+interface widgetsz9x (  Y1 }      *](s+interface widgetsz9hh