Etc/동영상

얼사마 2009. 3. 17. 16:23

 
 
 

Etc/동영상

얼사마 2009. 3. 17. 16:12

 
 
 

Flash/Action Script

얼사마 2007. 6. 12. 15:20

* JavaScript Source

 

  * cgi에 넘기고 싶은 파라미터 셋팅
  
  - Object 생성 후
    parameter name은 object의 property로
    parameter value는 해당 property의 value로
    ex) obj.id = 'uidev';
   
  - parameter 셋팅을 마친후 용도에 따라 sendGet, sendPost를 사용한다.
    ex) flashObject.sendPost(obj,postURL,'_self');
   
  - [flashObject].sendPost( [parameter object] , [cgi url] , ['_self','_blank','_parent','_top' / default value : '_self'] );
  
  - sendGet은 sendPost와 동일. request method만 다름. 

 

[ Sample code ]

function sendPost(){
   var obj = new Object();
   obj.id = 'uidev';
   obj.pw = 'aaaa';
   obj.url = 'http://blog.daum.net/';
   var postURL = 'http://login.daum.net/Mail-bin/login.cgi';
   thisMovie('flash').sendPost(obj,postURL,'_blank');
}

* ActionScript Source
// script by Daum UI개발팀 - 박한얼(volzh@daumcorp.com, hzlov@hanmail.net)
package {
    import flash.display.Sprite;
    import flash.net.URLRequest;
    import flash.net.URLRequestMethod;
    import flash.net.URLVariables;
    import flash.net.navigateToURL;
    import flash.external.ExternalInterface;
    public class HTTP_POST extends Sprite
    {
        private var u:URLRequest = new URLRequest();
        public function HTTP_POST()
        {
            ExternalInterface.addCallback('sendPost',sendPost);
            ExternalInterface.addCallback('sendGet',sendGet);
        }
        public function sendPost(varObj:Object,url:String,window:String):void{
            u.method = URLRequestMethod.POST;
            send(varObj,url,window);
        }
        public function sendGet(varObj:Object,url:String,window:String):void{
            u.method = URLRequestMethod.GET;
            send(varObj,url,window);
        }
        private function send(varObj:Object,url:String,window:String):void{
            var data:URLVariables = new URLVariables();
            if (!window) window = '_self';
            for (var i:String in varObj){
                data[i] = varObj[i];
            }
            u.data = data;
            u.url = url;
            navigateToURL(u,window);
        }
    }
}

- 첨부파일

HTTP_POST.as  
HTTP_POST.swf  
post_test.html