jump to navigation

This is NOT the official website of AvantBiz Consulting Limitd but just some casual discussions about various topics. Please visit www.avantbiz.com if you need our professional services.

解決透明 png 在 ie 6 下的問題: jQuery pngFix November 6, 2009

Posted by eddie in : Web 網頁 , add a comment

http://jquery.andreaseberhard.de/pngFix/



常見的CSS+DIV問題整理 October 15, 2009

Posted by eddie in : Web 網頁 , add a comment

Q.如何讓DIV區塊居中?

A.假設你的DIV總寬度是900px,我們可以這樣寫:

  1. <style>
  2. #page {width:900px;margin:0 auto;}
  3. </style>
  4. <div id="page">居中的區塊</div>

Q.為什麼IE對於margin的算法有些不同?

A.當我們針對div設定了浮動(float)屬性之後,IE瀏覽器就會將margin加倍計算。例如我們設定margin-left:5px;,IE會算成10px。解決的方法是在該浮動區塊加上「display:inline」即可解決這個問題。

Q.為什麼設定超連結的visited會失效?

A.超連結的樣式有一定的順序,如果你同時要設定visited(訪問過的連結),或是active(作用中的連結),必須要按照這個順序設定:a:link→a:visited→a:hover→a:active。我們不用死記順序,可以這麼記:love、hate

Q.如何在圖片上方放置flash?

A.有時候我們會看到有人的圖片上有flash的光圈特效,如果你要使用該特效,請將圖片設定為背景圖,然後在上方插入flash,記得要將flash設置為透明屬性:

  1. <param name="wmode" value="transparent" />

Q.在火狐瀏覽器設定最小高度

A.一般對區塊設定高度(height)後,在火狐瀏覽器中如果輸入超過高度的文字,區塊不會被撐開。如果我們希望可以設定最小高度,同時又希望文字過多可以撐開區塊的話,可以將你的區塊改寫為:

  1. div {
  2. height:auto!important;
  3. height:100px;
  4. min-height:100px;
  5. }


A quick fix for WordPress plugin My Category Order July 20, 2009

Posted by klyuen in : Web 網頁 , add a comment

There is a small problem after upgrade My Category Order WordPress plugin (http://geekyweekly.com/mycategoryorder) to latest version for WordPress 2.8 or 2.8.x. The category list will be showing “No category” after the upgrade.  To fix the issue, you have to go to page Posts > My Category Order in backend, then change the file permission of wp-includes/taxonomy.php to writable, say “666″ or “766″ or “777″ (as instructed in admin page).



Dynamically loading bitmaps with smoothing in Flash Player 8 March 11, 2009

Posted by eddie in : Computer 電腦,Flash , add a comment

Function

import flash.display.*;

function loadBitmapSmoothed(url:String, target:MovieClip) {
// Create a movie clip which will contain our unsmoothed bitmap
var bmc:MovieClip = target.createEmptyMovieClip(“bmc”,target.getNextHighestDepth());

// Create a listener which will notify us when the bitmap loaded successfully
var listener:Object = new Object();
// Track the target
listener.tmc = target;

// If the bitmap loaded successfully we redraw the movie into
// a BitmapData object and then attach that BitmapData to the target
// movie clip with the smoothing flag turned on.
listener.onLoadInit = function(mc:MovieClip) {
mc._visible = false;
var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true);
this.tmc.attachBitmap(bitmap, this.tmc.getNextHighestDepth(),”auto”, true);
bitmap.draw(mc);
};

// Do it, load the bitmap now
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url, bmc);
}

To use this snippet simple paste the function into your code and then load a bitmap this way f.ex.:
loadBitmapSmoothed(“flash.png”, mc1.mc);



模擬寶麗萊 February 20, 2009

Posted by klyuen in : Computer 電腦,Photography 攝影 , add a comment


有 個 本 來 只 有 Mac 友 先 下 載 到 的 免 費 軟 件 ,  而家 Win XP 或 以 上 的 用 家 都 有 機 會 玩 到 喇 ! 佢 叫 Poladroid Project , 係 個 好 好 玩 的 模 擬 寶 麗 萊 相 片 軟 件 , 至 今 已 有 84 萬 人 下 載 試 玩 過 。
使 用 時 會 有 一 大 部 寶 麗 萊 , 放 o係 你 部 電 腦 桌 面 , 想 將 普 通 一 張 數 碼 相 , 化 身 為 充 滿 懷 古 人 情 味 o既 寶 麗 萊 ? 只 要 將 相 片 檔 案 拉 落 機 身 Icon 上 , 佢 就 會 馬 上 彈 出 一 張 寶 麗 萊 ; 同 真 實 一 樣 , 影 像 會 慢 慢 顯 現 , 最 後 自 動 記 存 下 來 。 更 過 癮 係 浮 現 過 程 中 , 玩 家 仲 可 隨 時 Save 相 , 若 隱 若 現 、 邊 位 黑 角 , 咁 就 可 以 得 出 不 同 色 調 , 十 分 過 癮 。

