顯示具有 amfphp 標籤的文章。 顯示所有文章
顯示具有 amfphp 標籤的文章。 顯示所有文章

2010年2月15日 星期一

AMFPHP教學


最愛這樣有線上Demo的,但source就只有fla檔,其餘的php檔可於網頁上copy & paste。
有兩個版本,第1版是PHP,第2版才是AMFPHP,在還沒成功用到AMFPHP找到好感動!
一直用這個作為範本,正打算和另一個合併時才發現,這是AS2.0,並不是AS3.0!哭!

執行前需要到發佈設定修改路徑,否則會有以下的錯誤:
"建立SWF影片檔案時發生錯誤。
目標目錄不存在。請更改您的發佈設定。"

簡單又實用,無source檔,但說明清晰。
重要的是有ArrayCollectionDP.as提供,能把AS3 ArrayCollection轉成dataprovider

Create an image gallery with AMFPHP
source檔死link,看上去很不錯,但又很複雜。
有thumbnails作法,但Flash方面好像很複雜…


2010年2月14日 星期日

Error #2044: 未處理的 NetStatusEvent:。 level=error, code=NetConnection.Call.BadVersion

我快被這個Error搞瘋了!
code=NetConnection.Call.BadVersion 只想run tutorial裡的東西都做不到!


收集解決方法中…!未解決,我的問題還是未解決呀!


解決了!解決了!高興的想歡呼!!


答案是
因編碼出現的問題,這裡4樓
這裡也有個解答。
我之前好像試過卻沒不知為甚麼沒成功…
或許妀錯編碼或是改到php.ini去了吧!
但現在沒事了,耶耶耶!解決方法只是修改1行而已,無奈啊!

要把amfphp中的gateway.php文件第127行代碼改為相關編碼,如:
$gateway->setCharsetHandler( "mbstring","UTF-8", "UTF-8" );



其他解答:


這裡第20&21樓的人說:


If you get the NetConnection.Call.BadVersion answer, the following could be wrong

1) The AMFPHP install is not correct and the gateway cannot find the libraries
check this by pointing your browser at your gateway url
for example: http://localhost/amfphp/gateway.php
If any PHP errors appear, the gateway is not correctly installed. Follow the PHP errors

2) Your service has "Parse" errors. Check your service to be sure that it has correct syntax

3) "extra data" is being send... Check that your PHP code does not contain any characters (spaces, empty lines) before AND after the code in your Service.
This may result in sending this characters to the client, before the actual AMF packet is sent.

4) Make sure that your PHP code starts with "?php" instead of "〈?" . If your server is configured not to use php_short_open tags, the "?" will fail and give and will not be accepted as PHP open statement.


5) We also put the full path to the flashservices include files in gateway.php.
The include_path on our server is "", or null, so we _must_ put the full path to included or required files.


註:amfphp 1.9不能用php5.3版本,只能用以下的版本。否則在gateway.php就會有Error!
我是用AppServ 2.6.0,php版本剛好是5.3或以上,只好裝回AppServ 2.5.10,雖然gateway.php有給正常回應給我,但在Flash還是會有#2044的問題,氣死我了!


另外,為甚麼這裡的"<"&"?" 不能共存…!?
害我修改了N篇,還丟了部分資料…
不停發現有小錯誤也改了N篇,還好沒有RSS訂閱的人,不然應該收到十多個更新通知…= ="