How to record drawing strokes ?

hi,
My goal is to make a flash application that can do this things :
- basic drawing application (i can handle this part)
- record the strokes of the user
- save the datas that record each strokes in a single file, let's call it my-drawing-data-file
- load my-drawing-data-file back in the flash application
- playback my-drawing-data-file in order to watch a kind of movie which shows the drawing that "draw" itself
A good example of that application can be found on drawingnow.com. So i know it is possible but how...?
Any ideas how they make it ?

Hi,
Here is a very rough idea on how to record and playback drawing.
Capture the drawing:
- the drawing points are stored in an array "_pointArray"
- the json encoded string of "_pointArray" is posted to the server.
- In server-side, save the string to a file or database.
          private function mouseDownHandler(e:MouseEvent):void{
               //start new segment
               moveTo(stage.mouseX,stage.mouseY);
               //mark the point as starting point , "newline=true"
               _pointArray.push({x:stage.mouseX, y:stage.mouseY, time:getTimer(), newline:true});
          private function mouseMoveHandler(e:MouseEvent):void{
               if(e.buttonDown){
                    //draw line
                    drawLine(stage.mouseX, stage.mouseY);
                    //record the points
                    _pointArray.push({x:stage.mouseX, y:stage.mouseY, time:getTimer()});
          private function moveTo(x:Number, y:Number):void{
               this.graphics.moveTo(x,y);
          private function drawLine(x:Number, y:Number):void{
               this.graphics.lineTo(x,y);
          private function saveData():void{
               var json:JSONEncoder = new JSONEncoder(_pointArray);
               var urlVariable:URLVariables = new URLVariables();
               var urlRequest:URLRequest = new URLRequest('{URL_TO_POST_AND_SAVE_POINTS}');
               urlVariable.points = json.getString();
               urlRequest.method = URLRequestMethod.POST;
               urlRequest.data = urlVariable;
               var urlLoader:URLLoader = new URLLoader();
               urlLoader.load(urlRequest);
               urlLoader.addEventListener(Event.COMPLETE, saveCompleteHandler);
          private function saveCompleteHandler(e:Event):void{
               trace("Saved the animation");
Load and replay the animation:
- load the json string
- Decode the json string to array
- Play the animation
                         private function loadData():void{
                    var urlRequest:URLRequest = new URLRequest('{REQUEST_URL_TO_LOAD_POINTS}');
                    var urlLoader:URLLoader = new URLLoader();
                    urlLoader.addEventListener(Event.COMPLETE,loadCompleteHandler);
                    urlLoader.load(urlRequest);
               private function loadCompleteHandler(e:Event):void{
                    var loader:URLLoader = e.target as URLLoader;
                    var json:JSONDecoder = new JSONDecoder(loader.data as String);
                    _pointArray = json.getValue() as Array;
                    //start the animation
                    playAnimation();
               //Playback the drawing on an EnterFrame/Timer event
               private function playBackHandler(e:Event):void{
                    var nextPoint:Object = _pointArray[_currentIndex];
                    var nextMilliSec:Number =  nextPoint.time;
                    var timeLapsed:Number = getTimer() - _startTime;
                    while(timeLapsed >= nextMilliSec){
                         if(nextPoint.newline){
                              //stating point
                              moveTo(nextPoint.x, nextPoint.y);
                         }else{
                              //draw line
                              drawLine(nextPoint.x, nextPoint.y);
                         //next array index
                         _currentIndex++;
                         //reached the end?
                         if(_currentIndex >= _pointArray.length){
                              stopPlayBack();
                              break;
                         }else{
                              nextPoint = _pointArray[_currentIndex];
                              nextMilliSec =  nextPoint.time;
Manjith

Similar Messages

  • How to track paint strokes to video in Motion 5?

    Hi All,
    I have a video clip of me in front of the camera, drawing my name in the air with my finger. I would like to be able to make a paint stroke follow my finger and draw out my name. Because there is a lot of motion blur, I cannot motion-track my finger automatically. I just don't know how to paint the stroke in the exact place I need it. Can anyone help me to figure this out?
    Thanks,
    Adam

    As far as I know, one has to manually keyframe the motion track...
    Check the Motion 5 Manual page 1298...
    Regards
    Nolan

  • How do you draw a oval in cs6?

    How do you draw a oval in cs6?
    Thanks.
    Al

    Al-R wrote:
    Close but no cigar.  I just want to draw a one pixel oval but what I get now is a thick oval.  How do I draw a simple line?
    Al
    Wouldn't a one pixel oval be just a dot? Or are you meaning to say you want to draw an oval that has a one pixel wide edge?
    If the latter, then select the oval marque tool, draw your oval, then stroke (edit> stroke) the selection with a one pixel stroke, using the color off your choice.
    To draw a simple line:
    • use the Pencil tool, set the thickness in the options bar. Click where you want the line to start, then move your mouse to where you want the line to stop and shift-click to draw a straight line to that end point. PS will connect the two points with the line. Or you can free hand the line - just click and draw.
    • use the Path tool to draw your line, then pick your brush tool, set the pixel size, pick the color you want as your forground color, then in the Paths pallete drop down, select stroke path and pick the brush tool.
    • use the Line tool, inside the shape tool box. Lots of options, just need to experiement.

  • How much recording time on my iphone 4 voice memo?

    How much recording time on iphone4 voice memo?

    I would suggest that it depends on how much free space you have on the phone. I have done voice memos of over an hour before, and have read of other users reporting larger ones. I do not believe there is any documented source of what size you can do.

  • How to record my voice by headphone on mac mini

    Hi all,
    How to record my voice by headphone on mac mini. The headphone have a microphone. It can record on window 7, but on mac mini, it's not working.
    I don't know why. Please help me.
    Thanks.

    Open Quicktime Player
    File Menu: New Audio Recording....
    However... if the headphone/microphone combination has two 3.5mm jack plugs (pink and green) then the microphone output (pink) is "mic.level" - which is TOO QUIET for the audio input on a Mac, which is expecting the much stronger "line.level" signal strength.
    Solutions: get a microphone pre-amplifier between the mic and the Mac (not cheap); or a different microphone with a USB interface.

  • How can I set limitations on how many records a report can return

    I have a report on the web using Oracle Reports builder and I have the client enter in date parameters for the report that they want.
    Well with date ranges for different clients a different number of records are returned. Because of time it can take the report to return I want to limit the number of records that report can return.
    How can I go about doing that? I don't want to limit with date parameters because date won't really work for me. I need to limit on how many records can be returned. If it exceeds 10,000 records I want the client to refine the date range of schedule the report to run later. Meaning we will run that report. So I would have two check boxes if the count was over 10,000 do you want to define your date or schedule the job to run later.
    Can any one help me with this? How would I go about this?

    To know if the report is going to return more than 10,000 records, you first have to run the query with a 'select count(1) from ... where ...' (with the same from and where clauses as you normal query). Since this takes about the same time as runnng your report, I wonder if you really gain anything (although formatting may take some time too).
    You may simplify the select count(1) query by omitting all the lookup tables that are only needed for formatting. That way your query may run a lot faster. You can put this in your after parameter form trigger.

  • How can I draw image in a vbean?

    How can I draw image in a vbean?
    this is my code :
    import java.awt.BorderLayout;
    import java.awt.Image;
    import java.awt.Graphics;
    import java.net.MalformedURLException;
    import java.net.URL;
    import com.sun.jimi.core.Jimi;
    import oracle.forms.handler.IHandler;
    import oracle.forms.properties.ID;
    import oracle.forms.ui.VBean;
    public class PrintEmailLogo extends VBean {
         URL url;
         Image img;
         boolean ImageLoaded = false;
         public void paint(Graphics g) {
              if (ImageLoaded) {
                   System.out.println("yes~~~");
                   g.drawImage(img, 0, 0, null);
              } else
                   System.out.println("no~~~");
         public boolean imageUpdate(Image img, int infoflags, int x, int y, int w,
                   int h) {
              if (infoflags == ALLBITS) {
                   System.out.println("yes");
                   ImageLoaded = true;
                   repaint();
                   return false;
              } else
                   return true;
         public void init(IHandler arg0) {
              super.init(arg0);
              try {
                   url = new URL("file:print/77G.gif");
                   img = Jimi.getImage(url);
                   Image offScreenImage = createImage(size().width, size().height);
                   Graphics offScreenGC = offScreenImage.getGraphics();
                   System.out.println(offScreenGC.drawImage(img, 0, 0, this));
              } catch (MalformedURLException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    but when I run it in forms
    when it run Graphics offScreenGC = offScreenImage.getGraphics();
    It throw a exception:
    java.lang.NullPointerException     at com.avicit.aepcs.calendar.PrintEmailLogo.init(PrintEmailLogo.java:72)     at oracle.forms.handler.UICommon.instantiate(Unknown Source)     at oracle.forms.handler.UICommon.onCreate(Unknown Source)     at oracle.forms.handler.JavaContainer.onCreate(Unknown Source)     at oracle.forms.engine.Runform.onCreateHandler(Unknown Source)     at oracle.forms.engine.Runform.processMessage(Unknown Source)     at oracle.forms.engine.Runform.processSet(Unknown Source)     at oracle.forms.engine.Runform.onMessageReal(Unknown Source)     at oracle.forms.engine.Runform.onMessage(Unknown Source)     at oracle.forms.engine.Runform.processEventEnd(Unknown Source)     at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)     at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)     at java.awt.Component.dispatchEventImpl(Unknown Source)     at java.awt.Container.dispatchEventImpl(Unknown Source)     at java.awt.Component.dispatchEvent(Unknown Source)     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)     at java.awt.Container.dispatchEventImpl(Unknown Source)     at java.awt.Component.dispatchEvent(Unknown Source)     at java.awt.EventQueue.dispatchEvent(Unknown Source)     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)     at java.awt.EventDispatchThread.run(Unknown Source)
    I change it to:
    import java.awt.BorderLayout;
    import java.awt.Image;
    import java.awt.Graphics;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.swing.JFrame;
    import com.sun.jimi.core.Jimi;
    import oracle.forms.handler.IHandler;
    import oracle.forms.properties.ID;
    import oracle.forms.ui.VBean;
    public class PrintEmailLogo extends VBean {
         URL url;
         Image img;
         public void paint(Graphics g) {
              try {
                   url = new URL("file:print/77G.gif");
                   img = Jimi.getImage(url);
                   g.drawImage(img, 0, 0, this));
              } catch (MalformedURLException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         public void init(IHandler arg0) {
              super.init(arg0);
    But it display nothing.
    It isn't paint continuous.
    what's wrong in my vbean?
    please help me.

    The following code works fine for me:
    package oracle.forms.fd;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import oracle.forms.handler.IHandler;
    import oracle.forms.properties.ID;
    import oracle.forms.ui.CustomEvent;
    import oracle.forms.ui.VBean;
    public class test extends VBean {
      private URL url;
      private URL m_codeBase; 
      private Image img;
    public void paint(Graphics g) {
      // draw the image
      g.drawImage(img, 0, 0, this);
    public void init(IHandler arg0) {
       super.init(arg0);
       // load image file
       img = loadImage("file:///c:/coyote.jpg");   
    public test()
        super();
       *  Load an image from JAR file, Client machine or Internet URL  *
      private Image loadImage(String imageName)
        URL imageURL = null;
        boolean loadSuccess = false;
        Image img = null ;
        //JAR
        imageURL = getClass().getResource(imageName);
        if (imageURL != null)
          try
            img = Toolkit.getDefaultToolkit().getImage(imageURL);
            loadSuccess = true;
            return img ;
          catch (Exception ilex)
            System.out.println("Error loading image from JAR: " + ilex.toString());
        else
          System.out.println("Unable to find " + imageName + " in JAR");
        //DOCBASE
        if (loadSuccess == false)
          System.out.println("Searching docbase for " + imageName);
          try
            if (imageName.toLowerCase().startsWith("http://")||imageName.toLowerCase().startsWith("https://"))
              imageURL = new URL(imageName);
            else if(imageName.toLowerCase().startsWith("file:"))
              imageURL = new URL(imageName);
            else
              imageURL = new URL(m_codeBase.getProtocol() + "://" + m_codeBase.getHost() + ":" + m_codeBase.getPort() + imageName);
            System.out.println("Constructed URL: " + imageURL.toString());
            try
              img = createImage((java.awt.image.ImageProducer) imageURL.getContent());
              loadSuccess = true;
              System.out.println("Image found: " + imageURL.toString());
              return img ;
            catch (Exception ilex)
              System.out.println("Error reading image - " + ilex.toString());
          catch (java.net.MalformedURLException urlex)
            System.out.println("Error creating URL - " + urlex.toString());
        //CODEBASE
        if (loadSuccess == false)
          System.out.println("Searching codebase for " + imageName);
          try
            imageURL = new URL(m_codeBase, imageName);
            System.out.println("Constructed URL: " + imageURL.toString());
            try
              img = createImage((java.awt.image.ImageProducer) imageURL.getContent());
              loadSuccess = true;
              System.out.println("Image found: " + imageURL.toString());
              return img ;
            catch (Exception ilex)
                    System.out.println("Error reading image - " + ilex.toString());
          catch (java.net.MalformedURLException urlex)
            System.out.println("Error creating URL - " + urlex.toString());
        if (loadSuccess == false)
          System.out.println("Error image " + imageName + " could not be located");
        return img ;
    }Francois

  • How do you draw a tie of two notes in the score editor window

    How do you draw a simple tie in the score editor window of Logic Pro 10 ; two quarter notes together, an eighth up-beat accross a bar line into the next measure etc? I can't find the answer in videos, help manual.  Please give a step by step how to do it.
    It's hard to believe that a program like Logic, that has more information than the New York Public Library, does not have a simple solution for tieing notes. Maybe Logic XI will have one, or "Logicians" can speak to Sibelius for a more "note-worthy" way to solving the problem so that the score editor can be more accessible for editing purposes for those that read and write manuscript. Lew Traver

    Hi
    Ties are generally automatically created as necessary. Simply adjust the length of the note in the Score (using DurationBars or the Inspector), or in the Piano Roll or Event list.
    CCT

  • How to record a phone call in my iphone?

    how to record a phone call in my iphone?

    That's not a feature of the iPhone. You would have to route your calls through a 3rd party service to do so.

  • CAN YOU PLEASE TELL ME HOW TO RECORD AN ACTION IN PSE 7?  I WANT TO DO SAME ACTION ON WHOLE BATCH.

    COULD YOU PLEASE EXPLAIN  HOW TO RECORD AN ACTION IN PSE 7?  I AM WANTING TO PUT MY BUSINESS NAME ON ALL MY PHOTOS & WANT TO DO IT @ THE SAME TIME INSTEAD OF INDIVIDUALLY.  I KNOW IT WILL SAVE A LOT OF TIME.  THANKS SO MUCH!!

    Check this out:
    http://www.easysector.com/index.php

  • How to record from the video in or S-video Ports on Qosmio G40?

    Can anyone tell me how to record from the video in or S-video ports, because i've tried the Ulead DVD factory program and the only capture device it could see was the webcam, and it did capture from it
    After that i've downloaded the update file that was provided by the support website
    The devices that the program could see are the TV tuner and the webcam (which it couldn't access anymore for some reason)
    After that i've downloaded a newer update which simply is the same as the last update and seems that someone in the support website directed the link of the new update which they don't have to the file of the previous update which doesn't really do anything.

    Hi
    There are 2 s-video ports; s-video out port is not designed to capture the signals from any external source. The name of this port says everything; its an OUT port!
    The s-video-in port must be placed at the right side of the notebook. Dont mix the both ports. But note; this port receives only the video signals. To hear the sounds, use a video cable to connect the sound terminals of the audio device and your computer.
    Red: sound right channel
    White: sound left channel
    The Ulead DVD Movie factory can be used to capture this signal.

  • How to record a simple sidebar video as in Adobe Presenter 7

    In Adobe Presenter 9, how to record a video with my webcam to put as a sidebar video for one slide ?
    In Presenter 7 we could do that easily.  Now with the new video editer we can make great videos and capture the screen.  But that's not what need...
    How to do a simple sidebar video without capturing the screen...
    Look at the point 4 on this website: http://help.adobe.com/en_US/Presenter/7.0/WS56318F3C-65A7-477b-8CAA-2CBF0902BA5B.html
    3-...Capture video...
    4-...then select... ...sidebar video to record video for the Presenter image area.
    It was easy in Presenter 7 !!!!!!!!!!!
    Thanks

    When you use the video recording feature in Presenter 8+, it does record a stand alone WMV of your webcam. While the workflow isn't as clean as before, it can be inserted back in just as a sidebar video, without the background screen capture. Here is how you can do it:
    Use the Presenter Video Creator to record your video. Disregard that your screen is being captured, you won't use it.
    After you record your video, Save your project. Don't publish it, as the published output is useless to you.
    Back in Presenter, choose to Insert Video.
    Browse to your webcam capture (My Documents > My Adobe Presenter Video Projects > {What ever you named the capture} > mt). Should be named something like presenter_video1.wmv
    Presenter will convert it to FLV, you can select the quality and location, slide or sidebar, as in previous versions of Presenter.
    If desired, you can use a 3rd part video conversion tool to convert the WMV video, but that may not be necessary.

  • Is there any limit on how many records a cursor can hold?

    Hi Everyone,
    This is Amit here. I want to know whether there is any limit on how many records a cursor can hold.
    I have a program in which i am creating a cursor and passing it to another procedure as an input parameter. But the count of cursor query is more than 15 Lakhs. The program is running forever.
    Just wanted to know whether the huge data is the problem.
    Thanks ....
    Regards,
    Amit

    user13079404 wrote:
    Just wanted to know whether the huge data is the problem.What do you think? How long does your code typically need to wait for the data to leave the magnetic platter of the harddisk, travel across wires and into the memory buffer of your application - for a single row?
    Now multiply that waiting for I/O time with a million - for a million rows. Or by a billion, for a billion rows.
    Is "+huge data+" a problem? Not really - it simple needs more work to get that amount of data from disk. More work means slower performance. It is that simple.
    Which is why the row-by-row approach used by many developers is wrong. You do not pull a million rows from disk and process it in PL/SQL or Java or .Net. Heck, you do not even pull 10,000 rows like that.
    The correct approach is to think data sets and use SQL to process that for you - and only return the bare minimum of data to the application layer. Maximize SQL. Minimize PL/SQL and Java and .Net.

  • How do I draw a circle in MUSE?

    How do I draw a circle in MUSE? Holding shift&rectangle tool (as in InDesign) isn't working.

    obcomm - Use the Rectangle tool to draw a square. Click the corner options in the Control toolbar, then increase the size until you have a circle.
    David

  • Flex 3 How to recording the voice to the local file.can u help sample souce code

    How to recording the voice to the local file.can u help sample souce code

    What? the link is not opening? Check once properly man.  If you need code here it is
    import flash.system.Security;
    import flash.media.Microphone;
    import flash.events.ActivityEvent;
    import flash.events.SampleDataEvent;
    import flash.events.StatusEvent;
    import flash.utils.ByteArray;
    import flash.media.Sound;
    import flash.events.MouseEvent;
    import flash.media.SoundChannel;
    import flash.events.Event;
    import org.bytearray.micrecorder.encoder.WaveEncoder;
    import flash.net.FileReference;
    var mic:Microphone;
    var soundBytes:ByteArray;
    var recBytes:ByteArray= new ByteArray();
    var sc:SoundChannel;
    var sound:Sound;
    recordBtn.addEventListener(MouseEvent.CLICK, getMic);
    stopBtn.addEventListener(MouseEvent.CLICK, stopRecording);
    playBtn.addEventListener(MouseEvent.CLICK, plays);
    saveBtn.addEventListener(MouseEvent.CLICK, saveAudio);
    function getMic(e:MouseEvent)
    soundBytes= new ByteArray();
    //returns an array that total mics available
    var totalMics:Array = Microphone.names;
    //mic is a singleton class gets microphone to record sound
    mic = Microphone.getMicrophone();
    //Sets the minimum input level that should be considered
    mic.setSilenceLevel(0);
    mic.rate = 44;
    //to capture microphone audio listen for this event
    mic.addEventListener(SampleDataEvent.SAMPLE_DATA, recordAudio);
    function recordAudio(e:SampleDataEvent)
    //capture the byte array data available with the event
    while (e.data.bytesAvailable)
    var soundData:Number = e.data.readFloat();
    soundBytes.writeFloat(soundData);
    function stopRecording(e:MouseEvent)
    mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, recordAudio);
    //set the bytearray position to zero for playing from starting
    soundBytes.position = 0;
    function plays(e:MouseEvent)
    //intatiazle sound instance
    sound= new Sound();
    soundBytes.position = 0;
    //listen for the event when runtime requests new audio data.
    sound.addEventListener(SampleDataEvent.SAMPLE_DATA, playAudio);
    //play the sound with sound channel
    sc = sound.play();
    sc.addEventListener(Event.SOUND_COMPLETE, soundComplete);
    function playAudio(e:SampleDataEvent)
    //if audio bytes is greate than 4 read the recorded byte array data and write it into the sound
    for (var i=0; i<8192; i++)
    if (soundBytes.bytesAvailable > 4)
    var sample:Number = soundBytes.readFloat();
    e.data.writeFloat(sample);
    e.data.writeFloat(sample);
    function soundComplete(e:Event)
    sound.removeEventListener(SampleDataEvent.SAMPLE_DATA, playAudio);
    sc.stop();
    function saveAudio(e:MouseEvent)
    soundBytes.position = 0;
    //waveencoder class used to encodes bytearray data properly used to play properly after saving
    //you can get this api from below link
    //http://code.google.com/p/micrecorder/downloads/detail?name=MicRecorder%201.2.zip&can=2&q=
    var encod:WaveEncoder= new WaveEncoder();
    var byte:ByteArray = encod.encode(soundBytes,2);
    var file:FileReference= new FileReference();
    file.save(byte, “test.wav”);

Maybe you are looking for

  • Excise is not calculate in invoice verification

    Dear All, I have one issue. We have create purchase order for project with account assignment category Q. We put excise (10.30) & Vat 15% in purchase order. In purchase order all value calculate properly. Good Receipt created against purchase order.

  • How to restore an iOS 7 backup, on an iPhone running iOS 6.1.4?

    I was using iOS7, since tha release of the first beta version. Before sent my iPhone 5 to Apple for tech support i did a backup in iCloud. They returned me another phone, so I have an iOS 6.1.4 that doesn't allow me to restore iOS7 and I can't recove

  • Airport Express speakers not showing in itunes

    Hi, I had my Airport express working nicely, but then (foolishly), played around with it a bit and I'm now in a world of pain. I have a G5 imac talking to an AE base station hooked to a DSL router and my stereo. What's not working: 1. The remote spea

  • Will there be a new update for ipod 5

    I got the ipod 5 like 7-8 months ago and i have been updating every time so i was wondering if there well be a new update for it please answer as soon as possible thanks

  • Impossible d'activer iMessage

    Bonjour à tous,Alors voilà le souci : j'ai un ami, possesseur d'un iPhone 4 (iOS 5.0.1) et il lui est impossible d'activer iMessage, quand il le fait il a un message d'erreur (voir photo jointe) et effectivement il ne peut pas en envoyer ou en recevo