<mx:VBox width= "100%" height= "100%" id= "authScreen" > <mx:TextInput text= "{authHTML.location}" editable= "false" width= "100%" /> <mx:HTML id= "authHTML" width= "100%" height= "100%" /> <mx:HBox width= "100%" horizontalAlign= "center" verticalAlign= "middle" > <mx:Label text= "Enter pin here:" /> <mx:TextInput id= "pinTextInput" /> <mx:Button label= "Ok" click= "pinOkButton_clickHandler(event)" id= "pinOkButton" /> </mx:HBox > </mx:VBox >
<mx:VBox width= "100%" height= "100%" id= "authScreen" > <mx:TextInput text= "{authHTML.location}" editable= "false" width= "100%" /> <mx:HTML id= "authHTML" width= "100%" height= "100%" /> <mx:HBox width= "100%" horizontalAlign= "center" verticalAlign= "middle" > <mx:Label text= "Enter pin here:" /> <mx:TextInput id= "pinTextInput" /> <mx:Button label= "Ok" click= "pinOkButton_clickHandler(event)" id= "pinOkButton" /> </mx:HBox > </mx:VBox >
<mx:VBox width= "100%" height= "100%" id= "authScreen" > <mx:TextInput text= "{authHTML.location}" editable= "false" width= "100%" /> <mx:HTML id= "authHTML" width= "100%" height= "100%" /> <mx:HBox width= "100%" horizontalAlign= "center" verticalAlign= "middle" > <mx:Label text= "Enter pin here:" /> <mx:TextInput id= "pinTextInput" /> <mx:Button label= "Ok" click= "pinOkButton_clickHandler(event)" id= "pinOkButton" /> </mx:HBox > </mx:VBox >
<mx:VBox width= "100%" height= "100%" id= "authScreen" > <mx:TextInput text= "{authHTML.location}" editable= "false" width= "100%" /> <mx:HTML id= "authHTML" width= "100%" height= "100%" /> <mx:HBox width= "100%" horizontalAlign= "center" verticalAlign= "middle" > <mx:Label text= "Enter pin here:" /> <mx:TextInput id= "pinTextInput" /> <mx:Button label= "Ok" click= "pinOkButton_clickHandler(event)" id= "pinOkButton" /> </mx:HBox > </mx:VBox >
<mx:VBox width= "100%" height= "100%" id= "authScreen" > <mx:TextInput text= "{authHTML.location}" editable= "false" width= "100%" /> <mx:HTML id= "authHTML" width= "100%" height= "100%" /> <mx:HBox width= "100%" horizontalAlign= "center" verticalAlign= "middle" > <mx:Label text= "Enter pin here:" /> <mx:TextInput id= "pinTextInput" /> <mx:Button label= "Ok" click= "pinOkButton_clickHandler(event)" id= "pinOkButton" /> </mx:HBox > </mx:VBox >
<mx:VBox width= "100%" height= "100%" id= "authScreen" > <mx:TextInput text= "{authHTML.location}" editable= "false" width= "100%" /> <mx:HTML id= "authHTML" width= "100%" height= "100%" /> <mx:HBox width= "100%" horizontalAlign= "center" verticalAlign= "middle" > <mx:Label text= "Enter pin here:" /> <mx:TextInput id= "pinTextInput" /> <mx:Button label= "Ok" click= "pinOkButton_clickHandler(event)" id= "pinOkButton" /> </mx:HBox > </mx:VBox >
<mx:VBox width= "100%" height= "100%" id= "authScreen" > <mx:TextInput text= "{authHTML.location}" editable= "false" width= "100%" /> <mx:HTML id= "authHTML" width= "100%" height= "100%" /> <mx:HBox width= "100%" horizontalAlign= "center" verticalAlign= "middle" > <mx:Label text= "Enter pin here:" /> <mx:TextInput id= "pinTextInput" /> <mx:Button label= "Ok" click= "pinOkButton_clickHandler(event)" id= "pinOkButton" /> </mx:HBox > </mx:VBox >
<mx:VBox width= "100%" height= "100%" id= "authScreen" > <mx:TextInput text= "{authHTML.location}" editable= "false" width= "100%" /> <mx:HTML id= "authHTML" width= "100%" height= "100%" /> <mx:HBox width= "100%" horizontalAlign= "center" verticalAlign= "middle" > <mx:Label text= "Enter pin here:" /> <mx:TextInput id= "pinTextInput" /> <mx:Button label= "Ok" click= "pinOkButton_clickHandler(event)" id= "pinOkButton" /> </mx:HBox > </mx:VBox >
<mx:VBox width= "100%" height= "100%" id= "authScreen" > <mx:TextInput text= "{authHTML.location}" editable= "false" width= "100%" /> <mx:HTML id= "authHTML" width= "100%" height= "100%" /> <mx:HBox width= "100%" horizontalAlign= "center" verticalAlign= "middle" > <mx:Label text= "Enter pin here:" /> <mx:TextInput id= "pinTextInput" /> <mx:Button label= "Ok" click= "pinOkButton_clickHandler(event)" id= "pinOkButton" /> </mx:HBox > </mx:VBox >
- <mx: VBox width = "100%" height = "100%" id = "twitterScreen" >
- <mx: List width = "100%" height = "100%" dataProvider = "{twitterStatuses}" id = "tweetsList" >
- <mx: itemRenderer >
- <mx: Component >
- <mx: HBox width = "100%" height = "100" borderStyle = "solid" >
- <mx: Image height = "100%" source = "{data.user.profileImageUrl}" />
- <mx: VBox height = "100%" width = "100" >
- <mx: Text width = "100%" text = "{data.user.screenName}" />
- <mx: Text width = "100%" text = "{data.createdAt}" />
- </ mx: vbox >
- <mx: Text width = "100%" height = "100%" text = "{data.text}" />
- </ mx: HBox >
- </ mx: Component >
- </ mx: itemRenderer >
- </ mx: List >
- <mx: HBox width = "100%" horizontalAlign = "center" verticalAlign = "middle" >
- <mx: TextArea width = "100%" height = "100%" id = "tweetTextInput"
- textInput = "tweetTextInput_textInputHandler (event)" />
- <mx: Button label = "Send" click = "sendTweetButton_clickHandler (event)"
- enabled = "{tweetTextInput.text! = ''}"
- height = "100%"
- id = "sendTweetButton" />
- </ mx: HBox >
- </ mx: vbox >
- var twitterApi : TwitterAPI = new TwitterAPI ( ) ;
- // Listen to the Token Request receipt event
- twitterApi.connection. addEventListener ( OAuthTwitterEvent.REQUEST_TOKEN_RECEIVED, handleRequestTokenReceived ) ;
- // Listen to the Token Request Request Error event
- twitterApi.connection. addEventListener ( OAuthTwitterEvent.REQUEST_TOKEN_ERROR, handleRequestTokenError ) ;
- // Listen to the Access Token receive error event
- twitterApi.connection. addEventListener ( OAuthTwitterEvent.ACCESS_TOKEN_ERROR, handleAccessTokenError ) ;
- // Listen to the successful authorization event
- twitterApi.connection. addEventListener ( OAuthTwitterEvent.AUTHORIZED, handleAuthorized ) ;
- // Log in
- twitterApi.connection.authorize ( CONSUMER_KEY, CONSUMER_SECRET ) ;
- protected function handleRequestTokenReceived ( event : OAuthTwitterEvent ) : void
- {
- authHTML.location = twitterApi.connection.authorizeURL;
- }
- protected function pinOkButton_clickHandler ( event : MouseEvent ) : void
- {
- twitterApi.connection.grantAccess ( pinTextInput. text ) ;
- }
- // Initialize status loading operation
- var op : TwitterOperation = new LoadHomeTimeline ( ) ;
- // Listen to the command completion event
- var handler : Function = function ( event : TwitterEvent ) : void
- {
- op. removeEventListener ( TwitterEvent. COMPLETE , handler ) ;
- if ( event.success )
- {
- // Operation completed successfully
- status = "Tweets loaded" ;
- // Get the list of downloaded tweets
- twitterStatuses = event. data as ArrayCollection;
- }
- else
- {
- // The operation completed with an error
- status = "Loading error:" + event. data . toString ( ) ;
- }
- } ;
- op. addEventListener ( TwitterEvent. COMPLETE , handler ) ;
- // Start the operation
- twitterApi.post ( op ) ;
- var text : String = tweetTextInput. text ;
- // Initialize status update operation
- var op : TwitterOperation = new UpdateStatus ( text ) ;
- var handler : Function = function ( event : TwitterEvent ) : void
- {
- op. removeEventListener ( TwitterEvent. COMPLETE , handler ) ;
- if ( event.success )
- {
- // Operation completed successfully
- status = "Tweet sent" ;
- loadTweets ( ) ;
- tweetTextInput. text = "" ;
- }
- else
- {
- // The operation completed with an error
- status = "Error of status sending:" + event. data . toString ( ) ;
- }
- } ;
- op. addEventListener ( TwitterEvent. COMPLETE , handler ) ;
- // Start the operation
- twitterApi.post ( op ) ;
Source: https://habr.com/ru/post/88688/
All Articles