开发者

Flex 4 - PHP strange sequence of executing commands?

I am beginner in FLEX programming , I am trying to implement a very simple LOGIN system using PHP, FLEX, MySQL.

protected function button2_clickHandler(event:MouseEvent):void
        {
            var create_new_user:Users= new Users();
            Alert.show("1");
            create_new_user.username=username_create.text;
            Alert.show("2");
            create_new_user.password=MD5.hash(password_create.text);
            Alert.show("3");
            verificationResult.token = usersService2.verification(create_new_user);
            Alert.show("4");
            var verificationInt:int = verificationResult.lastResult as int;
            Alert.show("5");
            //Alert.show("Verification as 开发者_如何学C"+ verificationInt,"Verification Notification");
            Alert.show("6");
            if (verificationInt==0)
            {
                Alert.show("if 0");
                //Alert.show("Account Created , you may now login...","Account Manager");
                createUsersResult4.token = usersService2.createUsers(create_new_user);


            }
            else
            {   
                //Alert.show("if else");
                Alert.show("Username already existed , please choose another","Username verification");

            }
        }

I have added the "alert.show" to check the sequence , it was really strange to find out the it is executing "6,5,4,3,2,1"..??

Which mean user is created before checking the verification result?

Any advice...


You're getting the alert boxes in reverse order because they're stacked up one on top of the other, so the last one is on the top.

Imagine trying to stack 3 cards on a tabletop. King, Queen, Jack.

You place the Jack first, followed by the Queen, and then the King. When you want to pickup the cards, the King is at the top. Alerts are stacked similarly.

If you're using Flex Builder, use trace() to output debug data (run in debug mode) and not alert boxes. If not, throw a temporary text area where you insert all your output into.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