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

LoaderInfoなど

////////////////////////////////////////////////////////////////////////////////
// LoaderInfoなど
//
// [AS3.0] LoaderInfoクラスだ!
// http://www.project-nya.jp/modules/weblog/details.php?blog_id=1196
////////////////////////////////////////////////////////////////////////////////
Get Adobe Flash player
by ProjectNya 30 Jul 2011
    Embed
/**
 * Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/7rIb
 */

////////////////////////////////////////////////////////////////////////////////
// LoaderInfoなど
//
// [AS3.0] LoaderInfoクラスだ!
// http://www.project-nya.jp/modules/weblog/details.php?blog_id=1196
////////////////////////////////////////////////////////////////////////////////

package {

    import flash.display.Sprite;
    import flash.net.LocalConnection;
    import flash.external.ExternalInterface;

    [SWF(backgroundColor="#000000", width="465", height="465", frameRate="30")]

    public class Main extends Sprite {
        private var labels:Array;

        public function Main() {
            //Wonderfl.capture_delay(4);
            init();
        }

        private function init():void {
            graphics.beginFill(0x000000);
            graphics.drawRect(0, 0, 465, 465);
            graphics.endFill();
            //
            var _labels:Array = new Array();
            _labels.push("loaderInfo.url");
            _labels.push("LocalConnection.domain");
            _labels.push("loaderInfo.parameters.flashvars");
            _labels.push("loaderInfo.parameters.getquery");
            _labels.push("window.location.href");
            _labels.push("window.location.search");
            labels = new Array();
            for (var n:uint = 0; n < 6; n++) {
                var _label:Label = new Label(300, 16, 12, Label.LEFT);
                addChild(_label);
                _label.x = 32;
                _label.y = 64 + 60*n;
                _label.textColor = 0x999999;
                _label.text = _labels[n];
                var label:Label = new Label(300, 16, 10, Label.LEFT);
                addChild(label);
                label.x = 32;
                label.y = 84 + 60*n;
                label.textColor = 0xFFFFFF;
                labels.push(label);
            }
            //SWFファイルのURLを取得する
            var url:String = loaderInfo.url;
            if (!url) url = "null";
            labels[0].text = url;
            //ドメインを取得する
            var domain:String = new LocalConnection( ).domain;
            if (!domain) domain = "null";
            labels[1].text = domain;
            //FlashVarsを取得する
            var flashvars:String = loaderInfo.parameters.flashvars;
            if (!flashvars) flashvars = "null";
            labels[2].text = flashvars;
            //GETクエリを取得する
            var getquery:String = loaderInfo.parameters.getquery;
            if (!getquery) getquery = "null";
            labels[3].text = getquery;
            //SWFファイルが配置されたURLを取得する
            var href:String = ExternalInterface.call("function() { return window.location.href; }");
            if (!href) href = "null";
            labels[4].text = href;
            //URLクエリを取得する
            var search:String = ExternalInterface.call("function() { return window.location.search; }");
            if (!search) search = "null";
            labels[5].text = search;
        }

    }

}


//////////////////////////////////////////////////
// Labelクラス
//////////////////////////////////////////////////

import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFieldAutoSize;
import flash.text.AntiAliasType;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;

class Label extends Sprite {
    private var txt:TextField;
    private static var fontType:String = "_ゴシック";
    private var _width:uint = 20;
    private var _height:uint = 20;
    private var size:uint = 12;
    public static const LEFT:String = TextFormatAlign.LEFT;
    public static const CENTER:String = TextFormatAlign.CENTER;
    public static const RIGHT:String = TextFormatAlign.RIGHT;

    public function Label(w:uint, h:uint, s:uint = 12, align:String = LEFT) {
        _width = w;
        _height = h;
        size = s;
        draw(align);
    }

    private function draw(align:String):void {
        txt = new TextField();
        addChild(txt);
        txt.width = _width;
        txt.height = _height;
        txt.autoSize = align;
        txt.type = TextFieldType.DYNAMIC;
        txt.selectable = false;
        //txt.embedFonts = true;
        //txt.antiAliasType = AntiAliasType.ADVANCED;
        var tf:TextFormat = new TextFormat();
        tf.font = fontType;
        tf.size = size;
        tf.align = align;
        txt.defaultTextFormat = tf;
        textColor = 0x000000;
    }
    public function set text(param:String):void {
        txt.text = param;
    }
    public function set textColor(param:uint):void {
        txt.textColor = param;
    }

}