A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: transparency question

  1. #1
    Junior Member
    Join Date
    Mar 2004
    Posts
    12

    transparency question

    Hi.

    I have a number of buttons. Each one uses two images, one for Normal mode and one for MouseOver Mode (not in the event section). The Normal Image is set to 20% Alpha and the mouseover to 100%. This works nicely in the preview of 3DFA, but when I watch it in the browser (Flashplayer 6 on Opera), both images are displayed with 100% Alpha.

    What am I doing wrong?

    I'd also like to know how to use element("name").show() etc. instructions on image elements. this didn't work, simply closed the preview window. Well it worked in a script that is accessing an image that is loaded on the top level objects list, it didn't work as a Button OnMouseOver event with the Normal Button Image element.
    (BTW the Images are TGAs with an alpha channel, could this probably cause troubles with the main 20% Alpha setting ?)

    and is there a way to directly show(), hide() etc. a buttons Normal State Image element using the event handler? (AFAIK it has to be a movie or an Image on the top level, images referenced as Normal State element cannot be selected).

    Well basicly the first question is the most important to me since I got to finish a job that is using such ALpha stuff.

    Thanks a lot!

  2. #2
    Junior Member
    Join Date
    Mar 2004
    Posts
    12
    Uh, seems like I just answered myself one of my questions: The Image needs "Element has Properties" to be checked. then it's selectable from the action pulldown selection of a buttons event handler.

    Hmm - I think I already knew that some time ago, but then didn't do any Flash thing too long time

    Unfortunately this still don't solves my problem with the Alpha Transparency. I cannot set the entire Button to 20%, I only want it like this when the mouse is not over the button.

    Probably there is an element method that sets the Alpha value? Didn't find it yet.

    Well, now I tried Set Element Property (alpha) and it worked prefectly in the preview mode of 3DFA, but the Alpha command was completely ignored in the browser. Now I'll try it with some other browsers, maybe it works with an other flash player/browser.
    Last edited by johndoe321; 10-13-2004 at 06:04 PM.

  3. #3
    Senior Member zoranvedek's Avatar
    Join Date
    Aug 2001
    Location
    Wagoner OK
    Posts
    893
    Instead of showing the image, have it shown at all times and switch between alpha settings. Have it intially set at 0% and onmouseover set it to 20%. Can't guarantee that it will help, but I seem to remember having a similiar problem and that fixxed it. Seems there was something about showing an image that set it's alpha to 100%.........

    Could be completely wrong here, but it's worth a try.

    -J

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Showing an object is the same as setting it's alpha to 100 based on the way 3dfa handles it I think.

  5. #5
    Junior Member
    Join Date
    Mar 2004
    Posts
    12
    That's what I do. I use the Set Property function from the Actions dropdown menu of the button event handler to alter the Alpha transparency: 100% on mouseover and 20% on mouseout.

    It works in the Preview Window of 3DFA, but not in the Browsers, Opera and MSIE. It's 100% opaque all the time, no matter if I move th emouse over and out a button. The button uses an Image. The alpha of the image is then altered, as described before. It's a 32Bit TGA image.

    I really need to solve this problem. I mean, shouldn't it look the same way like the preview?
    Last edited by johndoe321; 10-15-2004 at 08:50 PM.

  6. #6
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Originally posted by johndoe321
    I really need to solve this problem. I mean, shouldn't it look the same way like the preview?
    wish I had a dollar for every time I've said that.

    Wow I just did experiment setting entire button alpha to 30 and on mouse over event setting this.alpha=100 and mouse out to this.alpha=30 and it did not work as expected either. you'd have to see it to believe it.

    Anyway to solve your problem you could always make two seperate graphics and load them into the button states. just use your paint program to lighten the one for the normal state.

  7. #7
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    Originally posted by blanius
    wish I had a dollar for every time I've said that.

    Wow I just did experiment setting entire button alpha to 30 and on mouse over event setting this.alpha=100 and mouse out to this.alpha=30 and it did not work as expected either. you'd have to see it to believe it.

    Anyway to solve your problem you could always make two seperate graphics and load them into the button states. just use your paint program to lighten the one for the normal state.

    this is not correct. it is working!!!
    visit my homepage -> ejected.de

  8. #8
    Junior Member
    Join Date
    Mar 2004
    Posts
    12
    Thanks a lot for your help. Finally I solved it. While setting the alpha of the image didn't work, it works when I set the alpha of the button itself.

    So I use

    SetProperty("buttonname").alpha=20
    on MouseOut events and
    SetProperty("buttonname").alpha=100
    on MouseOver events of the button event handler. Of course, the button needs "has Properties" checked.

    Btw. It's highly reccomended to use 32Bit TGA images since they contain Alpha information for each pixel seperately. So you can smoothly "blend" in things like lightnings or fog etc.

  9. #9
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    If you want to use JPG be sure that you save it NON PROGRESSIVE!
    visit my homepage -> ejected.de

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