How do I inplement javascript $each() in C2?

0 favourites
  • 1 posts
From the Asset Store
A cool way for kids to write and practice English Alphabets
  • In the example below in Edge Animate*, a different image is loaded according to what button is clicked. How could I implement that in C2?

    * Edge Animate uses a slightly modified javaScript where sym is the stage symbol. The individual button elements are all children of the div.

    I do not seem to find a way to address a series of buttons in this way.

    var buttons = sym.$("buttons").children();     
    
    $.each(buttons,function(i){
    	$(this).on("click", function(){ 
    			// do something when one of the button is clicked	
    			sym.$("images").css({"opacity":0.00});
    			sym.$("images").animate({"opacity":1.00},700).attr('src',"images/image" + i + ".png");				
    	});	
    })[/code:28umjxwf]
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)