A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] autoScrollText start on enterframe

  1. #1
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389

    resolved [RESOLVED] autoScrollText start on enterframe

    Hi,

    I've been looking around for threads about this and found a few that work fine but I'd like to understand it better. I have tried replacing the code for one of the buttons to build an onEnterFrame function instead but it doesn't work. I wrote:

    Code:
    onEnterFrame = function(){
    resumee_txt.scroll--;
    }
    Is onEnterFrame the right way to approach this or should I start thinking on using setInterval or some other way? I've seen an example with a mask, but I'd prefer to use AS solely.

    Code:
    this.createTextField("resumee_txt",this.getNextHighestDepth(),100,20,240,200);
    resumee_txt.multiline = true;
    resumee_txt.wordWrap = true;
    
    var myXML:XML = new XML();
    myXML.ignoreWhite = true;
    myXML.load("resumee.xml");
    myXML.onLoad = function(success)
    {
    	if (success)
    	{
    		var myResumee = myXML.firstChild.childNodes;
    		for (i = 0; i < myResumee.length; i++)
    		{
    			var resumeeURL = myResumee[i].firstChild.nodeValue;
    			resumee_txt.text += resumeeURL;
    		}
    	}
    };
    
    scrollUp_btn.onRelease = function()
    {
    	resumee_txt.scroll--;
    };
    
    scrollDown_btn.onRelease = function()
    {
    	resumee_txt.scroll++;
    };
    Thanks

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    This might do the trick,
    PHP Code:
    this.createTextField("resumee_txt",this.getNextHighestDepth(),100,20,240,200);
    resumee_txt.multiline true;
    resumee_txt.wordWrap true;
    resumee_txt.border true;

    var 
    myXML:XML = new XML();
    myXML.ignoreWhite true;
    myXML.load("resumee.xml");
    myXML.onLoad = function(success)
    {
        if (
    success)
        {
            var 
    myResumee myXML.firstChild.childNodes;
            for (
    0myResumee.lengthi++)
            {
                var 
    resumeeURL myResumee[i].firstChild.nodeValue;
                
    resumee_txt.text += resumeeURL;
            }
            
    CallAutoScroll();
        }
    };

    function 
    CallAutoScroll()
    {
        
    DoScroll setInterval(AutoScroll1000);
    }

    function 
    AutoScroll()
    {
        
    resumee_txt.scroll++;
        if (
    resumee_txt.scroll == resumee_txt.maxscroll)
        {
            
    clearInterval(DoScroll);
        }
    }

    scrollUp_btn.onRelease = function()
    {
        
    resumee_txt.scroll--;
    };

    scrollDown_btn.onRelease = function()
    {
        
    resumee_txt.scroll++;
    }; 
    1000 = 1 second, if you wished to make the auto scroll longer or shorter!

    I have put the scroll inside a function so it can be called at any time. CallAutoScroll();

    Good luck Jordi

  3. #3
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Thanks, FruitBeard,

    I thought you might have answered the post, but wouldn't think you'd be around on a sunday. Anyway, thanks, that's exactly what I needed. Sorry I wasn't online, I fixed the users entering the chat with a sound issue, but I was watching TV and I forgot to stop the server...

    Thanks again,

    see you soon

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