Random decimals added to numbers AS3

Pretty stupid thing I just tripped up on, but I was incrementing through a loop, adding 0.05 to an angle each time (for circular movement). I noticed after a while, the number, which should have just changed between 0.00, 0.05, 0.1 etc. was ending up being 0.15000000000000002 and therefore screwing everything up - for no... Continue Reading →

Getting the class of a DisplayObject in AS3

Handy wee snippet: Class(getDefinitionByName(getQualifiedClassName(myMC))) (Remember to import flash.utils) Then you can bang it out like-a-so: var mc:MovieClip = new targetClass(); eg. this below, gets the class of an instance called 'page0' within contentMC, creates a new one and adds it to the stage: var targetClass:Class = Class(getDefinitionByName(getQualifiedClassName(contentMC.page0))); var tempPage:DisplayObject = new targetClass(); addChild(tempPage); And if... Continue Reading →

Dynamically add Filters to objects AS3

To add filter effects to DisplayObjects in AS3 it is just as easy as applying text formatting or color formatting - well, there's an extra intermediary in there but it's much the same idea. Easier to show an example than to explain: var blurred:BlurFilter = new BlurFilter(blurAmount, blurAmount); var filters:Array = [blurred]; myMc.filters = filters;... Continue Reading →

Menus disappearing in Captivate 3?

Are you losing your menus in Captivate when you're working with flash clips? There's a simple but obscure work around for this! Solution: Open up your library tab and click on a few different library items - the top menu should now work correctly. No more restarting Captivate every time you touch an embedded animation!... Continue Reading →

Get clean URLs to work in WAMP

If you can't get WAMP to do clean URLs for you in Drupal you may need to enable the rewrite_module in WAMP if you've just set it up. Click the tray icon » Apache » Apache modules » rewrite_module (should be checked) 

Replace Characters in a String AS3

Using split() and join() you can strip or insert characters into strings very easily. The below function can be called to do just that. /// Replaces characters in a string. public static function replaceChars(targetString:String, charactersToStrip:String, replacementCharacters:String = "") { targetString = targetString.split(charactersToStrip).join(replacementCharacters); return targetString; }

CSS Stylesheets for htmlText fields in Flash AS3

You can make your htmltext fields have highlights etc by applying some minor CSS styles to the htmltext fields in Flash. var theCSS:StyleSheet = new StyleSheet(); theCSS.setStyle("a:link", {color:'#361B59', textDecoration:'underline'}); theCSS.setStyle("a:hover", {color:'#532C8F', textDecoration:'none'}); contentField.styleSheet = theCSS; More things you can do: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/text/StyleSheet.html

HTML Characters in XML

I've been doing some work with XML in AS3 and needing to have the XML contain HTML characters for an htmltext field in Flash - for links and lists etc. Few ways to approach that: <![CDATA[ "Rampant <'s and &'s in the XML fields that XML ignores due to special CDATA tags within the fields"... Continue Reading →

Loading XML into flash as an XML object

loading XML into flash as an XML object // xml loader var xmlLoader:URLLoader = new URLLoader(); var xmlData:XML = new XML(); xmlLoader.addEventListener(Event.COMPLETE, loadXML); xmlLoader.load(new URLRequest("leadership_development_framework.xml")); function loadXML(event:Event):void { xmlData = new XML(event.target.data); } Further to that, once you've your xmlData filled, you can chop it up with XMLList to make sub-listings for easier management. For... Continue Reading →

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