dcsimg
A Flash Developer Resource Site

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

Thread: Positioning MCs according to height

  1. #41
    Member
    Join Date
    Mar 2007
    Posts
    69

    Exclamation

    Quote Originally Posted by 5TonsOfFlax View Post

    For extra credit, what happens when a single post is taller than columnHeight?

    If i wanted to add a scrollbar like UIScrollBar.. where abouts do i need to add that scrollbar to the text?


    I have this code:

    PHP Code:

        
    var scrollBar:UIScrollBar = new UIScrollBar();
        
    scrollBar.scrollTarget newsBody;
        
    scrollBar.height newsBody.height;
        
    scrollBar.move(newsBody.newsBody.widthnewsBody.y);
        
        
    addChild(scrollBar);
                    
    function 
    updateScrollBar():void{
                        
    scrollBar.update();
                        if (
    scrollBar.enabled == false) {
                            
    scrollBar.alpha 0;
                        } else {
                                
    scrollBar.alpha 100;
                            }
                    } 
    Inserted into the NewsPost class like so:

    PHP Code:
        public class NewsPost extends Sprite
        
    {

            public var 
    newsBody:TextField;

            public function 
    NewsPostbody:String)
            {
                
    newsBody = new TextField();
                
    newsBody.embedFonts true;
                
    newsBody.multiline true;
                
    newsBody.wordWrap true;
                
    newsBody.autoSize TextFieldAutoSize.LEFT;
                
    newsBody.antiAliasType AntiAliasType.ADVANCED;
                
    newsBody.styleSheet IStyleSheet(Gaia.api.getPage("index").assets.stylesheet).style;

                
    newsBody.htmlText body;
                
    addChild(newsBody);
                
                
    //Create the scrollBar instance
                    
    var scrollBar:UIScrollBar = new UIScrollBar();
                    
    //assign the target of the scrollBar to your textfield
                    //addChild(scrollBar);
                    
    scrollBar.scrollTarget newsBody;
                    
    //make the height the same as the textfield
                    
    scrollBar.height 200;
                    
    //Move the scrollbar to the righthand side
                    //scrollBar.move(newsBody.x + newsBody.width, newsBody.y);
                    //add it to the stage
                    
    addChild(scrollBar);
                    
    //check if it is required if so show it,put this function right after updating your textfield contents with added text
                    
    function updateScrollBar():void{
                        
    scrollBar.update();
                        if (
    scrollBar.enabled == false) {
                            
    scrollBar.alpha 0;
                        } else {
                                
    scrollBar.alpha 100;
                            }
                    } 

                
    // Positions & Sizing

                
    newsBody.90;
                
    newsBody.newsTitle.height 10;
                
    newsBody.width 350;
            }
        } 

    But it's giving me a weird 'flashy' result.. have i put this in the right spot?

    Many thanks for any help.
    Last edited by greenpear; 09-22-2010 at 05:44 PM.

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