How to make a custom eraser tool using flash?

I did make a eraser tool. But once I begin to erase a layer, the background layer is visible. I want the layer just below the topmost layer to be visible.
For eg consider 2 layers.
Layer2 is above Layer1.
When I perform erase on Layer2, I see the stage background.
I want to actually see Layer1 when I erase from Layer2.
Here is the code I used:
The comment entry shows that, I have tried that possiblity.
import flash.display.BitmapData;
var linkageId:String = "myimage";
var myBitmapData:BitmapData = BitmapData.loadBitmap(linkageId);
trace(myBitmapData instanceof BitmapData);
this.createEmptyMovieClip("mc",this.getNextHighestDepth());
mc.attachBitmap(myBitmapData,this.getNextHighestDepth());
this.blendMode = "layer";
//mc.blendMode = "layer";
this.createEmptyMovieClip("mc1",this.getNextHighestDepth());
var myBitmapData1:BitmapData = new BitmapData(800,600, false, 0xFF000);
mc1.attachBitmap(myBitmapData1,this.getNextHighestDepth());
mc1.onMouseMove = function() {
var circle_mc:MovieClip = this.createEmptyMovieClip("circle_mc", this.getNextHighestDepth());
circle_mc._x = _xmouse-40;
circle_mc._y = _ymouse-40;
drawCircle(circle_mc,40,0x000000,50);
//mc.blendMode = "layer";
circle_mc.blendMode = "erase";
function drawCircle(target_mc:MovieClip, radius:Number, fillColor:Number, fillAlpha:Number):Void {
var x:Number = radius;
var y:Number = radius;
with (target_mc) {
beginFill(fillColor,fillAlpha);
moveTo(x+radius,y);
curveTo(radius+x,Math.tan(Math.PI/8)*radius+y,Math.sin(Math.PI/4)*radius+x,Math.sin(Math.P I/4)*radius+y);
curveTo(Math.tan(Math.PI/8)*radius+x,radius+y,x,radius+y);
curveTo(-Math.tan(Math.PI/8)*radius+x,radius+y,-Math.sin(Math.PI/4)*radius+x,Math.sin(Math .PI/4)*radius+y);
curveTo(-radius+x,Math.tan(Math.PI/8)*radius+y,-radius+x,y);
curveTo(-radius+x,-Math.tan(Math.PI/8)*radius+y,-Math.sin(Math.PI/4)*radius+x,-Math.sin(Ma th.PI/4)*radius+y);
curveTo(-Math.tan(Math.PI/8)*radius+x,-radius+y,x,-radius+y);
curveTo(Math.tan(Math.PI/8)*radius+x,-radius+y,Math.sin(Math.PI/4)*radius+x,-Math.sin(Math .PI/4)*radius+y);
curveTo(radius+x,-Math.tan(Math.PI/8)*radius+y,radius+x,y);
endFill();

use:
import flash.display.BitmapData;
var linkageId:String = "myimage";
var myBitmapData:BitmapData = BitmapData.loadBitmap(linkageId);
trace(myBitmapData instanceof BitmapData);
this.createEmptyMovieClip("mc",this.getNextHighestDepth());
mc.attachBitmap(myBitmapData,this.getNextHighestDepth());
this.createEmptyMovieClip("mc1",this.getNextHighestDepth());
var myBitmapData1:BitmapData = new BitmapData(800,600, false, 0xFF000);
mc1.attachBitmap(myBitmapData1,this.getNextHighestDepth());
mc1.blendMode="layer"
mc1.onMouseMove = function() {
var circle_mc:MovieClip = this.createEmptyMovieClip("circle_mc", this.getNextHighestDepth());
circle_mc._x = _xmouse-40;
circle_mc._y = _ymouse-40;
drawCircle(circle_mc,40,0x000000,50);
//mc.blendMode = "layer";
circle_mc.blendMode = "erase";
function drawCircle(target_mc:MovieClip, radius:Number, fillColor:Number, fillAlpha:Number):Void {
var x:Number = radius;
var y:Number = radius;
with (target_mc) {
beginFill(fillColor,fillAlpha);
moveTo(x+radius,y);
curveTo(radius+x,Math.tan(Math.PI/8)*radius+y,Math.sin(Math.PI/4)*radi us+x,Math.sin(Math.PI/4)*radius+y);
curveTo(Math.tan(Math.PI/8)*radius+x,radius+y,x,radius+y);
curveTo(-Math.tan(Math.PI/8)*radius+x,radius+y,-Math.sin(Math.PI/4)*ra dius+x,Math.sin(Math.PI/4)*radius+y);
curveTo(-radius+x,Math.tan(Math.PI/8)*radius+y,-radius+x,y);
curveTo(-radius+x,-Math.tan(Math.PI/8)*radius+y,-Math.sin(Math.PI/4)*r adius+x,-Math.sin(Math.PI/4)*radius+y);
curveTo(-Math.tan(Math.PI/8)*radius+x,-radius+y,x,-radius+y);
curveTo(Math.tan(Math.PI/8)*radius+x,-radius+y,Math.sin(Math.PI/4)*rad ius+x,-Math.sin(Math.PI/4)*radius+y);
curveTo(radius+x,-Math.tan(Math.PI/8)*radius+y,radius+x,y);
endFill();

Similar Messages

  • How to make like Spry Products demo using Flash CS4 / xml?

    hello there!
    i wonder is it possible to make something similar to Spry Products Demo using Flash CS4 for front end and xml for back end data. take a look at this draft image. If it can be done, can someone guide me please. I am super new to AS2/3 - Please. Thanks for your help.

    hello there!
    i wonder is it possible to make something similar to Spry Products Demo using Flash CS4 for front end and xml for back end data. take a look at this draft image. If it can be done, can someone guide me please. I am super new to AS2/3 - Please. Thanks for your help.

  • How to make a custom TableModel for ResultSet

    Hi,
    I am doing my University Team Project using Java and MySQL what would be the best way to implement a custom TableModel for a JTable that shows the data from the MySQL database.
    I've googled it for a couple of hours but all I can really find is examples of how to add static data into the jTable.
    The updating of the database through Java works fine, but I would like to show the results in a JTable.
    I need help on how to implement a TableModel that uses a ResultSet to populate a JTable.
    Any examples of how to make a custom TableModel or links to something that shos me how to do it would be great.
    Thanks
    Shazan Miah

    I've googled it for a couple of hours but all I can really find is examples of how to add static data into the jTable.Then you need more googling practice on picking the appropriate keywords to narrow down a search. Words like "jtable resultset" yielded many hits. Of course I'm partial to the one I suggested that was found in the Swing forum.

  • Time Capsule only works for one device at a time, how to make it capable to be used for multiple devices at times

    Time Capsule only works for one device at a time, how to make it capable to be used for multiple devices at times.
    Please help to set it up, thanks in advance

    You need to give more info..
    Firstly only works for what.. networking.. backup.. wireless. You need more nouns.. more adjectives... describe what you want and what fails.. then we can figure out why.
    Most likely you have bridged it when it should be in router mode..
    Most likely you are using Lion or ML which has the airport utility bridge the TC by default.
    Change it to working as a router. That might help.
    If you press reset button it will default back to router btw.
    If you are on Lion.. use a real utility. http://support.apple.com/kb/DL1547

  • How to make Avery 8160 address labels using pages

    Anyone know how to make Avery 8160 address labels using Pages? 

    Open the Avery 8160 Word template from their website.
    Peter

  • How do I find customer exits quickly using SE80,SE81 or other transactions?

    Hello all,
    Is there a way of using SE80 or SE81 or any other transaction for that matter, to quickly find customer or user exists being used within a given program rather than doing a global search for CALL CUSTOMER within the program? Example, transaction EG31 (Installation Full) which runs the program SAPLE30D.
    In SE80 there seem to be no reference to user or customer exits. As for SE81 I was unable to relate SAPLE30D with an application component, or at least I don't know how to do it.
    In the Repository Info System (SE81 also) there is a reference to customer exits, but, you MUST know which project is tied to your program, otherwise you'll be chasing your tail!
    I guess you can say the easiest way would be to do a global search in the program using the CALL CUSTOMER key words.
    Well, I tried that too. The first set of results pointed to INCLUDES which turned out to be empty exits! That is, no code. So, by pure chance and unknowingly, I stumbled upon a customer exit which was the source of my errors. How I did it, I cannot remember. But the problem is that this exit was hidden in a program which was called by SAPLE30D at a later stage.
    So, all this searching took a long time and more importantly, it was a lucky find. Not a methodic approach.
    So the question is: How do I find customer exits quickly using SE80, SE81 or any other transaction for that matter?
    Your help is greatly appreciated.

    edited
    Edited by: abhinay chelamcherla on Feb 24, 2008 9:49 AM

  • How can we create such navigation buttons using Flash CS4?

    Hi,
    How can we create such navigation buttons using Flash CS4 is in the following website? Please help me with any such tutorial to make my custom navigation bar/buttons.
    http://city.reallusion.com/join.html
    Thanks.

    While the Note 4 is a reasonably large device it still falls into the phone layout bucket. We need this layout to function on very small screens some as low as 320 pixels high and 240 pixels wide. These sorts of devices don't have the space for a full toolbar.

  • Who makes the nicest, easiest to use Flash website design software?

    Please forgive the beginner's question. I would like to build
    a flash site like
    http://www.hockaday.org from an
    easy to use Flash template. You get what you pay for so my first
    choice isn't something for free but a 30-day free trial version
    would be nice.
    What I like best about
    http://www.hockaday.org is the
    great menus and that pictures continually reload in interesting
    ways.
    Maybe a template is too restrictive. Who makes the nicest,
    easiest to use Flash website design software that allows fast
    creation of those fancy menus and with other fast features to do
    nice things with pictures and motion?
    I need to create a site like
    http://www.hockaday.org
    immediately so I don't have the time to learn Flash first. What's
    my best bet?

    you are in a catch 22 - you don't have time to learn flash -
    yet you need to build an entire site
    immediately - you can't - sure you can download a template
    that is similar but if this forum is any
    proof, you almost need more flash knowledge trying to
    decipher most templates in order to edit them
    - search this forum, there are several posts per week from
    non-flash users who purchased templates
    and have no clue how to edit them. Often times it is hard for
    an educated flash user to
    reverse-engineer a FLA made by somebody else - Flash
    documents are blank canvases that can be setup
    a myriad ways by different users making the same thing - some
    developers are more organized than
    others - most templates are not organized but rather thrown
    together for a quick profit.
    You will simply need to learn enough flash to understand how
    it works or hire somebody to edit the
    template for you.
    hope this helps.
    --> **Adobe Certified Expert**
    --> www.mudbubble.com
    --> www.keyframer.com
    e.Shubee wrote:
    > Please forgive the beginner's question. I would like to
    build a flash site like
    >
    http://www.hockaday.org from an
    easy to use Flash template. You get what you
    > pay for so my first choice isn't something for free but
    a 30-day free trial
    > version would be nice.
    >
    > What I like best about
    http://www.hockaday.org is the
    great menus and that
    > pictures continually reload in interesting ways.
    >
    > I need to create a site like that one immediately so I
    don't have the time to
    > learn Flash first. What's my best bet?
    >
    >
    >

  • How to Make a Multi-Level Game in Flash 5

    I'm wanting to know, "How to Make a Multi-Level game with
    Flash 5"? EX: If I were to make a space game, where after reaching
    a score of 2000 points, the game pauses and displays the text
    "Stage 2", then continues or provides a button to make the game
    continue starting on stage 2. Any help with this question is
    grately appreciated.
    coolburn

    coolburn wrote:
    > I'm wanting to know, "How to Make a Multi-Level game
    with Flash 5"? EX: If I
    > were to make a space game, where after reaching a score
    of 2000 points, the
    > game pauses and displays the text "Stage 2", then
    continues or provides a
    > button to make the game continue starting on stage 2.
    Any help with this
    > question is grately appreciated.
    >
    > coolburn
    First off.. Flash 5 is like.. Ancient. Dude. Seriously, thats
    more than
    3 versions ago, and there have been major major changes
    since.
    However, I'll give it a try..
    First off, there has to be some kind of an event that kicks
    it off. I
    would build something into the score system that would
    trigger this.
    For example.
    function updateScore():Void {
    _root.stage.scoreboard.text = myNewScore;
    if (myNewScore > 2000) {
    jumpToNextLevel();
    So, somewhere in your game a variable keeps the score.. if
    your game
    runs the updateScore function once in a while, if it hits
    more than
    2000, it triggers a new function called jumpToNextLevel.
    In the jumpToNextLevel, you would have to do more functions
    like
    pauseTheGame(), and such..
    In general.. break it down to small pieces of what you want
    to do. Each
    function would do a series of things.. Then when your going
    though your
    game, you call each function as needed.
    Hope this helps
    -Bill

  • Path Eraser Tool use?

    Hello,
    I have two shapes placed next to each other but the top section displays is a faint line to the left. How do I use the Path Eraser Tool to delete/remove that piece? Or is there a better way to remove?
    Note:
    Top image displays without path displayed...
    Bottom section displays with path displayed...
    Thx!
    RF

    Do these two objects need to remain separate from each other? Since it looks like you were trying to line up the paths anyway, this problem can be very easily solved by merging the two objects.
    You can combine the two objects by selecting both shapes and clicking on the "Unite" option in the Pathfinder panel (if you don't see the panel, go to Window > Pathfinder).
    After that, you should have one shape, instead of two separate ones. You can then select the left-most anchor point using the Direct Selection tool and delete it. You should see the white area disappear.
    Finally, select the two open points with the lasso tool, and join them by going to Object > Path > Join (or "control J"). You can adjust the points with the Direct selection tool to make sure the curve is nice and smooth.

  • How to make a customized layout to cretae customer ?

    we have xd01 transaction code to create customer. my user doesn't need this tcode. he wants a customized screen to do it by using the mandatory fields only.But from tcode xd01 data is mapped to a structure rsxxxxx. how to map this t code  against kna1?
    Moderator Message: Put some effort of your own before shooting questions to the forum.
    Edited by: kishan P on Dec 6, 2010 6:43 PM

    gradgrind wrote:What do you mean exactly? Maybe if you can explain in more detail what would like to do, someone can make suggestions. For example, why do you want a custom distribution and what is it about Arch itself that makes it unsuitable?
    I'm maintaining 15 web servers running Arch in my company. they have nearly the same settings and services. I want to set up just one server and make a customized setup CD based on it. Then when I need to add a new server or reinstall the system after hardware upgrade, I can skip over most of the tedious things. Not all of the servers have the same hardware, so harddisk clone is not suitable for this job.
    Who can tell me how to accomplish such a job ?
    I hope the auther of Arch can provide some instructions or developing tools or scripts to do this.

  • How to load a custom waveform for use with DAQ voltage generation

    I would appreciate some advice on how to take a custom waveform (just a modified triangle wave with pauses at the tops and bottoms) and use that to control the voltage output from a DAQ. 
    Some background:  My intent is to use the waveform to control mirror scanning for a LADAR imaging application .  Because our DAQ (NI-6251) only has one clock, it cannot update the X and Y channel voltages independently. I'm using a triangle wave to control both axes, which works fine for the X direction.  However, to prevent the Y axis from incrementally steping up after every X pixel, I'd like to construct a waveform, similar to a step pyramid, so that the Y axis remains constant over the X sweep and only updates to the next row after all X pixels are collected.
    I assume I can make the desired plot in excel, and then read it in somehow - but this is where I start to get fuzzy.  Can any one point me to an example or tutorial on this?
    Some other questions:
    1. Do I needto worry about scaling? will my custom plot need to contain a specific number of points (perhaps the exact number of pixels in the image)?
    2. If I change the image dimensions, will I need to revise the control waveform in the Y axis?
    Thanks in advance,
    jimmy

    This thread didn't appear to go anywhere.  I am trying to do something similar and was looking for help.  I want to create a repeating output voltage wave based off the excel file attached(with times).  Is there a way to have my program match the output voltage and time with the table attached on a repeat and send that signal to the output?
    Thanks,
    T
    Attachments:
    Sig Gen.xlsx ‏34 KB

  • How to make a custom form, buttons etc... please...

    I mean, how to make a form (for example, JFrame) with arbitrary form (geometry, for ex, round, oval, star like etc). I think you understand what i mean.
    Of course, i think i can use winApi, but it's only for windows. It doesn't suit for Java in this problem solution.
    That question also about cusomizing form of buttons, fields.. etc..
    i think, everything.
    What can java allows to cusomize and what not.
    Thanx!!

    I am just a learner and so i can just suggest you a strategy to implement Customized forms in JAVA. However i am sure that in practice it will work as far as Windows OS are concerned. Here is it:-
    The basic IDEA is to declare a native function in JAVA that makes JNI calls which will be further processed by Win32API and processed output will result into an elliptic or any polygonal shaped forms.
    To achieve declare some function as follows:
    public native void createEllipticalForm(formName formRefrance);
    create a Win32 Compiled DLL that manages this function as follows:
    (Mindwell, i havent stated what you call as pure-code but just a pseudo-code to the actual implementation)
    public native void createEllipticalForm(formName formRefrance)
    /* Search for the below stated Functions in Win32 API and work on
    them. I see a ray of success if you work with these functions properly.
    Further-more I assume that you are aware with concept of HANDLES */
    createEllipticRegion(); //WINDOWS.H
    showWindow(handleToTheForm); //WINDOWS.H
    Search for "createEllipticRegion() or showWindow()" on the GOOGLE to get the pure win32 API Code for Creating Customized Forms.
    Reply me in case any of you people get a solution based on my idea.
    [by VISH]

  • Make the Forum Search Tool useful

    The current Forum Search Tool is nearly useless.  Please add the following features to make it a functional tool:
    1. Logical operators - i.e. allow the following searches: cow AND chicken, cow OR chicken, cow NOT chicken (or -chicken)
    2. Quoted text to search for exact phrases - i.e. allow the following search: "my chicken says moo"
    3. Results with date ranges - i.e. allow the following search: weird chicken, Results before 04/01/2012 or after 04/01/10 or between 04/01/2010 and 04/01/2012
    4. Mix it up!  "My chicken says moo" AND "purple chicken feed" -cow, results after 12/23/2012
    5. Search in one forum only - i.e. allow the following search: "chicken says moo" ONLY in the "Farm Animal Behavior" forum 
    6. Search ONLY in posts (answers and/or questions) made by a particular user - i.e. allow the following search - "purple chicken feed" posted by user "Farmer Brown" ONLY
    7. Do NOT include variations of words that you "think" might be "helpful".  Right now a search for the word "running" yields results that contain the following words: running, run, runs.  Weeding through all the useless
    "helpful" results is a huge waste of time and makes it difficult in the extreme to actually find "relevant" results.  HINT: There might be an actual REASON why we want to search for "running" and
    NOT "run" or "runs".
    8. Please make the default operator AND instead of OR when more than one search word is used.  Adding more terms to a search tool should produce FEWER, MORE REFINED RESULTS instead of MORE, IRRELEVANT RESULTS.  Very few people ever want
    to search on a single word only.  This is especially true in a technical reference environment!
    9. Sometimes I WANT a word spelled exactly as I typed it.  If I get results that I do not want because I misspelled a word, I can just retype the search.  If you FORCE me to use your spelling, this makes my search completely useless.  Please
    give us MORE options rather than less!
    10. Remove search result highlighting.  We don't need the words we just searched for being blasted at us in highlighted bold.
    NOTE: If there are any other requests for the search tool, post them as replies and I'll add them to this list.
    Please do not read this sentence. Please ignore the previous sentence.

    Hi,
    i have posted many question but now i want to search a particular post by searching this forum but i found search is not finding in my thread rather it is searching keyword in all thread. so guide me how to search my posted question only in this
    forum? who can help. please develop a powerful search for msdn forum. thanks
    Searching in one forum is currently possible, you just need to make sure that you only have a single forum selected in the left rail:
    This walkthrough is a bit out of date now, but it should still be helpful for selecting only a single forum:
    http://social.technet.microsoft.com/wiki/contents/articles/18107.msdntechnet-forums-how-to-view-a-single-forum.aspx
    PS - I posted this same information (without the screenshot and FAQ link though) in
    your thread.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • How to make Google custom search results appear on a new page?

    Anybody got any idea how to make the search results appear on a separate page? I'm using the Google custom search to get generated code to place on my pages, after providing some 'guidance' information on the look and feel of it. Normally, Google will provide you with a few options to choose from to determine how your results will look and by default one would choose the "two page" option whilst going thru the setup process. One page for the search box on your own page and one for the results page.
    However, if you don't want a 'google-generated' results page but want the layout that's in line with the look of your site AND have the search box already on there for any repeat searches it becomes more tricky. I tried doing it one way, which I found one a blog tutorial but so far no sucess. The 'search box' code that I inserted onto one of my pages to test didn't show up the search box at all in preview or the live page...
    Anybody got any generic code that can be adapted (that they know works) or know of any tutorial that explains how to achieve this? Preferably Google related, as I'm using its custom search.
    In addition, I believe that recently Google have deprecated the use of iframe in its search results pages so for anybody that was using an earlier version of this facility it may no longer work properly and hence the solution might have to be modified. Not an expert, so not sure how much this fact will affect the final code, just a thought.
    Any ideas/solutions will be greatly appreciated. Thanks.

    hello adrianm12, this should be possible through the metro settings ("search"). also see [https://bugzilla.mozilla.org/show_bug.cgi?id=941292 bug 941292]...

Maybe you are looking for

  • Multiple Line Items in billing

    Dear All, I got one issue on production server,the scenario is like this, My client gives one Free of Cost (Item Category is TANN) On purchase of one material like XYZ(with item category TAN). And while creating Sales order it takes FOC automatically

  • Webi Published with dinamic filename in file system

    Hello, We have a problem in BO 4.0 SP5. We have a webi with the following prompt: Year: ie. 2014 Month: ie. 001 Company: ie ES01 The name webi is: Report_Sales When we shchedule the report we can't name the file like: "Report_Sales_<year>_<month>  (i

  • ITunes 7.0.1.8 totally freezes when iPod connected

    I installed iTunes 7.0.1.8 a few days ago, and today I'm having huge problems with it. Just yesterday I managed to upload a large set of videos to my iPod, and today, if I run iTunes without my iPod connected, I have no problems. However, when I plug

  • I have no music. im going insane

    so for the last couple days my itunes hasnt been working, ive tried uninstalling it and re installing it and still its not working. when i double click on the short cut or the link in the start menu the salt time pops up for a few seconds then goes a

  • Where should one install Oracle Database and the Grid Infrastructure in order to adhere to OFA?

    I've downloaded the two zipped install folders for Oracle Database, and the two zipped install folders for the Grid Infrastructure.  The book I'm following for installation says to use one directory for the database, and one directory for the Grid In