Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scratch off in flash 2

Status
Not open for further replies.

killbuzz

Technical User
Mar 21, 2001
103
US
hello, i was wondering how can i make a scratch off in flash? you know like the lottery tickets with something under after you scratch it.. Thanks for looking..
 
Try this...

Put the image you want to reveal on a layer and then on the layer above cover it with loads of instances of a small movieClip which completely hide the original image.

Each of these tiny mcs contains a solid colour fill and an invisible button with this action..

on(rollOver){
disappear=true;
}


the tiny clip which contains the button has this event attached...

onClipEvent(mouseMove){
if(disappear){
_visible=false;
}
}


When the movie starts off the bottom layer is completely hidden. As you mouse over the area every one of the tiny clips doing the hiding is turned invisible in turn and the bottom layer is revealed. If you design the tiny clips to have rough edges it looks more like a scratch card effect.

I've done a quick version, you can find it at
 
Pretty neat!
How many different mini clips did you use? And how many instances did you end up with?
Used a function? Or re-wrote the script that many times?
mywink.gif
ldnewbie
Hope that this
was helpful!
 
Just another wild thought!
Wouldn't it be possible to dynamically alter a mask with some drawing technique similar to an eraser?
mywink.gif
ldnewbie
Hope that this
was helpful!
 
There's about 50 mini clips. Sounds like a lot but since everything's done with a clipEvent it's not a problem: the variables are local so the clips don't interfere with each other and you don't have to give the clips instance names because they're self-contained and don't need to be addressed from the main timeline. As for rewriting stuff I just selected the clip and then dragged with "alt" held down to copy it - no typing required :) !

As for dynamically altering the mask I don't think it's possible: once the layer is configured as a mask layer it's locked and can't be altered. What you can do is put the mask into a movieClip and then mess about with the clip's propeties which will in turn affect the mask. Might be worth a bit of experimentation...
 
hey wangbar when i clicked on that link my nortons went off saying the temp internet file was infected with the NIMDA VIRUS i dont know if your infected or what but might want to check..
 
Hey wangbar thanks a bunch of the TIP man that works wonderful make sure you check on that NIMDA VIRUS hate to see good people like you guys to get a nasty VIRUS... I got another Question Is there a way i can make the movie i have with the scratch off have a icon for the pointer when is on the flash?? Thanks for the help
 
Thanks for the warning Killbuzz, I checked my PC and it's clean now.

 
Here's what you're looking for I think - has the updated version...

I added the "coin" mc and attached these events to it.

onClipEvent (load) {
startDrag ("", true);
_visible = false;
}
onClipEvent (mouseMove) {
if (_root._xmouse>140 && _root._xmouse<400 &&_root._ymouse>100 && _root._ymouse<300) {
_visible = true;
Mouse.hide();
} else {
_visible = false;
Mouse.show();
}
}


You could also use hitTest to check if the coin's in the right area rather than the x, y position of the mouse.
 
Wangbar,

I am getting the following message everytime I open up your link to the scratch example:

Scan type: Realtime Protection Scan
Event: Virus Found!
Virus name: W32.Nimda.A@mm(html)
File: C:\WINDOWS\Temporary Internet Files\Content.IE5\HIRTIGEJ\scratch[1].htm
Location: C:\WINDOWS\Temporary Internet Files\Content.IE5\HIRTIGEJ
Computer: JCLEMONS
User: jphillips
Action taken: Clean succeeded : Access allowed
Date found: Fri Sep 21 13:11:35 2001

Might want to check into that... luckily I have great virus protection.
Ya' Gotta Love It!
sleepyangelsBW.jpg
 
yeh i know, norton did not detect it and i had to dump some windows files that were infected from viewing that site..luckely i caught it in time..before it spread through my system..that's two viruses in the last month and a half..i'm getting a new virus program..any recomendations..
e.gif


carlsatterwhite@endangeredgraphics.com
 
Thanks Again Wangbar, coin thing worked great very smart when it comes to this stuff. im still getting the VIRUS on your site.. NIMDA VIRUS

killbuzz
 
Take it down Wangbar... Before you infect too many unprotected users!
mywink.gif
ldnewbie
 
It's down. I swept my PC and site for NIMDA 2 days ago and my virus software said it was all clear. I've checked it again with McAfee and I have 2000 infected files!

HTML content of the site is down for the time being while I put my PC back together - sorry if anyone caught anything nasty...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top