Categories
Friends
Links
Category Archives: ActionScript 3.0
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 ActionScript 3.0, Checkbox, Checkbox Flash, Create a Checkbox, Flash, form 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 ActionScript 3.0, Flash, Load External SWF, Load SWF, Loader 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 ActionScript 3.0, Flash, Pre Loader, Preloader, Simple Timeline Preloader 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){ [...]
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 Action Script 3.0, Align to Center, Center of Stage, Flash 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’);
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(); [...]
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];
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 ActionScript 3.0, Flash, How to use the Microphone, Microphone API Leave a comment
How to make Fullscreen with ActionScript 3.0