Category Archives: web

ActionScript Getters and Setters

It’s always nice when a programming language surprises you in a pleasant way. ActionScript 3 has get/set property syntax, very similar to C#:

public class Person implements IPerson
private var m_name:String;

public function get name():String
return m_name;

public function set name(value:String):void
m_name = value;

What was an even nicer surprise is that you can define properties in an ActionScript interface:

public interface IPerson
function get name():String;
function set name(value:String):void;

And then write code that makes it look like you’re accessing the field of an inteface:

var person:IPerson = new Person(); = “Michael”;

Now if only we had this syntactic sugar in Java…

AS3 TextField buttonMode or useHandCursor?

I was trying to find the answer of using TextField as button.

and here is the answer i found from google. :)

======== from ========

Unfortunatly, no method exits on the TextField class in AS3 as it does not extend the Sprite class, which contains the buttonMode property.

This is most apparent with the annoying problem of having a TextField inside your Sprite/MovieClip you;re trying to use as a button, where even after setting buttonMode = true on the button, rolling over the textfield inside the button will revert the Cursor back to

To get round this simply use the mouseChildren = false property on your Sprite/Movieclip button.


myTextFieldContainingSprite.buttonMode = true;

myTextFieldContainingSprite.mouseChildren = false;

myTextFieldContainingSprite.addEventListener(MouseEvent.MOUSE_DOWN …… etc

QuickTime 7: Preparing movies for Internet delivery

Prepare QuickTime streaming video can be hard.

Here is the support documentation from Apple.

:)…with DreamHost and apple. streaming video is easy :).

QuickTime 7: Preparing movies for Internet delivery

  • Last Modified: October 22, 2008
  • Article: HT2438
  • Old Article: 301355


With QuickTime Pro, you can create movies that can be delivered over the Internet. You can deliver a movie as an HTTP download or as a real-time stream.

  • HTTP download—This type of delivery allows website visitors to download the movie to their hard disk. Fast Start is a QuickTime feature that enables users to watch the movie as it’s being downloaded (long before the whole movie has been downloaded) from a standard web server. Fast Start works well for short-form movies where file size is limited. It ensures high-quality playback regardless of the users’ Internet connection speeds, though those with slower connections will wait longer before media starts to play.

  • Real-time stream—This type of delivery is provided by QuickTime Streaming Server, and delivers media in real time over the Internet, from modem rates to broadband. The file is not downloaded to a viewer’s hard disk. Instead, the media is played, but not stored, by the client software as it’s delivered. Choose real-time streaming (instead of Fast Start) for webcasts of live events in real time, delivery of long-form video, 24/7 Internet radio and TV channels, and other cases in which you don’t want viewers to store the file on their hard disk. QuickTime Streaming Server uses the RTSP protocol.

Products Affected


Preparing a movie for Fast Start

With QuickTime Pro, you can set up a movie to start playing from a web server before the movie has completely downloaded to the user’s hard disk. This is called a “Fast Start” movie. Set the Fast Start setting using the steps below just before you distribute your movie; making other changes and resaving may undo the Fast Start setting.

Converting a movie for Fast Start

  1. Open your movie in QuickTime Player.
  2. From the File menu, choose Export.
  3. From the Export pop-up menu, choose Movie to QuickTime Movie.
  4. Click Options and select any video and sound compression options appropriate for web delivery.
  5. Make sure the “Prepare for Internet Streaming” checkbox is selected and that Fast Start appears in the pop-up menu.
  6. Click OK, then click Save.

Preparing a movie for real-time streaming

To set up a movie for streaming over the Internet, compress the movie so that its data rate is appropriate for the bandwidth at which your users will connect. You can use the hinted streaming format with QuickTime Streaming Server or Darwin Streaming Server. The hint tracks, which are stored in the movie along with the video, audio, and other tracks, provide QuickTime Streaming Server software with information about the server, the transmission packet size, and the protocol to be used–in short, how to send the movie data over the network.

When you choose hinted streaming, “hint tracks” (information needed to stream the movie) are added to the movie. If the movie is already in the desired format, you can prepare a movie for streaming by opening the movie in QuickTime Player and choosing Export from the File menu, then Movie to Hinted Movie. If you want to change the movie’s format, follow the steps below.

Converting a movie for real-time streaming

  1. Open your movie in QuickTime Player.
  2. From the File menu, choose Export.
  3. From the Export pop-up menu, choose Movie to QuickTime Movie.
  4. Choose a streaming option from the Use pop-up menu.
  5. Click Options and select the “Prepare for Internet Streaming” checkbox.
  6. Choose Hinted Streaming from the pop-up menu and click OK.
  7. Click Save.

If you want to stream a QuickTime movie using QuickTime Streaming Server, you should use a web-optimized video or audio compressor to compress the movie file. All QuickTime compressors are compatible with QuickTime Streaming Server, but the compressors listed below are optimized to give the best results for delivery over the Internet.

For a complete list of QuickTime-supported compressors, see the Products area on the QuickTime website.

Video compressors
H.264, MPEG-4, Sorenson Video (any version), H.263, H.261

Audio compressors
AAC, QUALCOMM PureVoice, AMR, QDesign

For more information about preparing a movie for streaming, see QuickTime Tutorials.

Creating reference movies to optimize web playback

You can use reference movies to provide a movie that’s been optimized for different users’ connection speeds. For example, you can have a smaller movie streamed to users who are connected over a standard modem, and a larger version of the movie streamed to users who are connected over a broadband connection. Apple provides a free tool, MakeRefMovie X, that greatly simplifies the process of creating reference movies. You can download this software from here.

Definitive Sticky Posts Guide for WordPress 2.7

If you’re familiar with the loop, you’ll probably recognize the following code (or some variation of it):

<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_content(); ?>
<?php endwhile; endif; ?>

In order to use the new post_class template tag, just be sure to wrap the content of each post that the loop outputs in a new div. The code would looks something like this:

<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div <?php post_class(); ?>>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_content(); ?>
<?php endwhile; endif; ?>


CSS font size chart ( by px => percent )

This is very useful and provided by YUI (Yahoo! UI Library).

I didn’t have any good impression toward to Yahoo! before.

But i am very glad they could share their UI database to open source.

Check out the original documents from here

If you want this size in pixels (px) Declare this percent (%)
10 77
11 85
12 93 (was 93)
13 100
14 108 (was 107)
15 116 (was 114)
16 123.1 (was 122)
17 131 (was 129)
18 138.5 (was 136)
19 146.5 (was 144)
20 153.9 (was 152)
21 161.6 (was 159)
22 167
23 174
24 182
25 189
26 197

CSS Hacks (for IE 7, IE 6, Opera, etc)

The following CSS selectors are considered workarounds and hacks for specific web browsers.

IE 6 and below
* html {}
IE 7 and below
*:first-child+html {} * html {}
IE 7 only
*:first-child+html {}
IE 7 and modern browsers only
html>body {}
Modern browsers only (not IE 7)
html>/**/body {}
Recent Opera versions 9 and below
html:first-child {}

Source: CSS Hacks

If you want to add 5px padding to a div element called #comments specifically for IE 7, then you can use the following hack:

*:first-child+html #comments {
padding: 5px;

But if you want to apply the padding just for IE 6, then the following will do the trick:

* html #comments {
padding: 5px;

Note that CSS Hacks are not recommended due to their dependence on browser bugs and therefore they should only be used as the last resort.

A more comprehensive article on CSS Hacks can be found here.