— Shang Liang

Archive
Tips

I spent hours trying to solve this problem. If you need to load an swf which runs away3d inside it, the loaded swf may get cropped off on the right and bottom sides. Don’t try to set the clipping attributes of the View3D instance. I’ve tried all sorts of clippings but had no luck. The problem lies with the swf’s document dimension. Once that’s set correctly, the cropping problem will be fixed.

Read More

To have 2 glows, you need to apply the inner glow first then the outer glow. If not, the inner glow will not be activated. It’s true for both timeline based filters and scripted filters.

Read More

From: tech-bits.com

“Some hosting providers are still using php 4 as their default for scripts, but offer php5 as well.  To force your scripts to all use php5, you can try adding this to a .htaccess file on your site:

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

Read More

I’ve never seen such clear webcams before! The PS3 Eye is truly amazing!

By default, PS3 Eye is not supported by Windows or Mac OSX. Luckily there are drivers ready for you to grab. For PC, use this driver. For Mac OSX, use this driver.

To get PS3 Eye working for openframeworks in windows, you need to edit one line in file “ofVideoGrabber”. The solution is found in this thread, changing

bool bOk = VI.setupDevice(device, width, height);



into

bool bOk = VI.setupDevice(device, width, height, VI_COMPOSITE);



Remember to clean the project first and compile it to reflect the changes.

For Mac OSX, all you need to do is to copy “maccam.component” into “Library\QuickTime\”, no changes on the source code needed.

Enjoy!

Read More

Most of my Flash projects use XML as “database” and PHP is my preferred server script.  I found Simple_HTML_DOM Parser quite a good tool for reading and writing XML files. The default DOM in PHP is quite hard to use. The syntax for creating nodes in PHP is very tiring. Besides that, the biggest headache is that the scripts written for PHP 4 are not compatible with PHP 5.

Simple HTML DOM Parser is designed for reading and editing HTML but it works fine with XML files, since XML files are more tidy than HTML. Reading and traversing the XML is easy, just use the find function.

$xml = file_get_html('http://www.google.com/');
foreach($xml->find('img') as $element)
       echo $element;

Writing a new node is not difficult either.

$node = str_get_html('<sample_node>Hello World</sample>');

Read More

Previously in Flash CS3, the trick of getting autocompletion in FlashDevelop is not working any more in Flash CS4, ast least not in my case. After testing a while I finally got it working again by setting the swc path of the project.

Choose “Project>>Properties…>>Compiler Options>>SWC Include Libraries” and add the path of AIR swc to it. Most likely it would be something like this: “C:\Program Files\Adobe\Adobe Flash CS4\AIK1.5\frameworks\libs\air\airglobal.swc”

Cheers!

Read More

I’ve always been writing this.

		function addZero(n:int):String {
			if (n < 10) {
				return "0" + n;
			}else {
				return "" + n;
			}
		}

The function adds one leading 0 quite well but if two 0 is needed, it's quite bad to write all the conditions to check whether it's less than 100 or 10. I think the following code is more efficient.


		function addZero(n:int, numZeros:int = 1):String {
			var str:String = n + "";
			while (str.length<numZeros+1)
			{
				str = "0" + str;
			}
			return str;
		}

Read More

Pixel fonts tend to get blur in Flash. Most of the time the problem can be solved by setting the textfield’s coordinates (x,y) into integers but sometimes it fails to work. I’ve found a new trick to solve this problem. If you check the option of the textfield to be selectable, the texts appear clear no matter what their x and y are.

Read More

If your computer doesn’t have a C: drive, flash player 10 installer for firefox won’t be able to run properly. It keeps giving not enough disk space error. After Googling for a while, I found the solution in Yahoo answers.

If you don’t have a C-drive, then you can also share a folder or your root drive and then add this folder as a network drive and assign the letter C to it. after the installation you can disconnect the share again and disable sharing. Worked for me. -Yahoo! Answers

* The method that uses a USB drive didn’t work for me. My system drive is named as “W”, stands for Windows. I’m weird, I know.

It’s such a low level bug and it’s really unaccetable. I’ve installed tons of stuff in my computer and had never encounter this kind of problem before.

Read More

I’ve recently finished a project. It’s a website for a wedding gown boutique. The main function of the website is to show their products, just like a of photo gallery. There are loads of photos and I tracked every photo’s page view. While I was happily looking through the numbers in Google analytics I realise the page view duration is a very good indication of how good or popular the product is. People will stare at a photo longer if they like it and if they don’t like it they’ll quickly click at the next button. I feel this is very useful information to engage the customers’ taste.

UPDATE: as @ickydime mentioned, the tracking data is not 100% accurate. There are cases that users leave the window open, go to do something else and come back to their desks again, recording a very long page view duration. And there are also users accidentally closed the page, clicked away or some other stuff, which record very short page view duration. But all these inaccuracy will be minimised when more data is collected, the errors will be averaged with a big base. Based on the tracking data, no exact figure can be given, such as 53.4% users like product A. But the data can definitely tell that a product with average 30 seconds page view duration is more popular than a product with average 5 seconds page view duration.

Read More