on beginsprite ( me ) if the runmode = "author" then clearcache () script ( "preloader" ). new (myurl, me , # mhandlepreloadcompletion, # mshowprogess) end
on exitframe ( me ) go to the frame end
-- 來自接口對象(例如進度條)的消息 on mregisterwidget ( me , obj, id) if id = # progressbar then myprogressbarobj = obj end
-- 來自“preloader”對象的消息 on mhandlepreloadcompletion ( me , errormsg) if errormsg <> empty then alert "network error!" & return & errormsg else alert "all done" end
on mshowprogess ( me , statuslist) if myprogressbarobj. ilk = # instance then if statuslist. state = "inprogress" then myprogressbarobj.mshowprogress(statuslist.fractiondone) else myprogressbarobj.mshowworking() end if end
-- 構造行為 on getpropertydescriptionlist ( me ) pdlist = [:] pdlist[ # myurl] = [ # comment: "url" , # format: #string , # default: "http://www.lingoworkshop.com/tutorials/preloader/main.dcr" ] return pdlist end