flash on 2011-9-28
/**
* Copyright cmiscm1 ( http://wonderfl.net/user/cmiscm1 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/6OeK
*/
// forked from HaraMakoto's ローディングを使う
// forked from HaraMakoto's forked from: flash on 2009-11-17
// forked from HaraMakoto's flash on 2009-11-17
package {
import flash.display.Sprite;
import flash.display.Loader;
import net.wonderfl.utils.WonderflSWFUrl;
import flash.net.URLRequest;
import flash.events.Event;
import flash.system.Security;
import flash.events.MouseEvent;
import jp.progression.commands.Func;
import jp.progression.commands.lists.SerialList;
[SWF(backgroundColor="0x000000", width="465", height="465", frameRate="60")]
public class FlashTest extends Sprite {
private var loader:Loader = new Loader();
private var loadView:Object;
public function FlashTest() {
Security.loadPolicyFile("http://swimmingbird.heteml.jp/crossdomain.xml");
addChild(loader);
loadLoadingView(photoLoadStart);
}
private function photoLoadStart():void {
loadView.loadStart();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, photoCompleteHandler);
loader.load(new URLRequest("http://controll.net/gorget/Lightbox%202_elemei/image-2.jpg"));
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
private function enterFrameHandler(event:Event):void {
loadView.attachLoadValue(loader.contentLoaderInfo.bytesLoaded / loader.contentLoaderInfo.bytesTotal);
}
private function photoCompleteHandler(event:Event):void {
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
loadView.loadComplete();
}
//--------------------------------------------------------------------------------//
// ローディング表示呼び出し
//--------------------------------------------------------------------------------//
private function loadLoadingView(_f:Function):void {
var CODE_PAGE:String = "http://wonderfl.net/code/fec7bdea47c77f160e52cd2c448bb49bb209ea92";
var path:String = WonderflSWFUrl.getURLFromPageURL(CODE_PAGE);
var ldr:Loader = new Loader();
addChild(ldr);
var s:SerialList = new SerialList();
s.addCommand(
new Func(ldr.load, [new URLRequest(path) ],ldr.contentLoaderInfo, Event.COMPLETE),
function():void{loadView = ldr.contentLoaderInfo.content; },
new Func(_f)
);
s.execute();
}
}
}