© 2017 myLib
Based on DemusDesign and Eric Séguin Themes

Style management

Adobe components use style as additional components (generally common) properties. With myLib style consist of an object with pair key/value that could match any component properties. This is really useful to avoid repetitive coding and configure multiple components with the same parameters. For example you may want have all website scrollbar with no up and down button or all components with no hand cursor, this can be easily achieved with style.

Let’s create a style object that will be useful for scrollbar :

var scrollStyle : Object = { width : 20 , useUpDown : false ,  thumbResizeEnabled : false }

Apply this style to our component instances :

myScroll0.setStyle( scrollStyle ) ;
myScroll1.setStyle( scrollStyle ) ;

or while instantiating component :

var myScroll2 : ScrollBar = new ScrollBar( null , scrollStyle ) ;

This is great if we need to apply this style to multiple scrollbar but not all, what about if we want to apply this style to all website scrollbar, this can be achieved in a better way using StyleManager class :

import myLib.styles.StyleManager;

StyleManager.getInstance().setClassStyle( ScrollBar , scrollStyle ) ;

In this way we no longer need to apply style to each components, every already instantiate components and next one will be registered with this style.

We can go further if we want set a property common to all components, for example useHandCursor property is available for all components since they all inherit from InteractiveObject. Let’s apply useHandCursor false to all components :

import myLib.styles.StyleManager;

StyleManager.getInstance().setGlobalStyle( { useHandcursor : false } ) ;

Style object could alternatively use to store data with component since you can get back a previously style applied using component.getStyle(), StyleManager.getInstance().getClassStyle( class : Class ) or StyleManager.getInstance().getGlobalStyle() ;

For example we can store an extra id property with a scrollbar instance :

var: Object = { id : 10 } ;
myScroll.setSyle( o ) ;

trace( myScroll.getStyle().id ) ;

Since this is not the prior use of styles, note , you will only able to get last style object applied :

var o1 : Object = { id : 10 } ;
myScroll.setSyle( o1 ) ;

var o2 : Object = { uid : 10 } ;
myScroll.setSyle( o2 ) ;

trace( myScroll.getStyle().id ) ;  // return undefined

9 Responses to “Style management”

  1. Fred Says:
    June 7th, 2010 at 9:58 pm


    Does style can add some easing in a scrollbar ?

  2. Nick Says:
    October 13th, 2011 at 4:50 pm

    Please give an example of using textstyle class to format a label component.

  3. SamYStudiO Says:
    October 15th, 2011 at 12:58 am

    Here is an example from forum user :

  4. cases for iPhone 6 plus Says:
    December 8th, 2014 at 9:32 am

    There are things I love about the iPhone 6 too, and things I don’t particularly like about the Nexus 6. No phone is perfect, but above was just six or so things I’ve been enjoying with the Nexus 6 that makes it better than the iPhone 6, at least for me.

  5. iPhone 6S Plus Cases Covers Says:
    October 13th, 2015 at 7:24 am

    BlackBerry Priv has not really been in the news apart from the gossipy tidbits and rumors from time to time.But now shockingly, a user on Reddit got a phone unofficially in his hand and revealed a lot about this mysterious new device.

  6. Kellooche Says:
    June 15th, 2017 at 5:01 pm

    Cialis A Largo Plazo [url=]Purchase Dapoxetine Online[/url] Precio Cialis Farmacia Cruz Verde Viagra Generico Ritardante [url=]viagra online[/url] Discount Sale Secure Progesterone With Free Shipping Jacksonville Cialis Effets Secondaires [url=]Generic Kamagra[/url] Diflucan Without Prescription 150 Mg Buy Xenical Online Cheap Uk [url=]Viagra Online Sales[/url] Lasix Without A Prescription Viagra Effetti Avversi [url=]Generic Prednisone[/url] Cheapeast secure ordering isotretinoin where to order no prescription How Levitra Works [url=]Ordina Cialis Online[/url] Generic Worldwide Progesterone Tablet

  7. Kellooche Says:
    June 21st, 2017 at 8:21 pm

    Buy Orlistat From Mexico [url=]Mail Order Cialis[/url] Metronodizole Discount Acheter Kamagra Petite Quantite [url=]cheapest generic levitra[/url] Kamagra Holland Generic Doxycycline Internet Website [url=]Where To Buy Dapoxetine[/url] Low Dose Levitra Propecia Effects Testicular Pain [url=]How To Order Cialis[/url] Kamagra Oral Jelly For Women K Cl [url=]Priligy Buy[/url] Cephalexin Interaction With Acohole How To Last Longer Inbed [url=]Viagra Online Online[/url] Levitra On Sale Viagra Rezeptfrei Per Uberweisung [url=]Order Cialis Online[/url] Ciprofloxacin Tab 500mg Side Effects Spironolactone By Paypal Payment [url=]Levitra Generic Online[/url] Stendra Internet In Us Propecia Sterilizzazione [url=]levitra online order[/url] Cheap Lasix 40 Mg Comprare Cialis A San Marino [url=]Levitra Pills[/url] Order Now Macrobid 100mg Internet France On Line Lasuna [url=]Dapoxetine Buy[/url] Le Viagra Levitra On Line Canadian Pharmacies [url=]Order Cialis Online[/url] Amoxicillin Liquid And Indications Is Zithromax Safe While Breastfeeding [url=]Low Cost Levitra[/url] Amoxicillin Injections Generic Levitra Offers [url=]cialis[/url] Puchase Evista Viagra Y Cialis Contrareembolso [url=]Cialis Generic[/url] Echeck Viagara Acheter Baclofen Des [url=]Cialis Cost[/url] Cialis Se Puede Comprar Sin Receta Medica Nolvadex Homme [url=]Cialis Online Cs[/url] Vent Kamagra Staxyn Overseas [url=]levitra on sale[/url] Keflex Cefazolin Comparison Order Retin A [url=]viagra[/url] Amazon Stromectol Order Propecia Online Australia [url=]Tadalafil Generic[/url] Cialis Generika Kaufen Erfahrungen Cyrux Misoprostol [url=]Order Generic Propecia[/url] Cheap Fertility Drugs Online Achat Viagra Lyon [url=]generic cialis[/url] Finasteride 1 Mg Generique

  8. Kellooche Says:
    June 24th, 2017 at 11:12 pm

    Kann Man Viagra Legal Kaufen [url=]Levitra Tablet[/url] Does Cvs Sell Zenegra

  9. Kellooche Says:
    June 28th, 2017 at 5:17 pm

    Levitra Allergie [url=]viagra[/url] Propecia Pve

Leave a Reply

To prove you're a person (not a spam script), type the answer to the math equation shown in the picture. Click on the picture to hear an audio file of the equation.
Click to hear an audio file of the anti-spam equation