Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright 2008 Google Inc.
- * Licensed under the Apache License, Version 2.0:
- * http://www.apache.org/licenses/LICENSE-2.0
- */
- package {
- import flash.events.Event;
- import flash.events.MouseEvent;
- import flash.net.URLRequest;
- import flash.net.navigateToURL;
- import mx.containers.Panel;
- import mx.containers.TabNavigator;
- import mx.containers.VBox;
- import mx.controls.LinkButton;
- import mx.core.UIComponent;
- import mx.states.*;
- public class InfoWindowTabbedComponent2 extends UIComponent {
- public function InfoWindowTabbedComponent2() {
- // Add body text
- var tabNavigator:TabNavigator = new TabNavigator();
- tabNavigator.width = 290;
- tabNavigator.height = 150;
- tabNavigator.addChild(createTab("Utile"));
- tabNavigator.addChild(createTab("Cultura"));
- tabNavigator.addChild(createTab("Istorie"));
- tabNavigator.addChild(createTab("Link"));
- addChild(tabNavigator);
- addChild(createTab("Parent"));
- cacheAsBitmap = true;
- }
- /* This function opens a page */
- public function gotoMicrosoftSite(event:MouseEvent):void
- {
- var adobeURL:URLRequest = new URLRequest("http://www.microsoft.com" );
- navigateToURL(adobeURL, "_self");
- }
- /* This function opens another page */
- public function gotoOrangeSite(event:MouseEvent):void
- {
- var adobeURL:URLRequest = new URLRequest("http://www.orange.com" );
- navigateToURL(adobeURL, "_self");
- }
- /* This function is loading the links in the tab */
- public function createTab(label:String):VBox
- {
- var tab:VBox = new VBox();
- tab.label = label;
- var inside:Panel = new Panel();
- var link:LinkButton
- inside.width = 280;
- inside.height = 100;
- inside.setStyle("borderStyle", "none");
- if (label=="Link")
- {
- link = new LinkButton();
- link.id = "lnkMicrosoft2";
- link.label = "Microsoft2";
- link.addEventListener(MouseEvent.CLICK, gotoMicrosoftSite );
- inside.addChild(link);
- }
- if (label=="Utile")
- {
- link = new LinkButton();
- link.id = "lnkMicrosoft";
- link.label = "Microsoft";
- link.addEventListener(MouseEvent.CLICK, gotoMicrosoftSite);
- inside.addChild(link);
- link = new LinkButton();
- link.id = "lnkOrange";
- link.label = "Orange";
- link.addEventListener(MouseEvent.CLICK, gotoOrangeSite);
- inside.addChild(link);
- }
- tab.addChild(inside);
- return tab;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement