Jump to content


Photo

Flash - php / draw and save image with mysql


  • Please log in to reply
4 replies to this topic

#1 Sumpson

Sumpson

    Young Padawan

  • Members
  • Pip
  • 32 posts
  • Gender:Male

Posted 10 July 2007 - 11:50 AM

Hi, I would like people to be able to enter their signature with the mouse beneath a form, for this I need to be able to:

1. draw with line tool.
2. be able to save the image in database trough php.

For the first step I have found some tutorials ( http://www.flashvaul...orial.asp?ID=52 for example) but I could not find any tutorial for both of the steps, is anyone here able to guide me in the right direction?

thanks in advance,

Philippe

EDIT: this is what I would like to create; http://www.sanbax.com/sig/index2.php

Edited by Sumpson, 10 July 2007 - 11:58 AM.


#2 curthard89

curthard89

    Young Padawan

  • Members
  • Pip
  • 226 posts

Posted 15 August 2007 - 06:54 AM

By the looks of things the example sig box isnt flash.


Its possible yes, look into bitmapdata in flash :)

or bitmapdata to php.

Theres alot around, see what u find :P

#3 DarkSuiyoken

DarkSuiyoken

    Young Padawan

  • Members
  • Pip
  • 63 posts

Posted 18 August 2007 - 09:37 PM

What I would do is do a onMouseMove function then keep pushing the _x and _y values of the mouse into an array. Also, a value to determine if the mouse is pressed.

So what I would be pushing into the array is an array like this [_x,_y,1]. 1 means I'm actually holding down the left mouse button which means I'm drawing, 0 means I'm not.

After that, what you send to the database, is this big array.

#4 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 20 August 2007 - 10:38 AM

There are way more efficient ways to do that. The push method is pretty memory intensive. It would probably be better to start the onMouseMove event handler within an onMouseDown or onPress event, and destroy it onMouseUp on onRelease/onReleaseOutside. Cuts off the needing to hold the pressed value and takes out all that extra logic.

#5 DarkSuiyoken

DarkSuiyoken

    Young Padawan

  • Members
  • Pip
  • 63 posts

Posted 20 August 2007 - 10:43 AM

There are way more efficient ways to do that. The push method is pretty memory intensive. It would probably be better to start the onMouseMove event handler within an onMouseDown or onPress event, and destroy it onMouseUp on onRelease/onReleaseOutside. Cuts off the needing to hold the pressed value and takes out all that extra logic.


You'll still need to put something to seperate the data, to determine when the mouse was lifted up, if not, when drawing it in Flash again from the array, you will get a line from where you released the mouse, to where you next press the mouse down again.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users