A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [AS3]: Help - switching back button

  1. #1
    Senior Member
    Join Date
    Jan 2001
    Location
    IT
    Posts
    213

    [AS3]: Help - switching back button

    Hi guys,

    I'm really new at AS3, I'm going through some resource to catch it with the new language in the meanwhile just want to ask you a simple question.

    I'm bulding a really simple menu to learn the code. What I have is an object in my library which I 'attach' on the stage. When I click on any of the elements of the menu it just moves on the x axys of few pixels and get disabled so that no further click is possible on it.
    Now what I want to achieve is the chance to switch it back when another voice of the menu is clicked, and so on every time a new voice is clicked the previous one switches back onto original position (x = 0). With AS2 was a quite esay task but since just "few" things have changed...

    Below you will find an attachment of the movieclip I've created with the relative code.

    Thanks in advance for your time
    Attached Files Attached Files

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Code:
    function eventoDown(e:MouseEvent) {
    	resetMenu(e.currentTarget.parent);
    	e.currentTarget.mouseEnabled=false;
    	e.currentTarget.x=5;
    }
    function resetMenu(mc:MovieClip):void {
    	var len:uint=mc.numChildren;
    	for (var i:uint = 0; i<len; i++) {
    		var child=mc.getChildAt(i);
    		if (child.mouseEnabled==false) {
    			child.mouseEnabled=true;
    			child.x=0;
    		}
    	}
    }

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Location
    IT
    Posts
    213
    Thanks dawsonk,

    just one question that var child you set, what would it be? An Object?

    Anyway thank you again
    Giano

  4. #4
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Code:
    var child:Object=mc.getChildAt(i);
    // or better is
    var child:MovieClip=MovieClip(mc.getChildAt(i));

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