A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: problem with autoscrolling text

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    4

    Question problem with autoscrolling text

    hi there.

    so i'm now working on a mp3 player, and i got stucked with something. so here's my problem: i've a got bar (songBar) on which it will appear the artist and the song name(artist_txt). what i want is when de title_txt width is larger than the songBar.width, the text to scroll from right to left, and when the tween is finished to scroll from left to right(all this tween has to be a loop). if the width of artist_txt is smaller or equal to the songBar.width then artist_txt is aligned in the center of the songBar. all i'm trying to code it's just what you see in winamp player.
    Code:
          var textTween:Tween;
    		
    	if (mp3player.artist_txt.width > mp3player.songBar.width){
    	 textTween = new Tween(mp3player.artist_txt, "x", Linear.easeNone, mp3player.songBar.x, mp3player.songBar.width - mp3player.artist_txt.width, 1, true);
    	}
    	else{
    	mp3player.artist_txt.x =(mp3player.songBar.width + mp3player.songBar.x)/2
    	}
    ok. i don't know how to reverse the tween when it ends, how to create the loop and how to stop the tween if the else statement comes into play. i don't want to create the animation on timeline, all i want is code. so if you have any idea please help me. thanks in advance. cheers mate.

    ps: sorry for my bad english
    Last edited by andy310584; 04-24-2009 at 06:33 AM.

  2. #2
    a.k.a gltovar deadlock32's Avatar
    Join Date
    May 2001
    Location
    Naperville,IL
    Posts
    489
    If you can, I'd recommend using an external tweening engine such as tweenlite: http://blog.greensock.com/tweenliteas3/

    here is a basic tutorial on how to use it. the tween classes are also well documented as well. http://www.zedia.net/2008/actionscri...asic-tutorial/

Tags for this Thread

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