Create a Compiled Clip to Reduce Clutter in Flash

Sometimes when you are delivered an animation to put into your flash project, it contains quite a lot of messiness in the library.

A quick way to resolve that issues is to make a ‘compiled clip’ before adding the animation to your project.

First, open the project with the animation in it and select the entire animation.

Right click the frames and select ‘copy’

Next, create a new symbol (ctrl-f8)

Name the symbol, then checkmark export for actionscript. select OK.

right click on the first keyframe in this new symbol, and click paste. This will paste the entire animation into the new symbol.

Now, click the box in the bottom of the timeline called ‘select multiple frames’. Make sure to drag out the selector to cover your entire animation. Once you have done that, select EVERYTHING on your stage, and move it to the zero x and y positions.

Next, go back out of your animation and right click the newly created clip in the library. Select ‘Convert to Compiled Clip’.

This creates a new clip that you can simply copy and paste into your project without needing any of the other assets. Much cleaner!

Only one movie clip to deal with the entire animation!

Find Hidden Malicious Code In Your Website

This is a little off the subject of Actionscript 3, but I think it’s an important little trick to know for anyone building content for the web. So here I am going to show a quick php snippet that will find hidden malicious code in your website, or more specifically, how to find hidden ‘strings’ of code in your site.

I’m not going to get into the obvious stuff about how to protect your site, site as good ftp passwords etc, that is for another article. This is just to help you find the offending garbage once it’s already there.

To cut to the chase, did you get some message while trying to visit your site saying that google has blocked it because of a virus infection? Usually it will give you a list of sites that are harboring malicious data that your site is linking back to. Someone has injected malware javascript into your site.

You can manually search for all of the infected javascript files, or you do the following:

1. create a new file, and call it finder.php
2. edit it, and paste the following code:

<?php
$input = "grep -r " . "'" . "keyword" . "'" . " *";
echo "Below is a list of all files containing your keyword:";
$output = shell_exec($input);
echo "<pre>#$output</pre>";
?>

3. change the word keyword to the malware domain name that google reported your site to be infected with.
4. save this file into the root folder of your website.
5. navigate to www.yoursite.com/finder.php

A list of occurences of that keyword will be shown. Now just open up all of the listed javascript files, scroll to the bottom and delete the code that has been injected into your site!

It will look through your entire site and return any instances of

Site optimized for non-IE browsers

I just wanted to leave a little note to let everyone know that this site is optimized for browsers that are NOT Internet Explorer. If you are using IE and notice weird things happening on my blog, well, they will not be fixed.

Internet Explorer Troll
IE Troll

I spend a GREAT deal of my working days hacking css on other sites that I work on for my day job in order to make them compatible with IE. I refuse to do this with my own site. If (however) you find problems with funky things happening in standards compliant browsers such as Firefox, Chrome or Safari, then I will be happy to look in to it.

Thanks, and most importantly – IE Sucks. Install a modern browser (Internet Explorer 9 does NOT count)!

How to ‘smooth’ an FLV / F4V video for Scaling

Have you noticed that your embedded Flash video looks like crap if you scale your flash file up or down?

A lot of people don’t realize this, but you can actually apply smoothing to flash video, just as you can to a bitmap image.

All you have to do is apply the following Actionscript 3 code to your video clip instance:

for example, say your video clip instance is called ‘video’

video.getVideoPlayer(video.activeVideoPlayerIndex).smoothing = true;

That’s it! Now you can scale your flash video along with your other graphics. If you plan to scale up, be sure to use a video with a greater resolution than you need, so that you can get the best results. Scaling down will just simply work.