A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: COMPONENT TUTORIAL - FStyleFormat

  1. #1
    I just made a quick component tute for showing off the basics of FStyleFormats. Some preparation steps :

    1. Start a blank fla
    2. add a listBox, named "list"
    3. add 2 combo boxes, one named "fontCombo", the other "sizeCombo".

    add the following code to the frame that contains them :

    Code:
    globalStyleFormat.face = 0x000000;
    globalStyleFormat.arrow = 0xaaaaaa;
    globalStyleFormat.textColor = 0xffffff;
    globalStyleFormat.background = 0x003399;
    globalStyleFormat.selection = 0x000000;
    globalStyleFormat.selectionUnfocused = 0x000033;
    globalStyleFormat.applyChanges();
    
    list.setDataProvider( ["Item One", "Item Two", "Item Three", "Item Four",
    					   "Item Five", "Item Six", "Item Seven", "Item Eight", "Item Nine"] );
    
    fontCombo.setDataProvider(TextField.getFontList());
    sizeCombo.setDataProvider( [8, 10, 12, 14, 16, 18, 20, 25, 30] );
    
    fontCombo.setChangeHandler("changeFont");
    sizeCombo.setChangeHandler("changeSize");
    
    this.height = list._height;
    this.width = list._width;
    
    function changeFont()
    {
    	list.setStyleProperty("textFont", fontCombo.getSelectedItem().label);
    	list.setSize(this.width, this.height);
    }
    
    function changeSize()
    {
    	list.setStyleProperty("textSize", sizeCombo.getSelectedItem().label);
    	list.setRowCount(this.width, this.height);
    }
    ... et voila. I'm not going to explain every line. Look up the methods in the reference panel for more information. Style Formats are pretty useful, if you ask me.

    nig
    npegg@macromedia.com
    [Edited by Component Nigel on 03-18-2002 at 02:50 PM]

  2. #2
    <coughbump>

  3. #3
    Junior Member
    Join Date
    Aug 2001
    Posts
    27
    Thanks ! Great tutorial that shows the power of FStyleFormats!

    But there isn't a possibility to change the scrollbar-width with ActionScript, is there ? (It's way too big with small fonts)
    I guess, i'll have to manually change the width in the library (->FScrollBar Skins->fsb_*) ?!


    [Edited by drgary on 03-18-2002 at 06:40 PM]

  4. #4

    Yup, it's off to the skins library you go..
    nig

  5. #5
    Junior Member
    Join Date
    Jun 2001
    Posts
    20
    Very useful but it acted strange on my PC. When I selected a font size it shot the list off the page and was slow to respond. Was this due to the script? I'll get into the script later to see if it can be easily restricted if not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center