A Flash Developer Resource Site

Results 1 to 20 of 20

Thread: on rollover - change color of text in dynamic box (possible?)

  1. #1
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    Hey Everyone,
    Okay here is what i have:
    I have a dynamic text box that has a bunch of text in it. Different words in the text have different links... well, they are actually a asfunctions, but they are still links. Is it possible, that on rollover of the specific 'link' in the text box, that text changes colors? Thanks in advance.

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    any ideas?

  3. #3
    Junior Member
    Join Date
    Apr 2002
    Posts
    3

    Cool

    i'm trying to do the same thing with an input text box and a dynamic text box...any text color changes i make on my stage never keep after i test and/or export my movie....HELP!!!

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Don't think that's really possible in a standard dynamic textbox! Roll overs are not detected!

  5. #5
    Senior Member
    Join Date
    Apr 2002
    Posts
    157

    check this out...

    hey guys, i found this thread searching for someone who had done exactly what you guys are all trying to do. you should be able to figure it out from this:

    http://board.flashkit.com/board/show...hreadid=286865

    if you haven't already, nestle your dynamic text fields inside of a movie clip and then use the code in that link to set the color of the entire movie clip (will only affect any content of the clip). hope that helps, i've got mine working!

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Don't think that would work for trikenit though!
    My understanding is that he only wanted some words (links) to change color on a rollover in the dynamic textbox, and not the overall text color.

  7. #7
    flashing since v3
    Join Date
    Jan 2002
    Posts
    401
    oldnewbie, how soon you forget the advantages of invisible buttons...

    people, adhere to my words....

    invisible buttons are the nuts

    yeah ummm anyway, place an inviz button over the text field and shove the A/S in that

  8. #8
    Senior Member
    Join Date
    Apr 2002
    Posts
    157

    oh yeah...

    so i didn't read it too closely

    anyway, he could set the different links as separate dynamic text boxes inside of movies i think. it might take a fair amount of parsing depending on what is generating the text, but at least it would work (i think)

  9. #9
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    offdahook...
    Out of genuine interest, is it possible for you to work out a quick example of that? All of it in trikenit's post perspective!

  10. #10
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    that actually seems like a pretty good idea (the invisible button)...
    there is only one problem though. its a dynamic text box... with a scroll bar =). so as you scroll downward, the postion of the text changes.

  11. #11
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    i guess ill just show you my project so you get a better perspective of my objective here. go to http://server.trikenit.com:81/us
    then click the enter site link... (the intro isnt there; this is my personal server that i put my works in progress on). so when the new window comes up, you will be able to choose the sections from the top, choose the galler (the camera) and then you will see a dynamic text box with a scroll bar come up on the right side. for a temporary (and possibly permanent measure) i changed the color of the words that are links to open the pictures. (the pictures all work, so you can click and see what i mean). so the text with the blueish colors are the ones that id like to change color on rollover. i dont believe its possible, but i thought it wouldnt hurt to ask. =)

    ps i have no problem with doing some serious coding to get this to work.

    pss since im showing the site im working on anyways, what do you guys think? (all of the info is up, but the layout is done)

  12. #12
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Questions:
    Is this text loaded from a text file, or could it be at some point & time?
    Presently using html tags for those color changes?

  13. #13
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    well, i dont have it load from a text file now... i could.. but i think i understand what you are saying. would flash recogonize some roll over tag? what do you suggest?

  14. #14
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Until I get a working example by offdahook of his use of invisible buttons in this particular situation... Was just woundering if somehow updating the content of the textfield's variable (with a new color on a particular link) would be fast enough so that it's not noticable?
    If it did work, then my next concern, was that it probably wouldn't from a text file, since re-loading a text file would obviously take more time. Then there's the question... Would you want the original color restored on a roll out? In fact, it wouldn't be through roll overs or roll outs, but through "a href" tags that I would of tried out my thinking.

  15. #15
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    yea, making it change back to the normal color on 'rollout' would be like a key thing. for it too look like a rollover effect.

  16. #16
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Why did you have to answer that?
    Here's another thought...
    Ever thought of trying a scrollpane to do this?
    Might be easier!

  17. #17
    Senior Member
    Join Date
    Apr 2002
    Posts
    157
    i like your design a lot, very clean... good job

    now, how much updating are you going to have to do to the text fields you are talking about. the gallery section doesn't strike me as something that is going to have to be updated too frequently so why don't you just use a scroll pane on a movie clip that uses invisible buttons?

  18. #18
    Senior Member
    Join Date
    Nov 2000
    Posts
    316
    hrmmm.. never thought to use a scroll pane.. (actually never used one before - haha)... and, you're right, i wont be updating the gallery at all (basically). with the invisible buttons, would i just put the button on top of the text and make invisible.. then on rollover the word (in a different color) shows up? it seems like this would be too much work for such a minor thing, especially since my gallery works perfectly now.

  19. #19
    Senior Member
    Join Date
    Apr 2002
    Location
    Hong Kong
    Posts
    171
    After a couple of days work I am going down a diferent path, but this because I have many different texts that might be displayed so I cannot use preset button positions.

    The closest I have come is to read the text from a file and put tags round the links that give an ID or (in trikent's case a picture reference). When I read the text I parse it so that I build an array of field IDs with a start and end character position. Then, I can use setTextFormat on the textField with these start and end positions to change just the color of these links.

    So the text is something like
    "When the [link ref=13]duck[/link] approaches the [link ref=14]goose[/link] feathers can fly."

    It gets parsed into a bit of straight text
    "When the duck approaches the goose feathers can fly."
    and an array
    Links[0].ref = 13, .start=9, .length=4
    Links[1].ref = 14, .start=29, .length=5

    then in a (onRollOver) function I can loop with
    HighlightedStyle = new TextFormat;
    HighlightedStyle.underline = true;
    myTextField.setTextFormat(Links[j].start,Links[j].start+Links[j].length, HighlightedStyle

    I can also react to the user clicking on the link by checking the Selection.getCaretIndex() against the Links array and then using the .ref from that. The one thing that you lose though is the mouse changing to a finger when you are over the field. Does this make any sense?

    (The text file is actually XML but I can't type \< and \> in the posting without a lot of trouble, same as I always want to illustrate index arrays with i, but that just sets everything to being italics!)

  20. #20
    flashing since v3
    Join Date
    Jan 2002
    Posts
    401
    Originally posted by trikenit
    hrmmm.. never thought to use a scroll pane.. (actually never used one before - haha)... and, you're right, i wont be updating the gallery at all (basically). with the invisible buttons, would i just put the button on top of the text and make invisible.. then on rollover the word (in a different color) shows up? it seems like this would be too much work for such a minor thing, especially since my gallery works perfectly now.
    thats what i'd suggest... the invizible buttons would work normally, just didnt realise you was scrolling text
    so there really is no solution

    use a scroll pane and keep a dyn txt field inside it

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