A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Dynamic Text marquee/scroll?

Hybrid View

  1. #1
    Junior Member
    Join Date
    Dec 2006
    Posts
    3

    Dynamic Text marquee/scroll?

    Hello there!

    I was wondering if any of you savi people could help me with a little problem I have.....

    I am making a Music player (By importing outside SWF's with the music imbedded).

    I have made it so that when I press a button it plays a track and using ACTIONS-Set dynamic text control, the appropriate title is shown in my "txt1 box" . Eg "Placebo-Infrared".

    That is all fine.

    But i would like this text to marquee (much like the motion script ticker tape).

    I tried this by accepting "yes" to the "Has html" contol in the txt1 propieties, and then putting "<marquee>placebo-infrared</marquee>" this didnt work.

    I then tried putting in much more html code:

    "<body>

    <p>
    <marquee>placebo-infrared</marquee>
    </p>

    </body>"

    Still doesn´t work

    I´m no expert at HTML coding.. so I can´t really understand why it doesnt work.


    Do i have to use Javascript? Actionscricpt? or is my HTML coding just useless?

    Or is it actually possible...if it isn´t sorry for wasting your time!!


    Thanks glen

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    HTML in flash is limited, this is not the way to go at it.

    You could script it in Actionscript. get the length of the string then use string slicing to take the part you want to see at that moment and show it in your textbox. I'll see if I can do an example.

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    turned out a little more complicated then I thought but here goes.

    put a text field named txt1 on the stage and try this
    code:

    myText="Now is the time to show my text in a marquee way"

    l=15 //Length of text we want to show
    x=0 //where to start in the string

    stringOf=function(c,l){//function to create a string of characters
    var temp="" //This is a function I'm used to having in other languages.
    for (var x=0;x<l;x++){
    temp+=c
    }
    return temp
    }

    myText=stringOf(" ",l)+myText//add l number of spaces to the beginning of the string

    display=function(){//Function to show text

    var temp=myText.slice(x,l);//l=length you want to show
    txt1.text=temp//put the text in the text box
    x++//move up one in the text
    l++//where to stop in the text see syntax for "slice" command
    if (x==myText.length){//if we reach the end of the string
    x=0 //reset the variables
    l=15
    }

    }

    setInterval(display,200)//setInterval runs a function on a continuous basis

    stop()


  4. #4
    Junior Member
    Join Date
    Dec 2006
    Posts
    3
    Wow thats great! Thank you ever so much !!

    Just one more question...Is there a way to change the speed?

    Don't worry if there isn't you've been a great help Mr Blanius

    glen

  5. #5
    Junior Member
    Join Date
    Dec 2006
    Posts
    3
    Oh don't worry i've found out how to do it!!!!

    sorry!!

    Thank you very very much!!

    glen

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