http://www.poladroid.net/



Add startup and shutdown scripts in Windows January 30, 2009

Posted by klyuen in : Computer 電腦 , add a comment

There are some features of Microsoft Windows that can come very handy from time to time if you know how to use them. Startup and shutdown scripts feature is one of that.
Firstly, you should know what scripts are all about. A script is a set of commands that your system can run in order to automate tasks.

If you’d like to run 2 programs and 20 commands every day for example, you don’t have to do this by hand. Simply use batch files or Visual Basic scripting and they’re done by a click of the mouse.

*NOTE: Learn some scripting basics if you are a novice; scripts that are not corectly written can block the computer, the windows startup process or the windows shutdown process.

For example, here is how you can delete all files in a folder (let’s say c:\temporary\) with a script:

1. Create a file called script.bat (Right click – New -> Text document and open it with notepad; now click File – Save as and write it’s name and extension – .bat with the option Save as: All files)

2. Add the line bellow and save the file.

del /q c:\temporary\*

By running this batch file you will delete all files in that folder (/q forces delete without confirmation).

This is a very simple script; the posibilities are endless and you should learn to use visual basic scripting if you want to build some proffesional work.

Now if you want to integrate any kind of script to automatically run when Windows starts or shuts down (user logon/logoff), you must follow these steps:

  1. Click Start – Run and type mmc
    (note that you must be logged in with an administrator account for this)
  2. On the Management console that starts, click File -> Add/Remove Snap-in.
  3. On the window that opens, search for Group Policy Object editor on the left panel, click Add and in the properties window that pops out leave the settings that are selected (Local computer) and click ok. The result should be like in the picture bellowClick “OK”
  4. Navigate through the left panel by opening each branch like this: Console Root -> Computer configuration -> Windows Settings -> Scripts (Startup/shutdown) 
  5. Open the properties window for Startup or Shutdown as you desire from the right panel; on the window that pops out add, edit or remove scripts that you want.

This works on Windows 2000/2003/XP and Vista. Hope you found this useful.

(Quoted from tutorial5.com)



Adobe Photoshop CS4 November 13, 2008

Posted by klyuen in : Photography 攝影,Web 網頁 , add a comment



Display Html parm in Flash movie January 16, 2008

Posted by eddie in : Flash , add a comment

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14808&sliceId=2~



Unicode show in Flash

Posted by eddie in : Flash , add a comment

1.System.useCodepage = false;

2.XML convert to Unicode

3.Choose “use device fonts” in flash text box

more details show in the following link
http://www.adobe.com/support/flash/languages/unicode_in_flmx/unicode_in_flmx11.html



Flash Player 各版本的使用率 April 4, 2007

Posted by eddie in : Computer 電腦,Flash , add a comment

Macromedia Flash content reaches 97.6% of Internet viewers
http://www.macromedia.com/software/player_census/flashplayer/

Worldwide Ubiquity of Macromedia Flash by Version
http://www.macromedia.com/software/player_census/flashplayer/version_penetration.html



Understanding the changes in the display API in ActionScript 3.0

Posted by eddie in : Computer 電腦,Flash , add a comment

官網的一篇基礎教學:

http://www.adobe.com/devnet/actionscript/articles/display_api.html

針對 display 在 AS2 與 AS3 之間的改變。

要注意的重點在於:

1. 以前我們觀念中都是對 MovieClip 在作事情,現在要想像 所做的事情 都是發生在 記憶體 中,然後 必須 將做出來的東西 加到 某個 Container 中,才會顯示在 Stage 上。

2. 以前的 MovieClip,現在已經被重構其繼承架構,所以若是你要做的事情不是太複雜,不需要真的產生一個完整的 MC 的話,其實可以考慮建立其父類別的物件,譬如 Sprite。

3. 繪圖 API,也不再是直接透過 MovieClip 進行,而要透過 graphics 達到,這點,知道一下即可。

4. 事件處理程序,你必須越來越習慣 addEventListener,知道一下即可。



How to Fix IE 7 Flash bug January 25, 2007

Posted by eddie in : Computer 電腦,Flash,Web 網頁 , add a comment

Adobe’s Developer Center has tackled this issue:
http://www.adobe.com/devnet/activecontent/

