Tag Archives: actionscript

AS3 switch statement using a string

Simple switch statement in ActionScript 3 var action:String = “addOption”; switch(action){ case “addOption”: //Code here break; case “removeOption”: //Code here break; default: //Default code here }

Posted in ActionScript 3.0 | Tagged , , , | Leave a comment

Searching through an array in AS3

Search for a value in Actionscript 3. var myArray = new Array(“bob”, “jimmy”, “sue”); var searchForJimmy = function (searchValue) { trace(“searching for: “+searchValue+” array length: “+myArray.length); for (var i=0; i < myArray.length;i++) { if (searchValue == myArray[i]) { trace("found "+searchValue+" … Continue reading

Posted in ActionScript 3.0 | Tagged , , , , | Leave a comment

For loop in actionscript 3

Example of a for loop in ActionScript 3. Enjoy for (var i:Number = 0; i < image.length; i++){ addChild(image[i]); image[i].x = (50*i); }

Posted in ActionScript 3.0 | Tagged , , , , | Leave a comment

Calling a function from javascript to actionscript 3

Calling a function from Javascript to Flash / ActionScript 3. //Javascript———- function flashCom(flashIDName, stringVar){ var video = (isIE()) ? window[flashIDName] : document[flashIDName]; video.updateFlash(JSONString); } flashCom(“flash_object_id_name”, “string_to_be_passed”); //AS3—————- package com{ import flash.external.ExternalInterface; public class init extends MovieClip { public function init():void … Continue reading

Posted in ActionScript 3.0, Javascript | Tagged , , , , | Leave a comment