Stopping Flash caching everything

To stop Flash caching every URLRequested file you pull in, you need to trick flash into thinking the file is different. You can do this by changing the URL with a date/time reference, so the URL is different every time. Try sticking the below on the end of the url to load: "&nocache=" + new... Continue Reading →

Switches (case) in AS3

function topicNavHandler(event:MouseEvent):void { switch(event.type) { case MouseEvent.ROLL_OVER: trace("rollover!"); break; case MouseEvent.ROLL_OUT: trace("ROLLOUT!"); break; }

Centering DIVs with CSS in IE

This will align your divs in the center for Internet Explorer if the old standard margin-left:auto etc. doesn't do the do. body { text-align:center; margin:0px; } #center_box { padding-top:200px; width:700px; margin:0 auto; text-align:left; }

draw gradient dynamically with AS3

Found this gem of an example for drawing dynamic gradients: /**************************** Import Classes ****************************/ import flash.display.*; import flash.geom.*; /**************************** Define Variables ****************************/ //Type of Gradient we will be using var fType:String = GradientType.LINEAR; //Colors of our gradient in the form of an array var colors:Array = [ 0xF1F1F1, 0x666666 ]; //Store the Alpha Values in... Continue Reading →

Hide UI scrollbar when there isn’t enough text

If you only want the scrollbar to show when there is enough text to warrant a scrolling, use the following: vScrollBar.visible = contentText.maxScrollV > 1; contentText.addEventListener(Event.CHANGE, function():void{ vScrollBar.visible = contentText.maxScrollV > 1; }); src: http://www.kirupa.com/forum/showthread.php?t=296865

htmlText missing lines of text – autosize – AS3

If you've got htmlText, imported from, say, xml - you might lose some lines in bullet lists and things, just some real odd stuff like that. You can sort that out by assigning autosize to the textField, AFTER you've assigned the text to it. coursesField.autoSize = TextFieldAutoSize.LEFT; coursesField.wordWrap = true; coursesField.htmlText = whatever;

Character codes for ECMA based languages

\f matches form-feed. \r matches carriage return. \n matches linefeed. \t matches horizontal tab. \v matches vertical tab. \0 matches NUL character. [\b] matches backspace. \s matches whitespace (short for [\f\n\r\t\v\u00A0\u2028\u2029]). \S matches anything but a whitespace (short for [^\f\n\r\t\v\u00A0\u2028\u2029]). \w matches any alphanumerical character (word characters) including underscore (short for [a-zA-Z0-9_]). \W matches any... Continue Reading →

Retrieving attributes from XML in AS3

To return specific attributes of an xml node, you can use the @[attribute] reference - pretty handy. Eg, with this xml: <question file="test_file.swf"> You can call that file attribute using the below: myXMLList.question[0].@file; // returns test_file.swf

Adding embedded sounds via AS3

AS3 has this nasty habit of not playing sounds you put on timelines of embedded clips how you might like. They might start at random times when other things're playing, play on frames with no sound, no real end to all the crazy things it might do. Safer to use actionscript directly to add the... Continue Reading →

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

Up ↑