Flash 6+ Scratch Card

In Progress Posted Sep 21, 2006 Paid on delivery
In Progress Paid on delivery

We've made a flash movie but need some help with a specific piece of the code:

The scratch card game is made up of a 4 frame movie. It uses 1 scratch panel movie clip, duplicated so that one scratch panel is a winning card and one is a losing card. There a 3 instances of the losing scratch panel and 1 of the winning panel spanning frames 1,2,3,4 of the movie.

What we need to do in the first frame of the timeline of the movie when it first loads is jump to a random frame from 1-4 giving the user a 1 in 4 chance of getting the winning scratch panel. We used the below script to handle the random bit...

gotoAndStop(random(3)+1);

When previewing the file in flash it works fine however through a browser (ie6 and Firefox tested so far), the script we have to scratch the card stops working occasionally. The script for the reveal (scratch) is...

onClipEvent(load)

{

[url removed, login to view]('square',0);

function drawSquare()

{

//attach coin cursor

startDrag([url removed, login to view], true);

x = _root._xmouse;

y = _root._ymouse;

with([url removed, login to view])

{

moveTo(x-0,y-0);

beginFill(0x000088)

lineTo(x+15,y-15);

lineTo(x+15,y+15);

lineTo(x-15,y+15);

endFill();

}

}

[url removed, login to view] ([url removed, login to view])

}

onClipEvent(mouseMove)

{

drawSquare();

updateAfterEvent();

}

The above script is in all 4 frames attached to the scratch panel movie clip.

SWF can be downloaded from: [url removed, login to view]

HTML can be viewed at: [url removed, login to view]

FLA on request

Adobe Flash

Project ID: #91176

About the project

3 proposals Remote project Active Sep 21, 2006