Created
June 6, 2013 14:49
-
-
Save dancsiqueira/5722075 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package { | |
| import flash.display.MovieClip; | |
| import flash.external.ExternalInterface; | |
| import flash.display.SimpleButton; | |
| import flash.events.MouseEvent; | |
| import flash.text.TextField; | |
| import flash.net.URLRequest; | |
| import flash.display.Loader; | |
| public class SSOExample extends MovieClip { | |
| private var button:SimpleButton | |
| private var user:MovieClip | |
| private var userUid:TextField | |
| private var userBirthdate:TextField | |
| private var userEmail:TextField | |
| private var userNickname:TextField | |
| private var userGender:TextField | |
| private var avatarThumb:MovieClip | |
| private var avatarBig:MovieClip | |
| private var avatarThumbLoader:Loader = new Loader() | |
| private var avatarBigLoader:Loader = new Loader() | |
| public function SSOExample() { | |
| super() | |
| ExternalInterface.addCallback('callback', callback) | |
| button = this['stage_button'] | |
| button.addEventListener(MouseEvent.CLICK, openSSO) | |
| user = this['stage_user'] | |
| userUid = user['user_uid'] | |
| user.visible = false | |
| userUid = user['user_uid'] | |
| userBirthdate = user['user_info_birthdate'] | |
| userEmail = user['user_info_email'] | |
| userNickname = user['user_info_nickname'] | |
| userGender = user['user_info_gender'] | |
| avatarThumb = user['user_info_avatar_thumb'] | |
| avatarBig = user['user_info_avatar_big'] | |
| avatarThumb.addChild(avatarThumbLoader) | |
| avatarBig.addChild(avatarBigLoader) | |
| } | |
| private function openSSO(e:MouseEvent){ | |
| ExternalInterface.call('window.open', 'http://connect.clickjogos.uol.com.br/40a013df7f9bd8f59992bbe16c624c3a/', | |
| 'sso', 'height=665,width=700,toolbar=no,scrollbars=yes') | |
| } | |
| private function callback(data:* = null){ | |
| user.visible = true | |
| userUid.text = data.uid | |
| userBirthdate.text = data.info.birthdate | |
| userEmail.text = data.info.email | |
| userGender.text = data.info.gender | |
| userNickname.text = data.info.nickname | |
| avatarThumbLoader.load( new URLRequest(data.info.avatar_thumb) ) | |
| avatarBigLoader.load( new URLRequest(data.info.avatar_big) ) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment