Revision: 27767
Updated Code
at June 22, 2010 20:11 by ninemill
Updated Code
// INCLUDES... import flash.display.*; import com.greensock.*; import com.greensock.plugins.*; //////////////////////////// public var glintMC:MovieClip = setUpGlint(objectToApplyGlintTo); glint(glintMC, 2, 2, true); public function setUpGlint(originalObj:*){ var cloneBitmapData:BitmapData = new BitmapData(originalObj.width, originalObj.height, true, 0x000000); cloneBitmapData.draw(originalObj); var BmpClone:Bitmap = new Bitmap(cloneBitmapData); BmpClone.x = originalObj.x; BmpClone.y = originalObj.y; BmpClone.name = "BmpClone"; var cloneHolder:MovieClip = new MovieClip(); cloneHolder.addChild(BmpClone); addChild(cloneHolder); cloneHolder.name = "assetForGlinting"; TweenLite.to(cloneHolder, 0.01, {tint:0xFFFFFF, glowFilter:{blurX:7, blurY:7, alpha:1.35, strength:1, color:0xFFFFFF}}); var spot:MovieClip = new spotlight(); spot.height = spot.width = originalObj.height*4; addChild(spot); spot.x = originalObj.x-(spot.width*0.75); spot.y = originalObj.y + originalObj.height/2; spot.name = "spot"; originalObj.cacheAsBitmap = cloneHolder.cacheAsBitmap = spot.cacheAsBitmap = true; cloneHolder.mask = spot; var cloneClip:MovieClip = new MovieClip(); cloneClip.addChild(originalObj); cloneClip.addChild(cloneHolder); cloneClip.addChild(spot); addChild(cloneClip); return cloneClip; } public function glint(glintReadyMC:*, Delay=0, Duration=2, leftToRight=true){ var spot:MovieClip = glintReadyMC.getChildByName("spot"); var assetForGlinting = glintReadyMC.getChildByName("assetForGlinting").getChildByName("BmpClone"); var tweenAmount:Number = assetForGlinting.width + spot.width*1.5; if(leftToRight){ spot.x = assetForGlinting.x - (spot.width*0.75); } else { tweenAmount *= -1; spot.x = assetForGlinting.x + assetForGlinting.width + (spot.width*0.75); } TweenLite.to(spot, Duration, {delay:Delay, x:tweenAmount.toString()}); }
Revision: 27766
Updated Code
at June 22, 2010 20:09 by ninemill
Updated Code
// INCLUDES... import flash.display.*; import com.greensock.*; import com.greensock.plugins.*; //////////////////////////// public var glintMC:MovieClip = setUpGlint(objectToApplyGlintTo); glint(glintMC, 2, 2, true); public function setUpGlint(originalObj:*){ var cloneBitmapData:BitmapData = new BitmapData(originalObj.width, originalObj.height, true, 0x000000); cloneBitmapData.draw(m); var BmpClone:Bitmap = new Bitmap(cloneBitmapData); BmpClone.x = originalObj.x; BmpClone.y = originalObj.y; BmpClone.name = "BmpClone"; var cloneHolder:MovieClip = new MovieClip(); cloneHolder.addChild(BmpClone); addChild(cloneHolder); cloneHolder.name = "assetForGlinting"; TweenLite.to(cloneHolder, 0.01, {tint:0xFFFFFF, glowFilter:{blurX:7, blurY:7, alpha:1.35, strength:1, color:0xFFFFFF}}); var spot:MovieClip = new spotlight(); spot.height = spot.width = originalObj.height*4; addChild(spot); spot.x = originalObj.x-(spot.width*0.75); spot.y = originalObj.y + originalObj.height/2; spot.name = "spot"; originalObj.cacheAsBitmap = cloneHolder.cacheAsBitmap = spot.cacheAsBitmap = true; cloneHolder.mask = spot; var cloneClip:MovieClip = new MovieClip(); cloneClip.addChild(originalObj); cloneClip.addChild(cloneHolder); cloneClip.addChild(spot); addChild(cloneClip); return cloneClip; } public function glint(glintReadyMC:*, Delay=0, Duration=2, leftToRight=true){ var spot:MovieClip = glintReadyMC.getChildByName("spot"); var assetForGlinting = glintReadyMC.getChildByName("assetForGlinting").getChildByName("BmpClone"); var tweenAmount:Number = assetForGlinting.width + spot.width*1.5; if(leftToRight){ spot.x = assetForGlinting.x - (spot.width*0.75); } else { tweenAmount *= -1; spot.x = assetForGlinting.x + assetForGlinting.width + (spot.width*0.75); } TweenLite.to(spot, Duration, {delay:Delay, x:tweenAmount.toString()}); }
Revision: 27765
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 22, 2010 20:05 by ninemill
Initial Code
// INCLUDES... import flash.display.*; import com.greensock.*; import com.greensock.plugins.*; //////////////////////////// public var glintMC:MovieClip = setUpGlint(objectToApplyGlintTo); glint(glintMC, 2, 2, true); public function setUpGlint(m:*){ var cloneBitmapData:BitmapData = new BitmapData(m.width, m.height, true, 0x000000); cloneBitmapData.draw(m); var BmpClone:Bitmap = new Bitmap(cloneBitmapData); BmpClone.x = m.x; BmpClone.y = m.y; BmpClone.name = "BmpClone"; var cloneHolder:MovieClip = new MovieClip(); cloneHolder.addChild(BmpClone); addChild(cloneHolder); cloneHolder.name = "glintAsset"; TweenLite.to(cloneHolder, 0.01, {tint:0xFFFFFF, glowFilter:{blurX:7, blurY:7, alpha:1.35, strength:1, color:0xFFFFFF}}); var spot:MovieClip = new spotlight(); spot.height = spot.width = m.height*4; addChild(spot); spot.x = m.x-(spot.width*0.75); spot.y = m.y + m.height/2; spot.name = "spot"; m.cacheAsBitmap = cloneHolder.cacheAsBitmap = spot.cacheAsBitmap = true; cloneHolder.mask = spot; var cloneClip:MovieClip = new MovieClip(); cloneClip.addChild(m); cloneClip.addChild(cloneHolder); cloneClip.addChild(spot); addChild(cloneClip); return cloneClip; } public function glint(m:*, Delay=0, Duration=2, leftToRight=true){ var spot:MovieClip = m.getChildByName("spot"); var glintAsset = m.getChildByName("glintAsset").getChildByName("BmpClone"); var tweenAmount:Number = glintAsset.width + spot.width*1.5; if(leftToRight){ spot.x = glintAsset.x - (spot.width*0.75); } else { tweenAmount *= -1; spot.x = glintAsset.x + glintAsset.width + (spot.width*0.75); } TweenLite.to(spot, Duration, {delay:Delay, x:tweenAmount.toString()}); }
Initial URL
Initial Description
Initial Title
Object Glinting Method
Initial Tags
Initial Language
ActionScript 3