dcsimg
A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 26 of 26

Thread: [RESOLVED] How can I call stored procedure in Flash actionscript 3.0?

  1. #21
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    Because the result is just an int, then to get the result you will say
    loginResult = e.data;

    It is nothing more complex than that.
    The 'data' in e.data is refering to the result. That result is simply an int. In the weather case, it was returning an object that had properties. hence having to say e.data.Latitude. The 'data' is the base of the results.
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  2. #22
    Member
    Join Date
    Jun 2009
    Posts
    63
    When I use loginResult = e.data; it has the following error:

    1118: Implicit coercion of a value with static type Object to a possibly unrelated type int.

    But the result is just an int, why it throws such error?

  3. #23
    Member
    Join Date
    Jun 2009
    Posts
    63
    I searched that I need to cast the object to int

    loginResult = int(e.data);

    Then, it works!

    Also, your method to pass parameters across frames also work!

    Thank you very much.

  4. #24
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    Glad to see anyone using web services. I love them.
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  5. #25
    Member
    Join Date
    Jun 2009
    Posts
    63
    Hi

    I encountered a strange problem.

    Yes, it did work when I run it by Ctrl + Enter on Flash CS3.

    Then, I publish it with html.

    When I open http://127.0.0.1/FlashWS, I can see the login screen of flash.

    However, it does not has response after I input username and password and click login button.

    When I just open the swf locally, it is able to login. Just not able to login if embed into a html.

    Do you have any idea?

  6. #26
    Member
    Join Date
    Jun 2009
    Posts
    63

    Question

    Hi

    The strange problem has not solved yet.

    I added some debug note insides the code:

    Code:
    butLogin.addEventListener(MouseEvent.CLICK, doLogin);
    
    function doLogin(event:MouseEvent) 
    {
       prompt.text = "doLogin";
       UserName = txtUsername.text;
       Password = txtPassword.text;
       trace("username " + UserName + ", password " + Password);
    
       var ws = new WebService("http://XXX.XXX.XXX.XXX/FlashWS/Service.asmx?wsdl"); //it is a public ip
       var op:Operation = new Operation(ws);
       prompt.text = "ws";
       
       op.addEventListener(OperationEvent.COMPLETE, onResult);
       op.addEventListener(OperationEvent.FAILED, onFault);
    
       op.CheckOperatorLogin(txtUsername.text,txtPassword.text);
       prompt.text = "call function";
       
       trace("txtUsername: " + txtUsername.text + ", txtPassword " + txtPassword.text);
    	
       function onResult(e:OperationEvent):void {
    	   
    	   prompt.text = "onResult";
    	   
    	   for (var prop in e.data){
    		   trace (e.data[prop]);
    	   }
    	   loginResult = int(e.data);
    	   trace("Login Result: " + loginResult);
    	   
    	   prompt.text = "Login Result";
    	   
    	   if (loginResult > 0){		   
    		  prompt.text = "gotoandplay";
    	      gotoAndStop(2);
           } else {
    	     stop();
           }
       }
       
       function onFault (e:OperationEvent):void {
    	   trace (e.data);
       }
    }

    When I run it in Flash CS3, it can login and goto next frame.

    When I run it on webserver, it runs up to the line
    prompt.text = "call function";

    Why was that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center