Category Archives: Flash blogs
Actionscript 3: Detect hidden movieclip on stage overlapping buttons
If you run into issues with an invisible display object covering your button but you don’t know where it is, this handy code snippet I got from my co worker Kris can trace it out for you. Just drop it … Continue reading
Actionscript 3: Using modulos to wrap a moving movieclip
A clean way to wrap a movieclip wrapping around the stage is to use modulos var widthOfStage:Number = stage.stageWidth; var velocity:uint = 1; myClip.x = (myClip.x + velocity) % widthOfStage; That part is easy. The difficult part is handling moving … Continue reading
Actionscript 3: Bold not working on external fonts in a font family.
There was an issue with compiling external font swf made up of a font family in flex builder. For example when trying to generate a set of AkzidenzGrotesk regular, light, bold and black the bold will now show up. Here … Continue reading
Actionscript 3: Get ratio value between two numbers
Simple utility for getting a ratio between two numbers. Thanks to my friend Jamie for the method. private function returnValue(value:Number, actualMin:Number, actualMax:Number, ratioMin:Number, ratioMax:Number):Number{ return (((value – actualMin) / (actualMax – actualMin)) * (ratioMax – ratioMin)) + ratioMin; } Here … Continue reading
Actionscript 3: Detect the difference between a Mouse click and a Mouse drag.
How do you tell if the user clicked or dragged in your flash app? Take a look: private var time:uint; function onMouseDown(event:Event):void { time = getTimer(); startDrag(); } function onMouseUp(event:Event):void { var diff = getTimer() – time; if (diff < … Continue reading
Actionscript 3: Move first array index to the back and back to front
Here is a very cool line of code to manipulate an array. If you want to take the first item of an array and place it at the end: myArray.push(myArray.shift()); If you want to take the last item of an … Continue reading
Actionscript 3: Check if flash is stand alone or in browser
Here is a quick code snippet if you want to have links trace the value locally but link out in the browser. if (Capabilities.playerType == "StandAlone" || Capabilities.playerType == "External") { trace("data.CTAOpen.@url : " + data.CTAOpen.@url ); } else { … Continue reading
GAIA Framework on Adobe TV
GAIA framework is a great flash framework for making flash websites with low development time with out losing functionality.
Actionscript 3: Remove all elements from a Movieclip
I’m always trying to empty out a clip and this is by far the best way : while (target_mc.numChildren) { target_mc.removeChildAt(0); } or if you prefer to be verbose : var total:uint = target_mc.numChildren; for (var i:uint = 0; i … Continue reading
Flash on smart phones
According to Dilbert, flash on smart phones really isn’t a good idea.