getMCRef().unloadMovie()
OL 4.9に相当するものを知りたい
getDisplayObject()
表示オブジェクトがこれにgetDisplayObject.unload()
似ていることを知っていgetMCRef().unloadMovie()
ますか?
getMCRef().unloadMovie()
OL 4.9に相当するものを知りたい
getDisplayObject()
表示オブジェクトがこれにgetDisplayObject.unload()
似ていることを知っていgetMCRef().unloadMovie()
ますか?
OpenLaszloビュークラスにはunload()関数があります。
view.unload(); setSourceまたはsource=属性でロードされたメディアをアンロードします。
<canvas>
<view id="redBox" width="150" height="150">
<method name="loadSWF">
this.setSource('logo.swf');
</method>
<method name="unloadSWF">
this.unload();
</method>
</view>
<button x="200" text="Load SWF" onclick="redBox.loadSWF()"/>
<button x="200" y="40" text="Unload SWF" onclick="redBox.unloadSWF()"/>
</canvas>
リソースのロード方法に関心がある場合は、LzSprite.asSWF9カーネルファイルのsetSource関数を確認してください。
/** setSource( String:url )
o Loads and displays media from the specified url
o Uses the resourceload callback method when the resource finishes loading
*/
public function setSource (url:String, cache:String = null, headers:String = null, filetype:String = null) :void {
if (url == null || url == 'null') {
return;
}
var loadurl:String = getLoadURL(url, cache, headers);
if (getFileType(url, filetype) == "mp3") {
// unload previous image-resource and sound-resource
this.unload();
this.__isinternalresource = false;
this.resource = url;
this.loadSound(loadurl);
} else {
if (this.isaudio) {
// unload previous sound-resource
this.unloadSound();
}
if (! imgLoader) {
if (this.resourceContainer) {
// unload previous internal image-resource
this.unload();
}
imgLoader = new Loader();
imgLoader.mouseEnabled = false;// @devnote: see LPP-7022
imgLoader.mouseChildren = false;
this.resourceContainer = imgLoader;
this.addChildAt(imgLoader, IMGDEPTH);
this.attachLoaderEvents(imgLoader.contentLoaderInfo);
} else {
//TODO [20080911 anba] cancel current load?
// imgLoader.close();
}
this.__isinternalresource = false;
this.resource = url;
var res:Loader = this.imgLoader;
if (res) {
res.scaleX = res.scaleY = 1.0;
}
imgLoader.load(new URLRequest(loadurl), LzSprite.loaderContext);
}
}
setSource()内に、flash.display.Loaderクラスのインスタンスが作成されます。imgLoader= new Loader();
必要に応じてOpenLaszloの機能を拡張できるため、LFCで内部的に使用されているActionScriptクラスを知っておくとよい場合があります。