Re: [問題] xmlns:aaa="Main"

看板Flash作者 (紅虫)時間13年前 (2010/08/27 16:48), 編輯推噓0(005)
留言5則, 2人參與, 最新討論串4/4 (看更多)
謝謝邦邦大大.. 加了<td/>之後的確就不會再跑出namespace了.. 另外我試著把下面幾行 catalog.body.shopNS::table.table.tr.td = "Item"; catalog.body.shopNS::table.table.tr.td += <td/>; catalog.body.shopNS::table.table.tr.td[1] = "Price"; catalog.body.shopNS::table.table.tr.td += <td/>; catalog.body.shopNS::table.table.tr.td[2] = "Price2"; 改成 catalog.body.shopNS::table.table.tr.appendChild(<td></td>); catalog.body.shopNS::table.table.tr.td = "Item"; catalog.body.shopNS::table.table.tr.appendChild(<td></td>); catalog.body.shopNS::table.table.tr.td[1] = "Price"; catalog.body.shopNS::table.table.tr.appendChild(<td></td>); catalog.body.shopNS::table.table.tr.td[2] = "Price2"; 結果也不會出現namespace... 所以Essential ActionScript 3.0 上 原本的example codes 在你的flex builder上執行也是有問題的囉? 請問邦邦大大知道原因嗎? 謝謝. ※ 引述《ben0209 (邦邦)》之銘言: : 使用 FB 3 搭配 SDK 3 : package { : import flash.display.Sprite; : public class TestXmlNameSpace extends Sprite : { : public function TestXmlNameSpace() : { : var htmlNS:Namespace = new Namespace("html", : "http://www.w3.org/1999/xhtml"); : var shopNS:Namespace = new Namespace("shop", : "http://example.com/furniture"); : default xml namespace = htmlNS; : var catalog:XML = <html/>; : catalog.addNamespace(shopNS); : catalog.head.title = "Catalog"; : catalog.body.shopNS::table = ""; : catalog.body.shopNS::table.@shopNS::id = "4875"; : catalog.body.shopNS::table.table = ""; : catalog.body.shopNS::table.table.@border = "1"; : catalog.body.shopNS::table.table.tr.td = "Item"; : catalog.body.shopNS::table.table.tr.td += <td/>; : catalog.body.shopNS::table.table.tr.td[1] = "Price"; : catalog.body.shopNS::table.table.tr.td += <td/>; : catalog.body.shopNS::table.table.tr.td[2] = "Price2"; : trace(catalog.toXMLString()); : } : } : } : 輸出結果: : <html xmlns:shop="http://example.com/furniture" : xmlns="" rel="nofollow">http://www.w3.org/1999/xhtml"> : <head> : <title>Catalog</title> : </head> : <body> : <shop:table shop:id="4875"> : <table border="1"> : <tr> : <td>Item</td> : <td>Price</td> : <td>Price2</td> : </tr> : </table> : </shop:table> : </body> : </html> : [SWF] D:\works_test\TestXmlNameSpace\bin-debug\TestXmlNameSpace.swf - 1,878 : bytes after decompression -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 60.251.117.162

08/30 11:03, , 1F
我在看 EAS3 時,沒有全部實作過,不過對於這個問題,
08/30 11:03, 1F

08/30 11:05, , 2F
直接使用 E4X 的語法,你要小心處理 XML 與 XMLList`,
08/30 11:05, 2F

08/30 11:06, , 3F
增加 <td> 的用意,就是讓他成為 XMLList,這樣寫 [1] 才
08/30 11:06, 3F

08/30 11:06, , 4F
有意義
08/30 11:06, 4F

08/30 11:15, , 5F
感謝~~
08/30 11:15, 5F
文章代碼(AID): #1CTtlL8i (Flash)
討論串 (同標題文章)
文章代碼(AID): #1CTtlL8i (Flash)