header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
leni
Points:0
Posts:0

5/20/2010 1:52:04 PM

Title: changing alpha (or color) with dragover


Please help, Im totally new to AS. I have the raster of dots on white background. I would like it when i DragOver EACH DOT it becomes white so it looks like you are actually drawing white line by erasing the dots. Ive somehow found the way how to do it by making it transparent when I rollover. But it doesnt work with dragover.

This is the code assigned to MC with one black dot (this MC with one dot I have copied to another MC to make dense raster). When I test the movie, it works great, every dot I touch with rollover disapears, but when I change rollover in the script for dragover, it doesnt do anything.

this.onRollOver = function () {
this._alpha = 0;
}




1
Flash_Guy
Points: 850
Posts:0
5/20/2010 9:44:03 PM



hi onDragOver does not work for your scenario. However if you want to draw a white line you can simply use the below code . This code draws a line when you press the mouse and move and stops when you release the mouse. So the user can easily draw over you flash file . Its actionscript 2.0 code , just paste it in your root frame .


createEmptyMovieClip("myLineClip",1);
//you can change the color from black to white and size from 2 pixel to anything you want
// 100 is alpha
myLineClip.lineStyle(2,0x000000,100); 
onMouseDown = function (){
        myLineClip.moveTo(_xmouse, _ymouse);
       
        onMouseMove = function (){
                myLineClip.lineTo(_xmouse, _ymouse);}
}

onMouseUp=function(){
        onMouseMove=null;
}


2
Kiney
Points: 600
Posts:0
5/20/2010 9:54:51 PM



if you have a few number of dots like 10-15 then you can check the position of mouse on mouse move and set alpha of movielip to zero which falls in that area. Or hittest function can also be used. Tell me the number of dots you have then I can suggest you the easy one.

3
leni
Points: 0
Posts:0
5/21/2010 12:09:14 AM



To Flash_Guy: Thank you !very much! for your tip, but for my project i need whole dots to disapear one after another as you drag over them. To draw line is great idea but than it can happen that only parts of dots will go white.

4
leni
Points: 0
Posts:0
5/21/2010 12:17:52 AM



To Kiney: thank you Kiney. I have like 900 to 1000 dots on 1200x1600 px document size. And for my project i need whole dots to disapear one after another as you drag over them. Thank you for your help.


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 8+3 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions