myLib



© 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 :

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

Apply this style to our component instances :

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

or while instantiating component :

1
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 :

1
2
3
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 :

1
2
3
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 :

1
2
3
4
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 :

1
2
3
4
5
6
7
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

    Hi,

    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 : http://mylib.samystudio.net/forum/viewtopic.php?f=13&p=228#p228

  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=http://purchase-dapoxetine-online.priliorder.com]Purchase Dapoxetine Online[/url] Precio Cialis Farmacia Cruz Verde Viagra Generico Ritardante [url=http://viacheap.com]viagra online[/url] Discount Sale Secure Progesterone With Free Shipping Jacksonville Cialis Effets Secondaires [url=http://generic-kamagra.kamagpills.com]Generic Kamagra[/url] Diflucan Without Prescription 150 Mg Buy Xenical Online Cheap Uk [url=http://viagra-online-sales.via100mg.com]Viagra Online Sales[/url] Lasix Without A Prescription Viagra Effetti Avversi [url=http://prednisone.ccrpdc.com/generic-prednisone.php]Generic Prednisone[/url] Cheapeast secure ordering isotretinoin where to order no prescription How Levitra Works [url=http://cial40mg.com/ordina-cialis-online.php]Ordina Cialis Online[/url] Generic Worldwide Progesterone Tablet

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

    Buy Orlistat From Mexico [url=http://bpdrugs.com/mail-order-cialis.php]Mail Order Cialis[/url] Metronodizole Discount Acheter Kamagra Petite Quantite [url=http://levicost.com]cheapest generic levitra[/url] Kamagra Holland Generic Doxycycline Internet Website [url=http://where-to-buy-dapoxetine.prilipills.com]Where To Buy Dapoxetine[/url] Low Dose Levitra Propecia Effects Testicular Pain [url=http://how-to-order-cialis.BuyCial.com]How To Order Cialis[/url] Kamagra Oral Jelly For Women K Cl [url=http://priligy.cialpills.com/priligy-buy.php]Priligy Buy[/url] Cephalexin Interaction With Acohole How To Last Longer Inbed [url=http://viagra-online-online.viaforsale.com]Viagra Online Online[/url] Levitra On Sale Viagra Rezeptfrei Per Uberweisung [url=http://order-cialis-online.tadalaf.com]Order Cialis Online[/url] Ciprofloxacin Tab 500mg Side Effects Spironolactone By Paypal Payment [url=http://levipills.com/levitra-generic-online.php]Levitra Generic Online[/url] Stendra Internet In Us Propecia Sterilizzazione [url=http://levicost.com]levitra online order[/url] Cheap Lasix 40 Mg Comprare Cialis A San Marino [url=http://buylevitraeufast.com/levitra-pills.php]Levitra Pills[/url] Order Now Macrobid 100mg Internet France On Line Lasuna [url=http://dapoxetine-buy.prilipills.com]Dapoxetine Buy[/url] Le Viagra Levitra On Line Canadian Pharmacies [url=http://cialcheap.com/order-cialis-online.php]Order Cialis Online[/url] Amoxicillin Liquid And Indications Is Zithromax Safe While Breastfeeding [url=http://bestlevi.com/low-cost-levitra.php]Low Cost Levitra[/url] Amoxicillin Injections Generic Levitra Offers [url=http://etrobax.com]cialis[/url] Puchase Evista Viagra Y Cialis Contrareembolso [url=http://cheapcial.com/cialis-generic.php]Cialis Generic[/url] Echeck Viagara Acheter Baclofen Des [url=http://cialcheap.com/cialis-cost.php]Cialis Cost[/url] Cialis Se Puede Comprar Sin Receta Medica Nolvadex Homme [url=http://cialis-online-cs.cialorder.com]Cialis Online Cs[/url] Vent Kamagra Staxyn Overseas [url=http://leviusa.com]levitra on sale[/url] Keflex Cefazolin Comparison Order Retin A [url=http://viacheap.com]viagra[/url] Amazon Stromectol Order Propecia Online Australia [url=http://brandcial.com/tadalafil-generic.php]Tadalafil Generic[/url] Cialis Generika Kaufen Erfahrungen Cyrux Misoprostol [url=http://order-generic-propecia.propecpills.com]Order Generic Propecia[/url] Cheap Fertility Drugs Online Achat Viagra Lyon [url=http://cialbuy.com]generic cialis[/url] Finasteride 1 Mg Generique

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

    Kann Man Viagra Legal Kaufen [url=http://bestlevi.com/levitra-tablet.php]Levitra Tablet[/url] Does Cvs Sell Zenegra

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

    Levitra Allergie [url=http://buycheapvia.com]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