The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Flash
  • ActionScript
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Flash
 ActionScript

  • surferboy Author 
    • 3466 
    • 0 
    • 1 
    eraser tool in as3
    surferboy

    Last reply Mar 17 2009, 04:43 AM

    by surferboy

    Posted: Mar 16 2009, 12:43 PM

    by surferboy

     

Hi.
I have a MC used as a mask. Now i want to erase parts of the mask dynamicly like the eraser tool in photoshop. Any ideas how to do that whith actionscript(as3)?
To draw a mask(lineTo) is no problem but to do the opposit seems to bee tricky.

  1 REPLY
 
surferboy Author 
1  
surferboy

Okay i found a way to do it.
This creates a 100x 100 circle to use to like the easertool i photoshop.
This way you can set the b(see code) as a mask and use it as inverted mask.yes

eraseableMc = new MovieClip();

eraseableMc .graphics.beginFill(0x000000, 1);
eraseableMc .graphics.drawRect(0, 0, 800, 600);
eraseableMc .graphics.endFill();

myBitmapData = new BitmapData(800, 600, true, 0x00000000);
//Copy the eraseableMc to bitMapData to be able to modify data. I do not add
//eraseableMc  to the stage.
myBitmapData.draw(eraseableMc , new Matrix(), null, BlendMode.NORMAL);
b = new Bitmap(myBitmapData);
addChild(b);
b.cacheAsBitmap = true;


// ... this code goes on a mousemove event or whatever you want to 
//use to control the erase.  
eraserClip = new Sprite();
eraserClip.graphics.beginFill(0xffffff, 1);                    
eraserClip.graphics.drawEllipse(mouseX, mouseY, 100, 100);
myBitmapData.draw(eraserClip, new Matrix(), null, BlendMode.ERASE); 
  • 17 March 2009 04:43 AM
  •  
  •   Log in or join for free to make a comment.
 
Topic actions
  •  Share on Facebook
  •  Share on Twitter
Topic Categories
  •  Show All Topics
  •  Development
    •  Server Side
    •  Client Side
  •  Creative Software
    •  Web
    •  Video
    •  3D
    •  Illustrator
    •  Photoshop Battles
    •  Photoshop
  •  Design
    •  Typography
    •  Resources & Insight
    •  Checkpoint
  •  Career
    •  Copyright Matters
    •  Advice & issues
    •  Job Seekers
    •  Job Offers
  •  Flash
    •  UltraMath
    •  OOP
    •  Third Party Tools
    •  Open Source alternatives
    •  Data Communication
    •  Components
    •  Flex
    •  AIR
    •  Flash Lite
    •  Flash Professional
    •  Flash Newbie
    •  ActionScript
    •  XML
  •  Lounge
    •  Polls
    •  Random Chat
    •  Showcase And Critique
    •  BombShock Award Nominations
  •  Community Essentials
    •  BombShock Award Winners
    •  Tutorials
    •  Interviews
    •  News
    •  Bitmap tutorials
Popular Topics
  • Sort by: 
  • Activity
  • Views
  • Comments
  • Likes
Advertise with us
  • Your advertisement here!
  • loading
Ultrashock
  • Creative Assets
  • Community
  • Blog
  1. Home
  2. Forum
+/-
Creative Assets
  • Categories
  • Contributors
  • How to buy
Make Money
  • Commission Rates
  • Referral Program
  • Contributor Program
Community
  • Activity Feed
  • Forum
  • Profiles
About
  • Quick Tour
  • Our History
  • Banners & Logos
Support
  • Contact Ultrashock
  • Advertise with us
  • Legal Information
  •  Keep up to date
  • Flash 775  Flash
  • Audio 6,481  Audio
  • Vector 2,130  Vectors
  • Image 12,338  Images
  • Creative Assets 21,724  Assets
  • Profiles 282,659  Members
  • Topics 93,762  Topics
  • Blog 4  Blog
  • Facebook 1,680  Facebook
  • Twitter 1,165  Twitter
  • Join our FREE monthly newsletter!
  • Archive
  • Invalid email address. Please try again.
Subscribe
  • ©2012 Ultrashock LLC - All rights reserved
  • Terms of Use
  • Privacy Policy
  • Switch to dark theme
  • RSS Feeds
  • Top

©2012 Ultrashock LLC - All rights reserved

Printed on Sat, February 04, 2012 - 19:27:48