看板 Flash 關於我們 聯絡資訊
最近想製作一個Flash讀取xml檔來形成一個滑動的縮圖選單 縮圖是利用讀取xml來完成 但是我想在縮圖上加入超連結時,卻怎麼也試不出來 能請各位版上高手幫幫忙嗎^^ XML檔如下: <?xml version="1.0"?> <select name="photos"> <option photo="01" url="http://tw.yahoo.com"/> <option photo="02" url="http://tw.yahoo.com" /> <option photo="03" url="http://tw.yahoo.com" /> </select> 部分Flash AS如下: scroller._alpha = 0; thumbsLoaded = 0; totalThumbs = 0; menuActive = 0; this.importXML = new XML(); this.importXML.ignoreWhite = true; this.importXML.onLoad = function(success) { if (success) { projectsA = new Array(); for (var i = this.childNodes[0].firstChild; i != null; i=i.nextSibling) { projectsA[projectsA.length] = [i.attributes.photo]; } totalThumbs = projectsA.length; buildProjects(); } else { trace("ERROR loading xml"); } }; this.importXML.load("gallery.xml"); 形成一個動態選單 elementspacer = -10; xp = 0; baseAlpha = 30; function buildProjects() { for (var i = 0; i<projectsA.length; i++) { scroller.attachMovie("element", "e"+i, i); e = scroller["e"+i]; e.menuNum = i; e.image = projectsA[i][0]; e.pos = xp; e.pressed = 0; e._x = xp; xp += Math.floor(e._width)+elementspacer; e.hitSize.onRollOver = function() { _root.playOverSound(); this._parent.gotoAndPlay("in"); moveOut(this._parent.menuNum); }; // 這裡就是我一直下語法錯誤的地方了....請問這邊該怎麼下 才能讀取到xml檔裡的網址,而形成超連結呢?? e.hitSize.onPress = function() { if (this._parent.pressed == 0) { _root.photo = 1; this._parent.gotoAndPlay("out"); _root.moveIn(this._parent.menuNum); this._parent.pressed = 1; } }; } } stop(); 先謝謝各位了^^ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.166.99.135
scars:為什麼你的 URL 沒有雙引號 01/10 00:00
※ 編輯: ccfun 來自: 218.166.99.135 (01/10 00:04)
ccfun:抱歉,因為我擷取部分檔, 在自己編輯的....><" 01/10 00:04
ccfun:可以請問一下,這樣的as語法該怎麼抓取xml的網址呢?? 01/10 00:05
scars:就跟你讀 attributes.photo 一樣啊? 01/10 00:20