A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: [CS3] Draw on a condensated window?

  1. #1
    Junior Member
    Join Date
    Jul 2006
    Posts
    21

    Question [CS3] Draw on a condensated window?

    Hi,

    Does anyone know ways that I could create a window with condensation on that could be drawn on by the user to reveal the background behind the window?

    Thanks.

  2. #2
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    you could create a mask for the background.
    Then, for the drawing, you could do something like this

    (its simple, and probably really bad, but might get you started)

    onMouseMove:
    draw a circle (your choice in size) and add it to the mask object. As more circles get added in different locations, more of the background will be revealed.

    Hope that helps.
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  3. #3
    Junior Member
    Join Date
    Jul 2006
    Posts
    21
    Thanks for your reply.

    I think the animation will need to look more like the user is rubbing out the mist. Like they were using the rubber tool on it or something.

    I imagine it would need to be something similar to http://www.actionscript.org/resource...ash/Page1.html but instead of just drawing a black line it would need to erase part a layer.

  4. #4
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    Here is a test fla I made.

    I think this is what you are looking for.
    Attached Files Attached Files
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  5. #5
    Junior Member
    Join Date
    Jul 2006
    Posts
    21
    That is brilliant! Thankyou very much.

    I think ive got it how i need it now but i dont completely understand how it works so i might be back. Will it only work on the main timeline, because i dont seem to be able to get it to work in movieclips?

    Thanks again.

  6. #6
    Junior Member
    Join Date
    Jul 2006
    Posts
    21
    Ive run into another problem.. sorry about this.

    When i play the movie and then rub the condensation off, then go to another part of the movie the part that ive rubbed off has also rubbed off all the other graphics. Is there any way i can stop this?

  7. #7
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    it probably has to do with your mask and what mc you applied it to. Make sure that if the mc being masked is used later, and it doesn't require it anymore, to get rid of the mask.

    Also, when you say it rubbed off all of the other graphics. what do you mean? other mc?

    Do you understand masks completely?
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  8. #8
    Junior Member
    Join Date
    Jul 2006
    Posts
    21
    Yeh, it rubs out other movieclips. I dont really understand masks that well unfortionatly.

    Ive uploaded the swf file at http://meztone.deviantart.com/art/window-86677183

    If you click on the white circle first, then rub a part of the mist off and then click the raindrop on the far right hope you will see what im talking about.

  9. #9
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    Here is what happened.

    If you did not change the code at all, you created the mask dynamically on the root. That means it is always there. When it was created on the window scene, it was attached to the root. When you change to the watering can, the movie clip that the mask was masking, is gone, so the mask appears normally, as a movie clip. There are two things we can do.

    1: When you are going to go away from the foggy windows, you can make the visibility of the mask false, and you can do a delete call on it, so it goes away during garbage collection.

    2: We can create an empty movie clip as a symbol in your library, and place that on the stage on the frame where you want it. place it at the same x and y values as the movie clip you want to mask, and call setMask() in the frame script. As long as you call the movie clip the same name it will work, and it will go away when a new keyframe is called and that mc is not there.

    Here's a bit about masks.

    MC1: picture of car.
    maskMC: a pruple square.
    when we set the maskMC as the mask for MC1, it is making it so that the MC1 is only visible where there is graphical data in the maskMC.

    maskMC box dimensions
    x=0
    y=0
    w=10
    h=10

    MC1 dimensions:
    x=0
    y=0
    w=100
    h=100

    Only the first 10x10 pixels of MC1 will show up.
    In the code I showed you, you are taking the maskMC and constantly making it have more and more graphics in it, making more and more of what is hidden, visible.

    One of the best places for help on syntax and code (not applying it to a specific problem) is the F1 help in the Flash IDE. Don't forget about it!
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  10. #10
    Junior Member
    Join Date
    Jul 2006
    Posts
    21
    I dont really understand the first option and the second option dosnt seem to work for me. I dont think i know enough about action script in general.

    Is there some code that I could just copy and paste into the frames?

  11. #11
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    Here is what I would do, on the frame that the foggy windows are, wherever there is a way to leave that frame (the drop on the window) or whatever you may add, do something like this

    this is all timeline code
    waterDrop.onRelease = function () {
    //tell it to go where it normally does
    //also, as with any other way to leave this frame call this function
    removeMask();
    }

    function removeMask() {
    mask_mc._visible = false.
    background.setMask(null);
    }
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  12. #12
    Junior Member
    Join Date
    Jul 2006
    Posts
    21
    When I type in that code I get an error saying 'there is no method with the name background.' Do I need to change anything in the code or change the names of any of the movieclips?

    Do I put the code inside the movieclip of the drops or on the keyframe of the movieclip or somewhere else?

  13. #13
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    The names of the objects (waterDrop, and background) need to match what you have. The background is the object being masked by the mask, and the tear drop is the object you click on to leave the frame.
    That should be framescript. On the frame that has the window imagery.
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


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