Archive for 'Tutorials'

How to Load Animated Flash Header One Time During the Session

After a client had made a request for a Flash header to not animate every time a new page is loaded, I needed to figure out how to do this. Not for this one request, but for any future requests. I have previously looked this up, but came up empty. It seemed there was one solution, but it really wasn’t the greatest, because when you return to the home page, the animation would play again.

I eventually came across a solution that had no comments from other people, so I didn’t really know if it would work. The person who provided the solution also provided a link to his/her website with it in action, so I was able to see that it worked.

This solution uses PHP sessions. It works by displaying the full Flash header only if never viewed during the current session. If it has already been viewed, it will display the second (non-animated) header until the session ends, which is on browser close. The next time the website is viewed in a new session, it will display the original animated header.

The first code you need to add is placed at the top, before any other code (DOCTYPE & HTML), in the header. This code checks to see if there are any views during the current session.

< ?php
session_start();
if (isset($_SESSION['views']))
$_SESSION['views']=$_SESSION['views']+1;

else
$_SESSION['views']=1;
?>

The next code is for displaying the Flash, just as you would normally, except it’s using PHP.

< ?php if ($_SESSION['views']>1) //if session views are more than one
echo "Flash embed code here";
else //if session view is one
echo "Flash embed code here";
?>

This code is just saying: If views are more than one, display the second (non-animated) header. If views are one, display the full animated header. It is really simple.

Make sure to remove the space that appears at the beginning of the PHP code: < ?php. Also, when adding the Flash embed code to be echoed, escape any quotes with a ‘\’ (without the single quotes).

Full credit for this solution goes to www.addisoncountyeagles.com. The actual solution is in the Coffee Cup forums.

Learning Flash and ActionScript

For my job, I have to learn Flash and ActionScript. I’m slowly learning on my own. To do this, though, I had to watch videos and read books, which I’m not finished with yet. A couple of the books I have focus on animation/interactivity.

If you’re wanting to purchase Flash and ActionScript books, try to go with used books. If you look on Amazon, there are lots of used books being sold, some in really great condition. All of the used books I bought look almost brand new, excluding one which really was brand new at a used price!

Some of the books also come with a CD, so if you want the CD when purchasing new, be sure to read all of the sellers’ comments before buying.

There are some great resources available for learning Flash and ActionScript, online and offline. I thought I would share what books I purchased from Amazon and where to find videos and tutorials for learning.

Books

Look for more Flash and ActionScript books on Amazon.

Videos

Text Tutorials

Please leave a comment if you know of some other really good videos, books or tutorials.

Disclosure: This post includes Amazon affiliate links.

A Few Great Tutorials

Here are a few great tutorials for doing things with CSS! I hope you enjoy them as much as I did!

  1. Using PHP to generate CSS is a great way to centralize your color definitions just by using variables. One fun and possibly useful thing to do with this is automatically generating a color gradient from just one base color! Read this tutorial to generate CSS using PHP.
  2. Create a Lightbox effect with CSS, without using any JavaScript! This is one tutorial I am definitely going to try out, because I don’t like to use JavaScript for all those neat effects that are becoming more and more common on websites. Read this tutorial to create a Lightbox effect with CSS.
  3. Want to create tables using CSS? There’s an easy to read tutorial over at Veerle’s blog. Read this first tutorial and then the second tutorial for creating tables using CSS.

Photoshop: Removing Backgrounds

This is a tutorial for removing backgrounds quickly in Photoshop, rather than using the eraser tool method. This tutorial comes from ThemBid.com. Although, I don’t agree that it is a quicker way than using the eraser tool. Maybe that’s just because it was my first time. It is easier in that it allows me to erase parts that I messed up on without erasing the actual picture with it.

The tutorial is really easy to follow, so if you need a new way of removing backgrounds from images, try it out! Check out the one I did below. I took an image of a man golfing, and placed the man on an image with snow. It may not look perfect, because I’m very new to this.

Man Golfing

Man Golfing

Pictures taken from stock.xchng

Firefox: How Many Tabs?

How many tabs do you open in a Firefox window? Five, eight, twenty? I usually start off with one and then it increases to five, ten and then fifteen until I can’t see all of the tabs anymore. Firefox makes me scroll to find the hidden ones. Firefox does this so the tabs are readable, but in a previous version the tabs would shrink so much that they weren’t readable. Who cares about readable, that’s what wide screens and favicons are for!

This has bothered me for some time, but never thought there could be a setting or even a plugin to change this. Yesterday I was doing my usual, going from one website to another, searching for this or that and came upon a blog I didn’t know would make future browsing easier. Humanized is a company helping make the computer experience better for people.

On to the workaround to fix the forever scrolling tabs.

  1. Open a new Firefox tab
  2. Type about:config into the address bar
  3. Type tab into the filter field
  4. Change the settings of both browsers.tab.tabClipWidth and browsers.tab.tabMinWidth to 5 (or whatever your preference is)
  5. Restart Firefox

To learn more about how these tabs work (the workaround and previously) I recommend reading Firefox 2.0: Tabs Gone Wrong.