calling a new method in java from mxml produces "cannot invoke method" error
UserService.java
...
        public class UserService {
                public static User getUser(String username, String password) {
                        ...
            开发者_开发百科    }   
                public static User getUser2(String username, String password) {
                        ...
                }   
        }  
login.mxml
    private function loginUser() : void {
            lostPassword = false;
            // this works fine
        UserService.getUser(username.text, password.text);
            // this fails !
        UserService.getUser2(username.text, password.text);
        }
getUser was already in UserService.java.  I just created getUser2 and it's identical to getUser.  When I try to call getUser2, i get the "Cannot invoke method" error.
question: Do I need to specify getUser2 in some other file? like in some configuration file? if so, which one and how do I do it.
Thanks.
think problem is JAVA static method according to Remoting Service definition
The Remoting Service lets a client application access the methods of server-side Java objects
In java/oops static methods are not associated to Object/instance its depends-upon/associated to class
your method should be like this to accept call from flex
public class UserService {
                public User getUser(String username, String password) {
                        ...
                }   
                public User getUser2(String username, String password) {
                        ...
                }   
        }  
Hopes that helps
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论