A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 30

Thread: Wanna see a neat new trick with MX?

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Posts
    273
    This is a generic bit of code that is from a mouse tutorial I wrote for VC++. With some changes, it now works in Flash MX.

    Just add this code to the first keyframe on your main movie timeline and set your movie background to be black.

    Code:
    _root.onMouseDown = function()
    {
    	_root.draw = 1;
    	newX = _root._xmouse;
    	newY = _root._ymouse;
    	moveTo(newX, newY);
    }
    _root.onMouseUp = function()
    {
    	_root.draw = 0;
    }
    _root.onMouseMove = function()
    {
    	if (draw)
    	{
    		oldX = newX;
    		newX = _root._xmouse;
    		oldY = newY;
    		newY = _root._ymouse;
    		
    		lineStyle(8, 0xFFFFFF);
    		lineTo(newX, newY);
    	}
    	updateAfterEvent();
    };
    Let me know if you think it's neat or not, I like it. Just run it, then click and drag your mouse around the screen.

    Spyder


    Here's a link to a finished version of it:

    http://perfectweb.org/chalkboard.html


    [Edited by NetSpyder101 on 03-16-2002 at 09:41 AM]

  2. #2
    Junior Member
    Join Date
    Aug 2001
    Posts
    28
    very nice i like it a lot.
    thanx for sharing.
    Pet

  3. #3
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    Sweet !!

  4. #4
    Senior Member
    Join Date
    Sep 2000
    Posts
    273
    Ok -- just because I was bored at work before leaving:

    I've added in a small color palette and a size adjuster for painting. I'm happy to give the .fla to anyone who wants it.

    Spyder

    http://perfectweb.org/chalkboard.html

  5. #5
    Senior Member
    Join Date
    Sep 2000
    Posts
    273
    When you use the lineto function (whether you are using a fill, a gradient fill, or no fill at all), it doesn't take long for flash to hog up a lot of memory (we all remember the problems with drawing too many detailed graphics onto the screen with a slow system in Flash 5).

    Just keep that in mind when you are using the lineto function to have it automatically draw animation. the clear() function wipes out all previous drawings to the screen, allowing you to free memory and start fresh.

    Spyder

  6. #6
    Junior Member
    Join Date
    Nov 2001
    Posts
    7
    Very nice! Will you send me the .fla? My email address is binaryboy@popmail.com.

  7. #7
    Member
    Join Date
    Feb 2002
    Posts
    34
    I like that alot

  8. #8
    Senior Member
    Join Date
    Sep 2000
    Posts
    273
    If you want the .fla --

    http://perfectweb.org/drawing.fla

    enjoy

    Spyder

  9. #9
    Junior Member
    Join Date
    Nov 2001
    Posts
    26

    Very cool!

    It would be neat if you could 1) export it as a jpeg, and 2) send it in email!

  10. #10
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282

    Re: Very cool!

    Why send a non active jpeg ?

    Send the .swf baby !!

  11. #11
    Junior Member
    Join Date
    Nov 2001
    Posts
    26

    Re: Re: Very cool!

    Originally posted by estudioworks
    Why send a non active jpeg ?

    Send the .swf baby !!
    Sure you could. I was just thinking of it as a simple tool for sketching and sharing ideas. As a jpeg it could easily be viewed in the contents of email. (Hmmmm...can an swf be viewed in email? I've never had any luck with it.)

  12. #12
    Senior Member william_tropico's Avatar
    Join Date
    Nov 2001
    Posts
    429
    Very coooooooooooool

    thanks NetSpyder101,
    I only got flash MX yesterday and that will
    probably be the best thing i have seen for ages.


  13. #13
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282

    Re: Re: Re: Very cool!

    Yes it can !!

    And the jpeg would me static !!

  14. #14
    Junior Member
    Join Date
    Nov 2001
    Posts
    26

    Re: Re: Re: Re: Very cool!

    Originally posted by estudioworks
    Yes it can !!

    And the jpeg would me static !!
    Me so sorry. I think I didn't make myself clear. I was thinking that one could use the tool to draw something and then export the resulting drawing and send it to interested parties.

  15. #15
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282

    Re: Re: Re: Re: Re: Very cool!

    Oh, I gotcha !!

  16. #16
    Junior Member
    Join Date
    May 2001
    Posts
    9

    An extension of...

    First off: Great idea/use of new features of Flash MX

    However, I tried to extend it, to test weather it could be used with maskes, that it is, I changed the code by removing the _roots from the the draw flag, and put it inside a clip, that acted as a mask. The second I tried this, flash promtly crashed, I have tried this the other way round(ie: with set make, but dynamic masked content), but it still didn't work. Has anyone got any solution to this problem?

    Finally, is that VC tutorial online, because I would definatly like to read it.

    Thx again for the interesting code which will undoubtedly be reused many times.
    [Edited by Ba'alzamon on 03-19-2002 at 03:25 AM]

  17. #17
    Brian Monnone
    Join Date
    Jul 2000
    Posts
    316
    Nice bro...my kids will dig playing with it!! Oldest is 7...trying to get her in to Flash! ha! kidding...well not really.

    - Sigma

  18. #18
    Junior Member
    Join Date
    Dec 2000
    Posts
    14
    Originally posted by Sigma
    Nice bro...my kids will dig playing with it!! Oldest is 7...trying to get her in to Flash! ha! kidding...well not really.

    - Sigma
    Where you been? - kids have been into flash for years:

    http://www.tygh.co.uk


  19. #19
    flashing since v3
    Join Date
    Jan 2002
    Posts
    401
    the jpeg idea sounds dope.... someone get onto it

  20. #20
    Senior Member
    Join Date
    Sep 2000
    Posts
    273
    I took my VC tutorial site offline when I didn't have time to support it anymore. I can try to scrounge up an older copy of that tutorial if you'd like.

    As for exporting it as a jpeg...I personally would have no idea how to do it from flash, I can set it up so you can print it out all nice and pretty but that's the extent of the image handling I could do with it. Sorry

    Working on some new tools to allow you to draw polygons, circles, and squares as well (make it into a full paint program).

    Cheers,

    spyder

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center