4 Odds and ends
In this section I describe the components, which don’t really fall into any category.
4.1 The main Python script
main.py in Listing 12 shows the main entry page of the application using a Django template file.
Listing 12: main.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import os from google.appengine.ext.webapp import template import logging class MainPage(webapp.RequestHandler): def get(self): template_values = { 'reader_url': 'static/picasa/FlexPicasa.html', 'reader_url_linktext': 'FlexPicasa', } path = os.path.join(os.path.dirname(__file__), 'nav.html') self.response.out.write(template.render(path, template_values)) application = webapp.WSGIApplication( [('/', MainPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() |
4.2 Custom tooltip
You might have noticed that in several MXML tags attributes tooltip and toolTipCreate are present. The aforementioned attributes are needed for the creation of my custom tooltip. The tooltip shows useful information about a component and has some rather silly effects attached to it.
Listing 13: Custom tooltip factory
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | package net.ivanidris.flex { import mx.events.ToolTipEvent; public class CustomToolTipFactory { public function CustomToolTipFactory() { } public static function createPanelToolTip(title:String, body:String, event:ToolTipEvent):void { var ptt:PanelToolTip = new PanelToolTip(); ptt.title = title; ptt.bodyText = body; event.toolTip = ptt; } } } |
The factory in Listing 13 has one method that creates tooltips using the class in Listing 14. The arguments to the method are a title and text.
Listing 14: PanelToolTip
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | <?xml version="1.0"?> <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" implements="mx.core.IToolTip" width="200" alpha=".8" borderThickness="2" backgroundColor="0xCCCCCC" dropShadowEnabled="true" borderColor="black" borderStyle="solid" title="feh" creationComplete="init();" > <mx:Script><![CDATA[ import mx.managers.ToolTipManager; [Bindable] public var bodyText:String = ""; public var _text:String; public function get text():String { return _text; } public function set text(value:String):void { } public function init():void { ToolTipManager.hideDelay = 2000; ToolTipManager.showEffect = rotate; ToolTipManager.hideEffect = zoom; } ]]></mx:Script> <mx:Rotate id="rotate" /> <mx:Zoom id="zoom" /> <mx:Text text="{bodyText}" percentWidth="100"/> </mx:Panel> |
The ToolTipManager has a Rotate showEffect and Zoom hideEffect. This rotates the tooltip first and then zooms it away after two seconds.
More From ivanidris
ivanidris Recommends
- Seven Characteristics of Stepper Motors | Solder In The Veins (Solder In The Veins)

Pingback: Video | Enjolt.com | Innovate for Success