Wonderfl で Diff1 を防ぐ簡単な方法
stage3D を使うだけ
/**
* Copyright bkzen ( http://wonderfl.net/user/bkzen )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/bLq5
*/
package
{
import flash.display.Sprite;
import flash.events.Event;
/**
* Wonderfl で Diff1 を防ぐ簡単な方法
* @author jc at bk-zen.com
*/
public class Test87 extends Sprite
{
public function Test87()
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e: Event = null): void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
//
stage.stage3Ds[0].addEventListener(Event.CONTEXT3D_CREATE, _init);
stage.stage3Ds[0].requestContext3D();
}
private function _init(e:Event):void
{
if (!stage.stage3Ds[0].context3D)
return;
// ここから書き始める。
graphics.beginFill(0x006699);
graphics.drawRect(0, 0, 100, 100);
}
}
}