Dynamic Scaling in Flash

If you're making your movie do it's own rescaling dynamically (ie. the stage is 100% of window size etc and the flash movie is moving some shell clip around to center etc.) need to remember to put this in, else it won't be hearing any of the stage resize events and your rescaling won't fire.... Continue Reading →

Override inline CSS styles

This handy chap has simply showed the light of CSS overrides, nice and easy really. Slap important over what inline styles you want overridden! <div style="background: red;"> The inline styles for this div should make it red. </div> div[style] { background: yellow !important; } src: http://css-tricks.com/2708-override-inline-styles-with-css/

try / catch

Try and catch is most handy for handling files with AIR etc. Pretty straightforward, but just incase you forget the syntax: try { // statements } catch (error:ArgumentError) { trace('An argument error has occured'); } catch (error:Error) { trace('An error has occured which is not argument related'); } src: (ty) http://www.foundation-flash.com/tutorials/tryandcatch/

DataGrid data to XML AS3

Probably not the prettiest method to do this, but it'll do for just before I go home. This is to change datagrid objects back into XML - this is only for my case and needs custom coding, but the method is there! var newXML:XML = new XML(<coaches></coaches>); for (var i:int = 0; i < dataGrid.length;... Continue Reading →

Datagrid – delete selected row

Again, this is all just SelectableList behaviours but how often does anyone use datagrids to remember this?! dataGrid.removeItemAt(dataGrid.selectedIndex); http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/controls/SelectableList.html

Get frame number from label AS3

function getFrameByLabel(yourMovieClip:MovieClip, frameLabel: String ):int { var scene:Scene = yourMovieClip.currentScene; var frameNumber:int = -1; for( var i:int ; i < scene.labels.length ; ++i ) { if( scene.labels[i].name == frameLabel ) frameNumber = scene.labels[i].frame; } return frameNumber; } Src: http://stackoverflow.com/questions/4846858/as3-simple-way-to-get-the-frame-number-of-a-frame-label

Listing object properties / names

If you need to get the property names from an object: var object:Object = {name:"lawrence", age:"26"}; for( var o : * in object){ trace( o + " = " + object[o] ); } source: http://stackoverflow.com/questions/372317/how-can-i-get-list-of-properties-in-an-object-in-actionscript

TweenMax tween curves

import com.greensock.TweenMax; import com.greensock.plugins.BezierPlugin; import com.greensock.plugins.BezierThroughPlugin; TweenMax.to(sp,5,{bezierThrough:[{x:250,y:100},{x:50,y:200},{x:500,y:200}]}); Man TweenLite/TweenMax is awesome.

Flash Scaling with Firefox

If you're making a flash clip take up the entire browser window, as can be necessary on occasion, in most browsers throwing in height="100%" works fine. Not so with firefox. Firefox interprets the doctype strictly, which disables the internal elements from setting the height of the window (100% of something in a div, will just... Continue Reading →

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

Up ↑