A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Scratch the top layer to show up the hidden image below

  1. #1
    Junior Member
    Join Date
    Jun 2002
    Posts
    14
    I want to create this effect ie " scratch the top layer to show the hidden image below". How do I?

  2. #2
    Procrastinator
    Join Date
    Oct 2000
    Location
    Osaka
    Posts
    138
    Do you mean like an on-line scratch card?

  3. #3
    Junior Member
    Join Date
    Jun 2002
    Posts
    14
    yeah, its more or less the same.

  4. #4
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    You could draw your background then put a movie clip on the layer above, that covers the picture over. Now in the movie clip start with the first frame being a solid block of colour (put a stop(); action in this frame) then make a frame by frame animation of the block being scratched off until the last frame is empty (put a stop(); action here too) now you can either place a hidden button in frame 1 of this clip (just draw the shape you want clickable in the hit frame of the button) and use the actions

    on (release) {
    gotoAndPlay(2);
    }

    or if you don't want the hand pointer to appear when the mouse is over the "scracthable" area you can use a clip event on your mc

    onClipEvent(mouseDown) {
    if (this.hitTest(_root._xmouse,_root._ymouse)) {
    if (this._currentframe == 1) {
    this.gotoAndPlay(2);
    }
    }
    }


  5. #5
    Junior Member
    Join Date
    Jun 2002
    Posts
    14
    hey thanks for your reply!

    but...

    I think you missunderstood my question or i was not able to explain my question properly. please find the question details below.

    i want to create the effect in which the user can scratch any areas of the movie at his own discreation just like we have scratch phone card to relieve pin numbers in real world. ie when he scratch's off the particular area of the movie with the help of mouse action the hiddenimage is visible only specific to that area. The user will have to scratch off the whole card with mouse action to see whole of the hidden image below.

    let me put it this way
    ...to scratch the top layer by mouse action ie moving the mouse over the picture while keeping the left button pressed, to show the hidden layer below.

    any input on this topic will be highly appreciated!

    Thanks

  6. #6
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,358
    can flash (5) do this? technically, no. Are there some work arounds? Yeah sure, kinda

    1) cover the image with a series of small buttons which dissappear on rollover (or by using mc's with hitTest)
    -problem is, based on how you manage your buttons/clips, more than likely you'll get this grid effect where its really noticable that you are doing exactly what you are doing and it can be processor heavy

    2) Something similar to 1, by masking the image and covering it with movieclips that, when near the mouse, react and are propelled away.
    -This one can be processor heavy depending on how many clips you use, and having clips with hitTest or using proximity calculations as opposed to buttons, can hurt performance more. This one might also be a little obvious in that you might not look like your scratching so much as waving your hand in a pool of spreading pond scum

    3)attaching masked clips of the revealed image as the mouse moves, adjusting the masked image (mc) to the appropriate position based on where that clip was attached (basic move mask prinicple)
    - problem there is that after a couple of swipes your flash movie will start to feel the pain of having so many attached masked clips of this image and start to slow down to a crawl. Also with this, there is no way to tell if the image is fully revealed or not as you would be able to with the buttons/hitTest


    alternatives: Director. Does this beautitully by manipulating the actual mask bitmap of a masked clip
    Otherwise you'll pretty much have to make due and play with tricks using placement and transparency to get an acceptable effect

  7. #7
    Junior Member
    Join Date
    Jun 2002
    Posts
    14
    how do i make button disappear so as to show the background/hidden image?




  8. #8
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,358
    put it in a movieclip and just say
    on(rollOver){
    _visible = false
    }

  9. #9
    Junior Member
    Join Date
    Jun 2002
    Posts
    14
    yep its working! thanks for the detailed explanation!
    it helped me a lot in understanding this.

    the effect is not exactly the same i want it to look like!... is it possible to create this effect using flash mx? as i learn flash mx supports dynamic masking... and i want to achieve the exact effect like we scratch of the layer above the image.

    any suggestion on how to go abt 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