Skip to main content
Known Participant
March 25, 2013
Question

how to create a matching game by drawing a line !

  • March 25, 2013
  • 2 replies
  • 4869 views

hi

i want to create a matching game by line

the idea is a scene contain list in righ and list in left

and the user drow a line between the two list

what is the code that create a line in specific point to another specific point

or any other solution to achive the same idea !

This topic has been closed for replies.

2 replies

Inspiring
March 25, 2013

There was similar question before - see my answer in the thread:

http://forums.adobe.com/message/4632809

Known Participant
March 25, 2013

well i saw both links but i didint catch any thing to understand

i have 4 movie clips on the left and 4 on the right

on the drag and drop codes

i want when drag a line starts and till he reach the right target with mouse

and drop the mouse so the line complete

and when it reach the wrong distination

a wrong msg appers (alpha = 1);

Nabren
Inspiring
March 25, 2013

Look at the graphics object for drawing: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics.html

It's accessible through Sprite.graphics and MovieClip.graphics.

Your basic idea would be:

object.graphics.lineStyle(3);

object.graphics.moveTo(startX, startY);

object.graphics.lineTo(finalX, finalY);

For you startX and startY would be where the mouse was down initially (or your target point for first list) and the finalX and finalY would be where the user released the mouse (or your target point for the second list)

Inspiring
March 25, 2013