Skip navigation
Currently Being Moderated

Logic Problem!

May 25, 2012 5:48 AM

Tags: #flash #cs5.5 #xml #actionscript_3.0

I want to display the lyrics while playing a song on the screen. Actual number of the lyrics should be dsiplayed on the screen are 3. and pass those lyrics line by line based on the time of song. Here I have to animate the current playing text word by word. How to get the current word in current line in current time?  (I divided and noted start time and end time of each word in xml file.)

 
Replies
  • Currently Being Moderated
    May 25, 2012 7:55 AM   in reply to bhargavi reddy

    I can think you can create a timer object class and use it as a timer, add an event every time the timer value change, to look if that value is for any child of the xml, if the condition match displays the word. Maybe this could consume many system resources, but can be done.

     
    |
    Mark as:
  • Currently Being Moderated
    May 29, 2012 9:57 PM   in reply to bhargavi reddy

    You need to create a motion tween that slides the text field on in. Once you create the tween, copy the motion tween code and put it in a function that you call when you play the lyrics. That appears to be  the  jist of what you probably need to do. If you want more detailed instructions check out http://edutechwiki.unige.ch/en/Flash_CS4_motion_tweening_with_AS3_tuto rial#Using_Copy_Motion_as_AS3

     
    |
    Mark as:
  • Currently Being Moderated
    May 30, 2012 7:49 AM   in reply to I_am_the_real_Z

    the problem no is the tween, the problem are the time to the tween.

     
    |
    Mark as:
  • Currently Being Moderated
    May 31, 2012 10:13 PM   in reply to bhargavi reddy

    Hmmm. Couldn't you create a timer that posts the words when they are supposed to appear. It would work by subtracting from the total amount of time of the song, so let's say we have a three minute song. We would express that as 30,000 milliseconds in the timer. So var yourtimer = new Timer(30,000,180); // 30,000 is three minutes and 180 is three minutes of loop. Trying to avoid an infinite loop. 

    Then you could bring in the new words with another variable, let's call it wordtime. You could set wordtime to any amount you want, but let's say there is a new word every second. You could put var wordtime:uint = 180; . Then once a new word appears on the screen you could go wordtime--; once wordtime is if(wordtime <= 0) trace("the song is over");  I am assuming you are pulling the words in via a server... am I right? I'll need to know a little more about your process on how you are pulling the words in to help you out.

     

    please note that you only need brackets for an if statement if you use more than one line of code. That isn't counting minified code. just one line like I did above with the trace.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 3, 2012 9:39 PM   in reply to bhargavi reddy

    Bhargavi,

    I did go to that site and looked in the top right. I didn't see any words going by just someone attempting at singing karaoke.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 4, 2012 1:14 AM   in reply to bhargavi reddy

    This is how it would work, you want x amount of words to appear on the screen. You grab all the words from the server and put them into an array. if you want six words to appear and the array has emptied 6 slots then remove those words from the screen and print out the next six words from the array. You would do this until the array is empty. I would reccommend using a for or while loop to do this. I am to tired to write out the code or even psuedo code. I hope this might be somewhat helpful.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 4, 2012 11:57 AM   in reply to bhargavi reddy

    Here is a tutorial on exactly what you are trying to accomplish! Please note you are reading from cache and not the actual webpage. The actual webpage either removed this article or changed the URL without a redirect. http://webcache.googleusercontent.com/search?q=cache:W8Ue0aFUb-EJ:www. toddperkins.com/2010/05/20/displaying-synced-song-lyrics-tutorial/+&cd =3&hl=en&ct=clnk&gl=us

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points