In yesterday's post about what Apollo is, a comment appeared to challenge the notion of being able to implement a simple browser in 5 lines of code. Rather than rebuke it on the comments list, I decided to make this post and place the code here to show how easy it is. This is as simple as it gets, no back buttons, SSL, bookmarks etc, but it is a browser that you can type a URL into and it will navigate to the URL and display the HTML properly formatted.
The sample Apollo MXML code:
<?xml version="1.0" encoding="utf-8"?>
<!--line one. I am not goign to count the XML PI-->
<mx:ApolloApplication mx="http://www.adobe.com/2006/mxml" layout="vertical" cornerRadius="12">
<!-- line two -->
<mx:Text text="Enter URL and hit enter" fontFamily="Arial" fontSize="16" fontWeight="bold" />
<!-- line three-->
<mx:TextInput id="urlTxt" width="100%" enter="html.location=urlTxt.text;" text="http://www.adobe.com" />
<!--line four -->
<mx:HTML id="html" width="100%" height="100%" location="http://www.adobe.com">
<!--line five. Not really a line of code, just closing the root tag -->
Here is the screenshot of the Apollo browser application:
Technoracle assists with technologies ranging from computer software systems architecture and design and application of user experiences. We have over 20 years of experience helping companies gather the full and auditable requirements for IT projects to ensure success.
Thursday, March 15, 2007
Apollo Browser in five lines of code
Posted by Duane Nickull at 9:06 am
Do not spam this blog! Google and Yahoo DO NOT follow comment links for SEO. If you post an unrelated link advertising a company or service, you will be reported immediately for spam and your link deleted within 30 minutes. If you want to sponsor a post, please let us know by reaching out to duane dot nickull at gmail dot com.
Subscribe to: Post Comments (Atom)
mx:HTML could be done on one line not two... and this is HTML, so you can of course do it all on one line :)
Yeah - I had it like this in Flex Builder but if you cut and paste MXML to blogger then do an "edit HTML" view and switch back to the preview, Blogger reformats the elements. I caught the others but not this one when I commented it.ReplyDelete
And of course you don't absolutely need the instructional text label... bringing the count down to 4. (You could always place the instructional text as a "prompt" text within the text input ... that is, text="Ener URL Here and select enter" click="urlTxt.text = ''")ReplyDelete
and some doubted it could be done.ReplyDelete
This comment has been removed by a blog administrator.ReplyDelete