Category: Apollo

Mar 21 2007

My first Apollo Application: zoomBrowser

I had a little play this morning with Apollo and Flex, and I apologize to all you Flexers out there, I haven't as yet had the time to REALLY get into Flex, so all of this is really obvious to you all. Anyway, I made a little browser implementation, you can load a URL and browse as you normally would, but if you have bad eyesight (as I do at 6 am) its nice to be able to zoom into the web page, hence zoomBrowser! The code for this is really simple: <?xml version="1.0" encoding="utf-8"?>
<mx:ApolloApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="700" width="800">

<mx:Script>
   <![CDATA[
      private function loadURL():void{
         htmlBrowser.location = locationBar.text;
      }
   ]]>
</mx:Script>
   <mx:HTML id="htmlBrowser" right="10" left="10" bottom="30" top="40" scaleX="{zoomSlider.value}" scaleY="{zoomSlider.value}"/>
   <mx:HSlider id="zoomSlider" right="10" bottom="10" minimum="0.5" value="1" maximum="3" snapInterval="0.1" liveDragging="true"/>
   <mx:TextInput id="locationBar" text="http://" right="59" left="50" top="10" enter="loadURL()"/>
   <mx:Button label="Go" id="goButton" right="10" top="10" click="loadURL()"/>
   <mx:Label text="URL:" left="10" top="10"/>
   <mx:Label text="Zoom:" right="178" bottom="5"/>
   
</mx:ApolloApplication>
There are two functions, loadURL and zoomBrowser. LoadURL is called either when you press enter in the mx:TextInput field or when you click on the "Go" button. The mx:HTML item is simply bound to the slider and it resizes with the values. Amazing that you can build such a complicated app (if you think about it) with so few lines of code! Download and unzip and give it a whirl (you need to download the Apollo runtime from Adobe Labs)

8 comments - Posted by Mark Drew at 12:07 PM - Categories: flex | Apollo

Search Archives

Contribute


MD on Twitter

Categories

coldfusion cfeclipse personal apple cfconferences ukcfug model-glue webdev blogging cfunited coldspring railo presentations adobe cfobjective scotch on the rocks reactor lost jobs ajax eclipse flex model-glue frameworks max google podcast podcasting reference ask md fusebox getrailo spam cfml donations eventvalidation fusiondebug air blue dragon cloud development flying funny java microsoft music snipex tattoo tips apple aptana blog cfml derby eventguard graphic novels hosting itunes metrics open bluedragon rant wishlist apollo barcamp bolt cebit cfdevcon cfonwheels cfug codeshare codeswarm coldfusioncamp directing doh! firefox flash gadgets groovy jquery mdc mvc ooops pownce quack regex spry subversion tashr transfer webservices xml

Monthly Archives