|
MX2004 - MovieClipLoader
7
24
959 bytes
1550 bytes
2005-10-12 00:00:00
2005-10-12 12:56:14
Oldes (oliva.david@seznam.cz)

How to load image/movie using MovieClipLoader class
|
|
background 255.255.255
include %includes/txt_info2.rswf
es: EmptySprite
image_mc: place es
doAction [
tf_info._height: 320
tf_info.textColor: #00FF99
mclListener: make object! []
mclListener.onLoadInit: func[target_mc][
cmsg((reform [target_mc "LoadInit"]))
var w: target_mc._width
var h: target_mc._height
;center movie
target_mc._x: Math.round(((Stage.width / 2) - (w / 2)))
target_mc._y: Math.round(((Stage.height / 2) - (h / 2)))
;draw image frame
target_mc.lineStyle(5 #000000)
target_mc.moveTo(0 0)
target_mc.lineTo(w 0)
target_mc.lineTo(w h)
target_mc.lineTo(0 h)
target_mc.lineTo(0 0)
]
mclListener.onLoadError: func[target_mc errorCode httpStatus][
cmsg((reform [target_mc "LoadError:" errorCode httpStatus]))
]
mclListener.onLoadComplete: func[target_mc httpStatus][
cmsg((reform [target_mc "LoadComplete:" httpStatus]))
]
mclListener.onLoadProgress: func[target_mc loadedBytes totalBytes][
cmsg((reform [target_mc "LoadProgress:" loadedBytes totalBytes]))
]
mclListener.onLoadStart: func[target_mc][
cmsg((reform [target_mc "LoadStart"]))
]
var image_mcl: make MovieClipLoader []
image_mcl.addListener(mclListener)
image_mcl.loadClip("images/noparking.jpg" image_mc)
]
showFrame
end
|