Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 10th, 2009  |  syntax: None  |  size: 2.48 KB  |  views: 117  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2. * Copyright 2008 Google Inc.
  3. * Licensed under the Apache License, Version 2.0:
  4. *  http://www.apache.org/licenses/LICENSE-2.0
  5. */
  6. package {
  7.  
  8. import flash.events.Event;
  9. import flash.events.MouseEvent;
  10. import flash.net.URLRequest;
  11. import flash.net.navigateToURL;
  12.  
  13. import mx.containers.Panel;
  14. import mx.containers.TabNavigator;
  15. import mx.containers.VBox;
  16. import mx.controls.LinkButton;
  17. import mx.core.UIComponent;
  18. import mx.states.*;
  19.  
  20. public class InfoWindowTabbedComponent2 extends UIComponent {
  21.  
  22.            
  23.   public function InfoWindowTabbedComponent2() {
  24.     // Add body text
  25.     var tabNavigator:TabNavigator = new TabNavigator();
  26.     tabNavigator.width = 290;
  27.     tabNavigator.height = 150;
  28.      
  29.     tabNavigator.addChild(createTab("Utile"));
  30.     tabNavigator.addChild(createTab("Cultura"));
  31.     tabNavigator.addChild(createTab("Istorie"));
  32.     tabNavigator.addChild(createTab("Link"));
  33.    
  34.    
  35.     addChild(tabNavigator);
  36.     addChild(createTab("Parent"));
  37.    
  38.     cacheAsBitmap = true;
  39.   }
  40.  
  41.  
  42.  
  43.  
  44.   /* This function opens a page */
  45. public function gotoMicrosoftSite(event:MouseEvent):void
  46. {      
  47.     var adobeURL:URLRequest = new URLRequest("http://www.microsoft.com" );
  48.     navigateToURL(adobeURL, "_self");
  49. }
  50. /* This function opens another page */
  51.  
  52. public function gotoOrangeSite(event:MouseEvent):void
  53. {      
  54.     var adobeURL:URLRequest = new URLRequest("http://www.orange.com" );
  55.     navigateToURL(adobeURL, "_self");
  56. }
  57.  
  58.   /* This function is loading the links in the tab */
  59.   public function createTab(label:String):VBox
  60.   {
  61.         var tab:VBox = new VBox();
  62.         tab.label = label;
  63.         var inside:Panel = new  Panel();
  64.         var link:LinkButton
  65.        
  66.         inside.width = 280;
  67.         inside.height = 100;
  68.         inside.setStyle("borderStyle", "none");
  69.        
  70.         if (label=="Link")
  71.                 {
  72.                 link = new LinkButton();
  73.                 link.id = "lnkMicrosoft2";
  74.                 link.label = "Microsoft2";
  75.                             link.addEventListener(MouseEvent.CLICK, gotoMicrosoftSite );
  76.                 inside.addChild(link);
  77.                
  78.                 }
  79.                
  80.         if (label=="Utile")
  81.                 {
  82.                 link = new LinkButton();
  83.                 link.id = "lnkMicrosoft";
  84.                 link.label = "Microsoft";
  85.             link.addEventListener(MouseEvent.CLICK, gotoMicrosoftSite);
  86.                 inside.addChild(link);
  87.                
  88.                 link = new LinkButton();
  89.                 link.id = "lnkOrange";
  90.                 link.label = "Orange";
  91.             link.addEventListener(MouseEvent.CLICK, gotoOrangeSite);
  92.                 inside.addChild(link);
  93.                 }
  94.                        
  95.                
  96.         tab.addChild(inside);
  97.        
  98.         return tab;
  99.   }
  100. }
  101.  
  102. }