国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 網(wǎng)站 > 媒體動(dòng)畫(huà) > 正文

Director基礎(chǔ)教程:Shockwave 預(yù)載技術(shù)(2)

2024-09-08 19:27:09
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
shockwave 預(yù)載技術(shù)
   原著:lingoworkshop
   翻譯:alphachi

   為了讓程序擁有更強(qiáng)的適應(yīng)性,我們還可以添加一個(gè)netdone()命令用來(lái)檢測(cè)網(wǎng)絡(luò)錯(cuò)誤。“preloader”劇本的下一個(gè)版本能夠檢測(cè)任何網(wǎng)絡(luò)錯(cuò)誤。一旦發(fā)生錯(cuò)誤,則使用一個(gè)參數(shù)返回錯(cuò)誤的描述信息;如果沒(méi)有錯(cuò)誤,那么此參數(shù)的取值為一個(gè)空字符串。

"preloader" parent script (v.3)

property mynetid, mycallbackobj, mycompletionmsg

on new ( me , netaddress, callbackobj, completionmsg)
   mycallbackobj = callbackobj
   mycompletionmsg = completionmsg
   mynetid = preloadnetthing (netaddress)
   atimerobj = timeout ( me . string ). new ( 100 , # timer_checkprogress, me )
end

on timer_checkprogress ( me , atimer)
   finished = netdone (mynetid)
if finished then
     errornotification = ""
     errornum = neterror (mynetid)
if integerp (errornum) then
if errornum then
         errornotification = me ._geterror(errornum)
end if
end if
     atimer. forget ()
call (mycompletionmsg, mycallbackobj, errornotification)
else
put "still downloading"
end if
end

on _geterror ( me , errorcode)
case errorcode of
"ok" , "" , 0: return empty
     4: errormsg =( "bad moa class. the required xtras are missing. " )
     5: errormsg =( "the required xtras are improperly installed or not installed at all." )
     6: errormsg =( "bad url or the required xtras are improperly installed. " )
     20: errormsg =( "internal error. the browser detected a network or internal error." )
     4146: errormsg =( "connection could not be established with the remote host." )
     4149: errormsg =( "data supplied by the server was in an unexpected format." )
     4150: errormsg =( "unexpected early closing of connection." )
     4154: errormsg =( "operation could not be completed due to timeout." )
     4155: errormsg =( "not enough memory available to complete the transaction." )
     4156: errormsg =( "protocol reply to request indicates an error in the reply." )
     4157: errormsg =( "transaction failed to be authenticated." )
     4159: errormsg =( "invalid url." )
     4164: errormsg =( "could not create a socket." )
     4165: errormsg =( "requested object could not be found (url may be incorrect)." )
     4166: errormsg =( "generic proxy failure." )
     4167: errormsg =( "transfer was intentionally interrupted by client." )
     4242: errormsg =( "download stopped by netabort(url)." )
     4836: errormsg =( "download stopped for an unknown reason, possibly a network error, or the download was abandoned." )
otherwise
       errormsg =( "unknown error code" )
end case
return errormsg
end


   要想看到具體返回了什么參數(shù),可以像下面這樣修改“preloaderinterface”行為:

on beginsprite me
clearcache ()
   urltoload = "http://www.lingoworkshop.com/tutorials/preloader/main.dcr"
script ( "preloader" ). new (urltoload, me , # mhandlepreloadcompletion)
end

on mhandlepreloadcompletion ( me , errormsg)
if errormsg <> empty then alert "network error!" & return & errormsg
else alert "all done"
end

   現(xiàn)在,”preloader”劇本已經(jīng)有能力預(yù)載一個(gè)url并在預(yù)載完成時(shí)對(duì)另一個(gè)對(duì)象進(jìn)行返回調(diào)用。最后一步則是讓“preloader”劇本可以報(bào)告其運(yùn)行狀態(tài),以便我們制作一個(gè)進(jìn)度條來(lái)給用戶提供一些反饋信息。為了達(dá)到這一目的,我們可以使用getstreamstatus(mynetid)函數(shù)獲取網(wǎng)絡(luò)操作的當(dāng)前狀態(tài)。這個(gè)函數(shù)會(huì)返回一個(gè)屬性列表,其中包含像#state(可能是“connecting”或“in progress”)、字節(jié)總數(shù)和當(dāng)前已傳遞字節(jié)數(shù)這樣的信息。在“preloader”劇本的最終版本中,這些信息被用來(lái)確定url已被下載的部分。此版本附加了一個(gè)起始參數(shù)“statusmsg”——返回調(diào)用目標(biāo)用于顯示當(dāng)前網(wǎng)絡(luò)狀況的程序名稱(chēng)。

"preloader" parent script (v.4)

[1] [2] 下一頁(yè)  

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 敦煌市| 兴化市| 乌审旗| 濉溪县| 阿鲁科尔沁旗| 黎城县| 轮台县| 类乌齐县| 绥芬河市| 宣武区| 邛崃市| 秦皇岛市| 福海县| 怀远县| 英山县| 金川县| 清原| 山丹县| 定南县| 桂东县| 双鸭山市| 盘山县| 无极县| 商城县| 永春县| 通州区| 牙克石市| 塔河县| 吉水县| 古田县| 秦皇岛市| 印江| 十堰市| 县级市| 漳州市| 兴城市| 工布江达县| 山东| 资中县| 鄂托克旗| 尼木县|