how can i get MC in stage function??
        Posted  
        
            by eblek
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by eblek
        
        
        
        Published on 2010-06-12T21:40:54Z
        Indexed on 
            2010/06/12
            21:42 UTC
        
        
        Read the original article
        Hit count: 342
        
flash
|actionscript-3
function createCircles(evt:Event):void
{    
    for(i=0; i<3; i++)
    {
    var figure:Sprite=new Sprite();            
    figure.circle.x=10;
    figure.circle.y=i*figure.square.height*1.02;
    figure.circle.buttonMode=true;
    figure.circle.addEventListener(MouseEvent.MOUSE_DOWN,downFNC);
    addChild(figure.circle);
    }
}
function downFNK(evt:MouseEvent):void{
    current_mc=MovieClip(evt.target);
    current_mc.x=mouseX;
    current_mc.y=mouseY;
    stage.addEventListener(Event.ENTER_FRAME,appear); 
}
function appear (evt:Event):void
{
    current_mc=???
    current_mc.x=mouseX;
current_mc.y=mouseY;
        if(mouseX > stage.width/2)
              current_mc.visible=false;
        else
              current_mc.visible=true;
        stage.addEventListener(MouseEvent.MOUSE_UP, upFNC);
    }
    function upFNC(evt:MouseEvent):void
    {
     stage.removeEventListener(Event.ENTER_FRAME, appear);
    }
hi, i create three circles. if a circle is dragged to right side of the stage, it becomes invisible and vice versa. when MOUSE_UP is invoked, it must stay in its last position.
so in the appear() function how can i assign the selected circle to current_mc?
© Stack Overflow or respective owner