Thanks James! I have understood your suggestions, but I'm not quite sure how I can make the Alpha channel white, do I have to do it with Director or with another imaging software and how?? I have created a 32 bitmap graphic with Photoshop with color yellow then I have created an Alpha channel that I made white always with Photoshop then I have imported it inside Director and placed on the following sprite channel of the text member but it's only covering it and doesn't became transparent.
What am I doing wrong? Thanks again Teo >\Teo Petralia <[EMAIL PROTECTED]> wrote: > > > I'm trying to do an exercise where the user click on a word and > > that word and the previous one (usually but not necessarily is > > the previous one) is highlighted, then the user click on another > > word always in the same paragraph and that word+previous is > > highlighted too, I would like that all the clicked words remain > > highlighted and not only the recent one. > >Hi Teo, > >If you are going to need two separate highlights in the same block of text, >you will not be able to use the hilite or selection keywords (for fields and >text respectively). > >Instead, you can use Imaging Lingo, through a 32-bit bitmap member in a >separate sprite. Make the bitmap member the colour you want the hilite to >appear in, and set its alpha channel to white. The bitmap sprite will now >be invisible. If you set chunks of the alpha channel to grey, the hilite >colour will appear at those spots, in a semi-transparent fashion. > >You'll find below a behavior that does this for a text member. It expects >to find a bitmap sprite in the following channel. > >Cheers, > >James > > >---------------------------------------------------------------------------- > >property mySprite -- sprite(me.spriteNum) >property myMember -- Text member of mySprite >property myLineHeight -- Assumes fixed line height >-- >property myBitmap -- Bitmap member in sprite in following channel > > >on beginSprite(me) > mySprite = sprite(me.spriteNum) > myMember = mySprite.member > > -- Assume fixed line height in myMember > myLineHeight = myMember.charPosToLoc(1).locV - 1 > > -- Prepare the bitmap member in the following sprite > tSprite = sprite(me.spriteNum + 1) > tSprite.loc = point(mySprite.left, mySprite.top) > myBitmap = tSprite.member > tHilite = image(mySprite.width, mySprite.height, 32) > tHilite.fill(tHilite.rect, rgb(0, 0, 255)) -- Blue hilite > tHilite.setAlpha(0) > tHilite.useAlpha = TRUE > myBitmap.image = tHilite > myBitmap.regPoint = point(0, 0) >end beginSprite > > > >on mouseUp(me) -- Permanently hilites the word under the mouse > tWord = mySprite.pointToWord(the mouseLoc) > tChar2 = myMember.text.word[1..tWord].char.count > tChar1 = tChar2 - myMember.text.word[tWord].char.count > > tLoc1 = myMember.charPosToLoc(tChar1 + 1) - [0, myLineHeight] > tLoc2 = myMember.charPosToLoc(tChar2 + 1) > > tRect = rect(tLoc1, tLoc2) > > tHilite = myBitmap.image.extractAlpha() > if tHilite.getPixel(tLoc1) = paletteIndex(0) then > -- Hilite the word > tColor = rgb(128, 128, 128) -- 50% transparency > else > -- A subsequent click removes the hilite > tColor = rgb(255, 255, 255) > end if > > tHilite.fill(tRect, tColor) > myBitmap.image.setAlpha(tHilite) >end mouseUp > >[To remove yourself from this list, or to change to digest mode, go >to http://www.penworks.com/lingo-l.cgi To post messages to the >list, email [EMAIL PROTECTED] (Problems, email >[EMAIL PROTECTED]). Lingo-L is for learning and helping with >programming Lingo. Thanks!] [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
