Category Archives: ActionScript 3.0

How to make Fullscreen with ActionScript 3.0

HTML Example   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">         <head>                 <title></title>                 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />                 <script type="text/javascript" src="swfobject.js"></script>     [...]
Posted in ActionScript 3.0 | Tagged , , | Leave a comment

How to Create a Checkbox – ActionScript 3.0

ActionScript 3.0   package {   import flash.display.*;   import flash.events.*;   import flash.text.*;     public class CheckBox extends Sprite {           private var _label:FormattedTextField;         private var _icon:CheckBoxIcon;         private var _isChecked:Boolean = false;                   [...]
Posted in ActionScript 3.0 | Tagged , , , , , | Leave a comment

How to Load External SWF into Flash – ActionScript 3.0

ActionScript 3.0   // Define a variable to reference your exported-for-actionscript // library element. Just create an empty movieclip and set its // export-for-actionscript property appropriately var header_mc:mc_holder = new mc_holder();       function init():void {     /////////////////////////////////////////// BEGIN Add Header     var loadHeader = new Loader(); // temporary variable to reference [...]
Posted in ActionScript 3.0 | Tagged , , , , | Leave a comment

Simple Timeline Preloader – ActionScript 3.0

ActionScript 3.0   stop();   this.addEventListener(Event.ENTER_FRAME, handleLoading);   function handleLoading(event:Event):void{                 var total:Number = event.currentTarget.loaderInfo.bytesTotal;         var loaded:Number = event.currentTarget.loaderInfo.bytesLoaded;           trace(int((loaded/total)*100)+ "%");                 if (loaded >= total){             [...]
Posted in ActionScript 3.0 | Tagged , , , , | Leave a comment

How to Control Volume with ActionScript 3.0

ActionScript 3.0   import flash.media.SoundMixer; import flash.media.SoundTransform;     //All sound channels SoundMixer.soundTransform = new SoundTransform(.5);       //Without a sound channel: var sTransform:SoundTransform = new SoundTransform(); sTransform.volume = volumeLevel; musicSoundChannel.soundTransform = sTransform;     //With a sound channel: protected static var musicSoundChannel:SoundChannel; … var urlRequest:URLRequest = new URLRequest(url); if (musicSoundChannel != null){   [...]
Posted in ActionScript 3.0 | Tagged , , , | Leave a comment

How to Align any Object to Center of Stage – Action Script 3.0

ActionScript 3.0   public static function alignToCenter(obj:DisplayObject):void {         obj.x = obj.stage.stageWidth / 2 – obj.width / 2;         obj.y = obj.stage.stageHeight / 2 – obj.height / 2; }  
Posted in ActionScript 3.0 | Tagged , , , | 1 Comment

Basic Reflection Effect in ActionScript 3.0

ActionScript 3.0   var className:String = ‘com.firstrowria.SampleClass’; var classReference:Class = Class(getDefinitionByName(className)); var classInstance:Object = new classReference(); var functionName = ‘sampleFunction’; var functionName2 = ‘sampleFunctionWithParameter’; classInstance[event.functionName](); classInstance[event.functionName2](‘this is my string parameter’);  
Posted in ActionScript 3.0 | Tagged , , | Leave a comment

Basic Drag with ActionScript 3.0

ActionScript 3.0   private function init():void {                  theDragClip.addEventListener( MouseEvent.MOUSE_DOWN, handleStartDrag);         theDragClip.addEventListener( MouseEvent.MOUSE_UP, handleStopDrag); }   private function handleStartDrag(e:MouseEvent) {         //if (e.target == stage) {                 theDragClip.startDrag();             [...]
Posted in ActionScript 3.0 | Tagged , , | Leave a comment

How To Create a Basic Glow Effect – ActionScript 3.0

ActionScript 3.0   import flash.filters.GlowFilter; import flash.filters.BitmapFilterQuality;   var flt:GlowFilter = new GlowFilter(); flt.strength = 2; flt.quality =  BitmapFilterQuality.HIGH; flt.color = 0xffff00; flt.alpha = 0.5; flt.blurY = 5; flt.blurX = 5; TargetMC.filters = [flt];  
Posted in ActionScript 3.0 | Tagged , , | Leave a comment

How to use the Microphone API in Flash – ActionScript 3.0

ActionScript 3.0   trace("Available sound input devices:");   //Detect which Microphone Devices are available var deviceArray:Array = Microphone.names; for (var i:int = 0; i < deviceArray.length; i++) {         trace(" " + deviceArray[i]); }   //Create a new Microphone var mic:Microphone = Microphone.getMicrophone(); //Default = 50 mic.gain = 60; //22Kbs mic.rate = [...]
Posted in ActionScript 3.0 | Tagged , , , | Leave a comment