http://blog.deconcept.com/flashobject/



Setup a remote connection to MySQL January 19, 2007

Posted by admin in : Computer 電腦,Linux , add a comment

To remotely connect to your MySQL databases, you must have an I.P.-based account. Login to your control panel and click on the side menu “ValueApps” then the “Database” tab. If you have not installed MySQL, click on “MySQL Database” under Available ValueApps. If you have already installed MySQL, click on “MySQLs” under Installed ValueApps. Check the box “TCP/IP Connection”. Now login to your account via SSH.

Use the MySQL monitor to grant privileges.

Start the MySQL monitor with this command:

mysql

or:
/usr/local/mysql/bin/mysql

Your shell prompt should now look like this:
mysql>

Run this command:

GRANT ALL PRIVILEGES ON *.* TO USERNAME@IP IDENTIFIED BY “PASSWORD”;

USERNAME is the username that you would like to create.
IP is the public IP address of your remote connection. See examples
PASSWORD is the password you would like to use for this username.
You now must flush MySQL’s privileges. Run this command:

FLUSH PRIVILEGES;

Run this command to exit MySQL:

exit;
 



ActionScript 3 QuickTip #2: The Timer Class December 19, 2006

Posted by eddie in : Computer 電腦,Flash , add a comment

In previous version of ActionScript there were a couple of different ways to trigger events based on time. The setInterval() and setTimeout() functions were the two most commonly used ways of calling a function after a specified amount of time had lapsed. In ActionScript 3 we now have the Timer class which lives in the flash.utils package. This class contains all the functionality that you will ever need for time-based applications. In order to use the class, you first must import the flash.utils package as seen is the example below. The Timer constructor expects one argument that represents the desired delay in milliseconds between function calls. An optional seconds argument determines the number of times to call the function. The default for this value is 0, which means that it will call the function indefinitely. If you wanted to replicate the functionality of the deprecated setTimeout() function, you can simply pass 1 as the value for this parameter.

In my example below I am creating a Timer that will fire twice a second, but I haven’t yet told it what function to call every time the delay has passed. To do this we need to respond to the timer event of the Timer class and give it the name of the function that will handle the event. At this point our Timer will be setup for use but we still need to call the Timer.start() method in order to get things started. In my implementation below I am simply doing a trace() to the output window every time the Timer fires showing how many times it has fired. To get this value I am reading the Timer.currentCount property.

Actionscript:   

  1. // We need to import the utils package
  2. import flash.utils.*;
  3. // Create a new Timer object with a delay of 500 ms
  4. var myTimer:Timer = new Timer(500);
  5. myTimer.addEventListener(“timer”, timedFunction);
  6. // Start the timer
  7. myTimer.start();
  8. // Function will be called every 500 milliseconds
  9. function timedFunction(eventArgs:TimerEvent)
  10. {
  11.         trace(“Timer fired ” + myTimer.currentCount + ” times.”);
  12. }

Check out the AS 3 docs to see all of the available properties and methods of this great new class.



ActionScript 3 QuickTip #1: Dynamic Frame Rates December 14, 2006

Posted by eddie in : Computer 電腦,Flash , add a comment

ActionScript 3 QuickTip #1: Dynamic Frame Rates

This is a *very* cool new feature in ActionScript 3. We now have the ability to dynamically change the SWF frame rate at runtime using ActionScript. In the example below I have a somewhat creepy clown who is animating from side-to-side on the screen. You can use the slider to change the frame rate from 0 to 800 and something. There are a lot of applications for this such as lowering the frame rate for slower machines dynamically. The AS 3 code from the example is posted below:

  1. this.stage.frameRate = 0;
  2. rate.text = “0 fps”;
  3. thumb.addEventListener(MouseEvent.MOUSE_DOWN, starter);
  4. thumb.addEventListener(MouseEvent.MOUSE_UP, stopper);
  5. thumb.addEventListener(MouseEvent.MOUSE_OUT, stopper);
  6. thumb.addEventListener(MouseEvent.MOUSE_MOVE, mover);
  7. function starter(args:Event)
  8. {
  9.         thumb.startDrag(false, new Rectangle(track.x, thumb.y, track.width, 0));
  10. }
  11. function stopper(args:Event)
  12. {
  13.         thumb.stopDrag();
  14. }
  15. function mover(args:Event)
  16. {
  17.         var dist:Number = (thumb.x – track.x) / (track.width + track.x);
  18.         this.stage.frameRate = Math.round(dist*1000);
  19.         rate.text = Math.round(dist*1000).toString() + ” fps”;
  20. }