Remove an onRelease Handler

After creating a onRelease handler in Actionscript 2 as follows: 1 myMovieClip.onRelease = function() { doWhatever(); } ..you then want to remove the handler for whatever reason, you can remove it like this: 1 delete myMovieClip.onRelease;

shortText function toggler in php

I often have to show a shortened version of a news item and then a link to show the entire news article or whatever. Here’s a way to get that short text! 1 2 3 4 function shortText($text, $length) { if( strlen($text) > $length ) return substr(preg_replace("/(<\/?)(\w+)([^>]*>)/", "", $text), 0, $length)."?"; return preg_replace("/(<\/?)(\w+)([^>]*>)/", "", $text); }

PHP – file() lines

1 2 3 4 $lines = file('all-words.txt'); foreach ($lines as $line_num => $line) { echo "Line number ".$line_num; }

Windows Live Writer – Beta2

Start writing content to your blogs from your Windows Desktop now. No need to login to your wordpress backend to post items anymore, there is now a decent desktop application that allows you to do exactly that! I have looked at it before but not until recently when Beta2 came out did I gain more interest for it. The WordPress functionality added is what got me going and now I am able to post directly!

Reported Attack Site!

What the heck is that? So you’ve just visited a website using Mozilla Firefox and this message has popped up telling you that the site looks suspicious. Usually the site has been marked as a possible virus containing website and Firefox will show you this message attempting to protect itself against Malware, Spyware or other forms of Viruses. There are occasions when this is mearly a warning and not to be taken as concrete evidence of viruses or impending browser/computer doom!

Simple HEX Colour Values

Actual Display Colour HEX Colour #000000 #FF0000 #00FF00 #0000FF #FFFF00 #00FFFF #FF00FF #C0C0C0 #FFFFFF

Send Email PHP Function

Ever find yourself typing the headers into the php mail() function over and over again? Try using a standard function and calling it when you need to send mail. 1 2 3 4 function sendEmail($subject,$content,$from,$to){ $header = "Content-Type: text/html; charset=iso-8859-1\nFrom:$from"; if( mail($to, $subject, $content, $header) ); }

mySQL Development Tools

I came across a very interesting article about mySQL Development Tools. http://www.smashingmagazine.com/2009/03/25/mysql-admin-and-development-tools-round-up/

Outlook Tasks

I use Outlook for email and because of that I ended up using the Tasks feature which turns out to be pretty damn useful. It is called the To-Do Bar and if you don’t immediately see it you can open it by clicking on View->To-Do Bar. Select “Normal” and make sure the “Task List” is checked in that list. When a work email comes in that needs attending to, I usually Flag it by clicking the flag icon to the right of each email in my inbox.

1180: Call to a possibly undefined method getURL. Actionscript 3

Hello all actionscripters, you can’t use getURL anymore in Actionscript 3. Below is how you should now start doing it: 1 2 3 var request:URLRequest = new URLRequest("http://www.ataiva.com/"); try { navigateToURL(request, '_blank');} catch (e:Error) { trace("Error occurred!");}

Online Flash IDE Anybody?

Anyone up for an online Flash IDE? Take a look at this: http://antimatter15.com/ajaxanimator/build/ Nice work!

Papervision Event Listener Idea

The problem: While working on a Papervision3D Flash Project I had a problem where a back button that sits above the 3d canvas and acts as a main navigational item was required to change Events according to where the site was in 3d space at the time. The solution: Everytime I’m about to add a new EventListener to the back button movieclip I call the function “delBB()” and then add my event listener using addBB(with the event here).

Don’t cache my swf files!

I often have issues where ‘dumb browsers’ cache my published swf files and when they dynamically populate they don’t always update. This is SUPER annoying and I have found a solution. I will demonstrate the technique with a LoadsVars example 1 2 3 var nc = Math.floor(random(1000000) / random(1000)); var send_lv:LoadVars = new LoadVars(); send_lv.sendAndLoad(_root.siteURL+"profile.php?action=showallimages&amp;nc="+nc, result_lv, "POST"); So let me describe what is happening here. The really ‘dumb browsers’ like IE7 in this case decide that seeing as the URL in question has the exact same name, it will be clever and just use the last version it saw and be totally lazy and not attempt to get the data again.

Clear an array in Actionscript 3

I personally really like this way of clearing an array’s elements: Declare your array to use: 1 var myArray:Array=new Array(); Add elements: 1 2 3 for (var i:Number;i<10;i++) { myArray[i] = "an item"; } Clear the array:

Change combobox font size in Flash Actionscript

Ever needed to change the font size of a standard flash combobox component? You will need to give it an instance name e.g. “myCombobox” and then add the following code: 1 myCombobox.setStyle("fontSize", 10);

Wordwrap that PRE!

Ever used a <PRE> in a limited width div container? You will notice that the line gets cut off almost as if word-wrap was not enabled. To correct this you can add the following code into your CSS file. 1 2 3 4 5 pre{ white-space: pre-wrap; /* CSS2.1 compliant */ white-space: -moz-pre-wrap; /* Mozilla-based browsers */ white-space: o-pre-wrap; /* Opera 7+ */ } This code was originally found somewhere else online but I found it really useful so reposted it!

Barclays ePDQ Payment Gateway

Hello all! Today we will be talking about Barclays online payment gateway valled ePDQ. You can take a look at what they have got to say by clicking here to view Barclays’ site or you could keep reading 🙂 Well, for all you php guys out there, this post if for you! Barclays ePDQ encrypts your data string of products in your basket and returns a result that is sent with your HTML form on your site.

BrainWHAT? programming language

I came across a programming language today that I have never heard of. Go take a look over here: http://en.wikipedia.org/wiki/Brainfuck

Transparent swf in html

So you have now placed a swf file into your html page and you want to be able to see through it. Lucky for you, this is a very easy thing to do! The following code does the trick: 1 <object data="flash/home_side_left.swf" type="application/x-shockwave-flash" width="40px" height="550px"><param name="movie" value="flash/home_side_left.swf" /><param name="bgcolor" value="#ffffff" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /></object> Notice that by just adding the wmode and setting it as ‘transparent’ does everything for you!

Constant updates?

I just hate it how everything always wants to update… and then restart all the damn time! First things first: This pops up telling me it’s doing a 309.6MB Adobe Reader Update! Which to me is just crazy… Surely the constant updates shouldn’t be a million times larger than the actual initial install file for the application? I just click Cancel and then do this.. Not a minute later and this little guy pops up!