topical media & game development

talk show tell print

lib-flex-style-explorer-as-application.ax

lib-flex-style-explorer-as-application.ax (swf ) [ flash ] flex


  include "lib-flex-style-explorer-as-globalFuncs.ax";
  include "lib-flex-style-explorer-as-assets.ax";
  
  [Bindable]
  public var myCSS:String = "";
  
  public var cssbackgroundColor:String = "";
  public var cssbackgroundImage:String = "";
  public var cssthemeColor:String = "";
  public var csscolor:String = "";
  public var cssbackgroundGradientColors:String = "";
  public var cssbackgroundGradientAlphas:String = "";
  public var cssbackgroundSize:String = "";
  
  public var applicationStyles:Array = [
          "backgroundImage", "backgroundSize", "backgroundColor", "backgroundGradientColors", "backgroundGradientAlphas", "themeColor", "color"
  ];
  
  [Embed(source="lib-flex-style-explorer-assets-backgrounds.swf#bluestripe")]
  public var bluestripe:Class;
  
  [Embed(source="lib-flex-style-explorer-assets-brushedMetal.jpg")]
  public var brushedmetal:Class;
  
  [Embed(source="lib-flex-style-explorer-assets-backgrounds.swf#greenstripe")]
  public var greenstripe:Class;
  
  [Embed(source="lib-flex-style-explorer-assets-backgrounds.swf#industrial")]
  public var industrial:Class;
  
  [Embed(source="lib-flex-style-explorer-assets-backgrounds.swf#redstripe")]
  public var redstripe:Class;
  
  [Embed(source="lib-flex-style-explorer-assets-backgrounds.swf#retroFifties")]
  public var retroFifties:Class;
  
  [Embed(source="lib-flex-style-explorer-assets-backgrounds.swf#tartan")]
  public var tartan:Class;
  
  public function init():void {
          var bgImage:Array = [{label:"None"},
                                                  {label:"bluestripe", data:bluestripe},
                                                   {label:"redstripe", data:redstripe},
                                                   {label:"greenstripe", data:greenstripe},
                                                  {label:"brushedmetal", data:brushedmetal},
                                                  {label:"industrial", data:industrial},
                                                  {label:"retroFifties", data:retroFifties},
                                                  {label:"tartan", data:tartan}];
          
          mybackgroundImageapplication.dataProvider = bgImage;
          mybackgroundImageapplication.addEventListener("change", changeBackgroundImage);
          
  }
  
  public function changeBackgroundImage(e:Event):void {
          StyleManager.getStyleDeclaration("Application").setStyle('backgroundImage', mybackgroundImageapplication.selectedItem.data);
          if (mybackgroundImageapplication.selectedIndex == 0) {
                  cssbackgroundImage = "";
                  cssbackgroundSize = "";
                  updateCSS('application');
          } else if (mybackgroundImageapplication.selectedIndex == 4) {
                  setCSS('backgroundImage', 0, 'Embed(source="assets/'+mybackgroundImageapplication.selectedItem.label+'.jpg")', 'application');
                  setCSS('backgroundSize', 0, '100%', 'application');                
          } else        {
                  setCSS('backgroundImage', 0, 'Embed(source="assets/backgrounds.swf#'+mybackgroundImageapplication.selectedItem.label+'")', 'application');
                  setCSS('backgroundSize', 0, '100%', 'application');
          }
  }
  
  [Bindable]
  public var swatches:Array;
  


(C) Æliens 18/6/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.