Pixel Acres

Aligning an element to the bottom of its container

Here is a little CSS trick that allows you to align content to the bottom of its container, in a similar fashion to how vertical-align="bottom" works in table-based layouts.

Let’s say we want to display an image with a title aligned to its top right corner, and a caption aligned to its bottom right corner:

Bottom Aligned Element

Filed under: CSS

Flash video bufferTime gotcha

I have recently been working on a website that contains a lot of video content, including some fairly short videos – less than 20 seconds in length. To ensure uninterrupted playback of these short clips I thought it would be smart to buffer the entire video stream before beginning playback.

In AS3 this can be achieved using the bufferTime property, which I set to 20 seconds:

var nc:NetConnection = new NetConnection();
nc.connect(null);
 
var ns:NetStream = new NetStream(this.introVideoConnection);
ns.bufferTime = 20;
 
var video:Video = new Video(320, 240);
this.addChild(video);
video.attachNetStream(ns);
 
ns.play("myvideo.flv");

But when I tested the results on a remote server I discovered that Flash was waiting the entire 20 second duration before starting the video stream, despite the fact that the flv had fully downloaded in just a few seconds.

Erase an image using your mouse in AS3

I recently had to create a simple Flash application that allowed the user to ‘erase’ an image using their mouse. I couldn’t find any examples of the exact effect I wanted, so I cobbled together my own. The effect I came up with is similar to using the eraser tool in Photoshop.

Demo

Click and drag your mouse on the image below to erase it. Press the reset button to start over.

Get Adobe Flash player

 

My run-in with the Great Firewall of China

Recently I was developing a website for a client whose primary export market is in China. Needless to say I was a little alarmed when my client’s representatives in China reported that they couldn’t access their new site.

My client has reps in both Shanghai and Beijing, neither of who could see the website, so I knew it wasn’t a localized issue. My immediate suspicion was that the infamous “Great Firewall of China” was to blame. Thankfully I was able to take a few simple steps to diagnose the problem and get the site up and running.

Version targeting lessons from Flash

In my last post I outlined some of the problems that might arise from the proposed version targeting changes to Internet Explorer 8. My major concern was that by removing the motivation for web authors to update legacy sites, version targeting might hamper the adoption of modern web development techniques. During the week I have given some more thought to this issue, and it occurred to me that in Adobe Flash we have a fantastic real-world test case from which we might learn if version targeting is a viable strategy for a web browser.

Breaking the web

When Dean Hachamovitch demonstrated in December that the forthcoming Internet Explorer 8 browser passed the Acid2 test in standards mode, there were calls for Microsoft to clarify if “standards mode” was the default setting for IE8. Last week it was announced on A List Apart and the Internet Explorer blog that IE8 will render pages using an IE7-level rendering engine by default, and that web developers must opt-in to take advantage of the new Acid2-compliant rendering mode.