How do I access cookies within Flash?

前端 未结 7 938
醉酒成梦
醉酒成梦 2020-12-14 04:40

I\'m looking to grab cookie values for the same domain within a Flash movie. Is this possible?

Let\'s see I let a user set a variable foo and I store it using any w

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-14 04:50

    I'm 10 years too late. If you can embed the data you need in the page, it's 10 times easier to grab.

    import flash.net.*
    
    var _loader:URLLoader = new URLLoader();
    var _req:URLRequest = new URLRequest('https://stackoverflow.com');
    _loader.addEventListener(Event.COMPLETE, _onComplete);
    _loader.load(_req);
    
    function _onComplete(e:Event):void{
        var wantedData:RegExp = /
    (.*?)
    /ig; var result:Object = wantedData.exec(String(_loader.data)); trace(result[0].split('
    ').join('') .split('
    ').join('')); }

提交回复
热议问题