forked from: WonderflSWFUrl Test

by bradsedito forked from WonderflSWFUrl Test (diff: 1)
♥0 | Line 15 | Modified 2010-11-08 15:45:56 | MIT License | (replaced)
play

ActionScript3 source code

/**
 * Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xu9w
 */

// forked from 9re's WonderflSWFUrl Test
package {
    import flash.display.Loader;
    import flash.display.Sprite;
    import flash.net.URLRequest;
    import net.wonderfl.utils.WonderflSWFUrl;
    // WonderflSWFUrl is a utility class that constructs
    // swf path from code page url
    // 
    // this example gets swf path from the url
    // http://wonderfl.net/code/ecefc2d92cc7b9ba0caab3e13ef5dc05b9bf02d7
    // dynamically loads and adds to the display at runtime
    public class FlashTest extends Sprite {
        private const CODE_PAGE:String = "http://wonderfl.net/code/ecefc2d92cc7b9ba0caab3e13ef5dc05b9bf02d7";
        public function FlashTest() {
            var ldr:Loader = new Loader;
            // the usage is very simple
            var path:String = WonderflSWFUrl.getURLFromPageURL(CODE_PAGE);
            ldr.load(new URLRequest(path));
            addChild(ldr);
        }
    }
}