<script type="text/javascript" src="jquery/jquery-1.7.1.min.js"></script> <script type="text/javascript"> function init() { $(".simBox").click(function(){ window.location=$(this).find("a").attr("href"); window.open($(this).find("a").attr("href")); return false; }); $(".simBox").mouseover(function(){ $(this).addClass("simBoxOver"); }); $(".simBox").mouseout(function() { $(this).removeClass().addClass("simBox"); }); } $(document).ready(function() { init(); }); </script> </head> <body> How do I...<br><br> <div class="simBox"><a href="about:blank">Enrol in elearning?</a></div> Src: http://css-tricks.com/snippets/jquery/make-entire-div-clickable/
Ampersand in Flash
You can use %26. This came up when someone had a & symbol in an email address field. %26
Rescale Module Wrapper
This is a pretty handy wee class, for if you make something you want to scale down, but not scale up when the screen size is bigger. So all you need to do is wrap your module into a .swf built off this class, and in the HTML set the width/height of the flash box... Continue Reading →
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
DataGrid select a particular row
Not much to this snippet haha, but I had trouble finding it. It's part of the SelectableList class. dataGrid.selectedIndex = 0;
DataGrid get data from the selected row when clicked
gridBox.addEventListener(ListEvent.ITEM_CLICK, ItemClicked); function ItemClicked(e:ListEvent){ //heres the bit you want var o:Object = e.item; trace(o.Name); trace(o.Age);
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