In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

DBcount gae PyAMF

local: http://www.macromedia.com/support/documentation/jp/flashplayer/help/settings_manager04a.html
wonderfl: crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="swf.wonderfl.net" />
</cross-domain-policy>
Get Adobe Flash player
by ile 01 Nov 2011
/**
 * Copyright ile ( http://wonderfl.net/user/ile )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/y5il
 */

// forked from ile's swf as button
// forked from ile's Loader Security.allowDomain ONLY
package {
    import flash.display.Sprite;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.system.Security;
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    
    public class Main extends Sprite {
        private var button:Loader;
        public var loaddbAS:loadDB= new loadDB();
        private static var buttonPath:String = "http://ile.jp/wp-content/uploads/2011/10/buttonile.swf";

        Security.allowDomain("*");
        
        public function Main() {
            addChild(loaddbAS);
            setButton();
        }
        private function setButton():void{
            button = new Loader();
            button.load(new URLRequest(buttonPath));
            addChild(button);
            button.addEventListener(MouseEvent.MOUSE_UP,mouseUp);

        }
        private function mouseUp(e:MouseEvent):void{
            button.x+=10;
            var a:testPyAMF = new testPyAMF();
            addChild(a);
        }
    }
}

import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.net.NetConnection;
import flash.net.Responder;

import flash.text.TextFormat;

class testPyAMF extends Sprite {

    private var netConnection:NetConnection;
    private var responder:Responder;
    private var outputNum:Number;
    public var output:TextField;

    public function testPyAMF() {
        
        netConnection = new NetConnection();
        netConnection.connect("http://mixi20000.appspot.com/gateway/");

        responder=new Responder(onComplete,onFail);
        // Python側の DBcount を呼び出す。
        netConnection.call("myservice.DBcount", responder);
    }

    //サーバーの呼び出しが成功して結果が返された場合に呼び出される
    private function onComplete(results:Number):void {
        loadDB.output.htmlText = String(Number(loadDB.output.text) + 1);
    }

    //サーバーがエラーを返したときに呼び出される
    private function onFail(results:*):void {
        for each (var thisResult:String in results) {
            output.appendText(thisResult);
        }
    }

}

class loadDB extends Sprite {

    private var netConnection:NetConnection;
    private var responder:Responder;
    static public var output:TextField;

    public function loadDB() {

        output = new TextField();
        output.autoSize = TextFieldAutoSize.LEFT;
        output.x = 43;
        output.y = 65;
        var tf:TextFormat = new TextFormat();
        tf.size = 32;
        tf.color = 0xFF0000;
        addChild(output);
        output.defaultTextFormat = tf;

        netConnection = new NetConnection();
        netConnection.connect("http://mixi20000.appspot.com/gateway/");

        responder=new Responder(onComplete,onFail);
        // Python側の DBcount を呼び出す。
        netConnection.call("myservice.DBload", responder);
    }

    //サーバーの呼び出しが成功して結果が返された場合に呼び出される
    private function onComplete(results:Number):void {
        output.htmlText=String(results);
    }

    //サーバーがエラーを返したときに呼び出される
    private function onFail(results:*):void {
        for each (var thisResult:String in results) {
            output.appendText(thisResult);
        }
    }

}