A Flash Developer Resource Site

Page 3 of 3 FirstFirst 123
Results 41 to 54 of 54

Thread: Making Grid with MovieClip. Help Please.

  1. #41
    Member
    Join Date
    May 2006
    Posts
    55
    using below code
    Error is :1180: Call to a possibly undefined method FStyleFormat.

    PHP Code:

    private function customizeRooms()
            {
                
    trace("called");
                
    // create a new format object
                
    var myStyleFormat:Object = new FStyleFormat(); 

                
                
    // set your style preferences
                
    myStyleFormat.shadow 0x0000ff;
                
    myStyleFormat.background 0x000020;
                
    myStyleFormat.selection 0x0000cc;
                
    myStyleFormat.scrollTrack 0x000044;
                
    myStyleFormat.face 0x000066;
                
    myStyleFormat.arrow 0xffff00;
                
    myStyleFormat.textColor 0xffffff;
                
    myStyleFormat.textFont "Eurostile";
                
    myStyleFormat.textSize 16;
                
    myStyleFormat.textLeftMargin 3;
                
                
                
    // apply the style to the listbox
                
    myStyleFormat.addListener(mainRef.roomList_lb);
                
    myStyleFormat.applyChanges();


                
                
                
            } 

  2. #42
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Well, what is FStyleFormat? If it's a class you're using from another package you will have to import it before you can use it.

  3. #43
    Member
    Join Date
    May 2006
    Posts
    55
    oh hmm. I thought something built in.
    Can you tell me how to customize the listbox like changing background. Nothing working for me right now. any example..

    Thanks

  4. #44
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Nope. Neither ListBox nor FStyleFormat is in the asdocs that I have bookmarked. http://help.adobe.com/en_US/AS3LCR/Flash_10.0/

    If they are part of a 3rd party package, you should look at the documentation they provide. If they're part of some adobe thing I don't know about, please post a link to it.

  5. #45
    Member
    Join Date
    May 2006
    Posts
    55
    oh I am sorry about all this confusion. FStyleFormat was something built in for MX. I got the code and material while googling. I post the working example of listbox. Trying to find it.
    You can see the thread here
    http://www.actionscript.org/forums/s...d.php3?t=24777

    Actually I want to customize list component. Like changing background, row color etc.
    Any help or I am asking wrong?

    Thanks

  6. #46
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I still don't know what ListBox is, but if it's a UIComponent then setStyle seems like the right method, but you'll have to find the right properties to set for that component.

  7. #47
    Member
    Join Date
    May 2006
    Posts
    55
    I am talking about this
    http://help.adobe.com/en_US/ActionSc...5b32-7f41.html

    I used code below but its not working at all.

    mainRef.roomList_lb.setStyle("backgroundColor", 0xE3FFD6);
    mainRef.roomList_lb.setStyle("alternatingRowColors ", 0xE3FFD6);
    mainRef.roomList_lb.setStyle("borderStyle", "none");

    thanks

  8. #48
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    http://help.adobe.com/en_US/AS3LCR/F...l#styleSummary

    I believe you need to mess with the skin properties or the cell renderer. But I'm unfamiliar with this whole thing.

  9. #49
    Member
    Join Date
    May 2006
    Posts
    55
    What do you use when you have to display data in rows? . Like grid or list where you need to style the rows.
    I am stuck and dont know how to customize the look of a Grid/List.

    Any suggestion to look into?

    thanks

  10. #50
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I haven't had to.
    But if i did, I'd probably start by looking at DataGrid.

  11. #51
    Member
    Join Date
    May 2006
    Posts
    55
    DataGrid looks very good and I am going to explore it more.
    Thanks

  12. #52
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,136
    customized datagrid skins once or twice and it's always an ugly process.
    This is the pattern I use to do alternating colors by row. You need to know that CellRenderer_upSkinA, etc. are actually Library objects in Library/Component Assets/CellRendererSkins ...basically they all start off as a copy of CellRenderer_upSkin or CellRenderer_downSkin, and you customize them as necessary.
    To use this code, you have to say
    myDatagrid.setStyle("cellRenderer",AlternatingRend erer);
    and make sure you've got items in your library, exported for actionscript, that correspond to the names of all those skins.

    Code:
    package {
    	import fl.controls.listClasses.CellRenderer;
    	import fl.controls.listClasses.ICellRenderer;
    	public final class AlternatingRenderer extends CellRenderer implements ICellRenderer {
    		public function AlternatingRenderer():void {
    			super();
    		}
    		public static  function getStyleDefinition():Object {
    			return CellRenderer.getStyleDefinition();
    		}
    		override protected  function drawBackground():void {
    			if (_listData.index % 2 == 0) {
    				setStyle("upSkin",CellRenderer_upSkinA);
    				setStyle("overSkin",CellRenderer_upSkinAOver);
    				setStyle("downSkin",CellRenderer_upSkinAOver);
    			} else {
    				setStyle("upSkin",CellRenderer_upSkinB);
    				setStyle("overSkin",CellRenderer_upSkinBOver);
    				setStyle("downSkin",CellRenderer_upSkinBOver);
    			}
                            //ed: ignore these two lines, they don't go together:
    			//setStyle("embedFonts",true);
    			//setStyle("textFormat",new TextFormat("Arial",10));
    			super.drawBackground();
    		}
    	}
    }

  13. #53
    Member
    Join Date
    May 2006
    Posts
    55
    thanks for the reply. Have you managed to align datagrid columns to center?. if yes than How?

    Thanks

  14. #54
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,136
    If you look at those two lines in my code I commented out, basically that's how you get each cell in the datagrid to set its textformat. So if you make it a textformat where align="centered" then, at least in theory, they should be centered. I've never actually tried that, but I don't see why it wouldn't work.

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