Skip to main content
Known Participant
March 10, 2010
Question

action-script help!! - Very appreciative of any help!

  • March 10, 2010
  • 1 reply
  • 425 views

hi,

Im looking for some help with some as2 script. Im creating a menu system where i have bubbles on a main page. However i want to create an effect of when one is clicked on all the circles move to diffrent possitions in the background and the page selected loads in the centre.

Then when you want to get to a diffrent page you click an invisible button in the background and the circles appear again.

Ive figured out how i make each one move individually when clicked on but im clueless on how to make the rest work and what script to put on the buttons.

Ive have no idea where to look or ask to get any help on this, so any infomation you can provide i would be very greatful.

thanks in advance

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
March 10, 2010

if you're trying to control a group of objects (like your bubbles), store references to them in an array.  you can then loop through the array and direct each of them.

janineabcAuthor
Known Participant
March 10, 2010

right o cheers. That does sound slightly confussing but ill give it ago. just need to get my head around the script. Ive looked up a few tutorials so im going to give them a try and see how it goes.

kglad
Community Expert
Community Expert
March 10, 2010

it's not possible to give you specific help because your question is so general.  but, as an example:

import mx.transitions.Tween;

var i:Number;

var bubbleA:Array=[];

for(i=1;i<23;i++){

bubbleA.push(this["bubbleMC_"+i]);

}

for(i=0;i<bubbleA.length;i++){

bubbleA.ivar=i;

bubbleA.onRelease=function(){

trace("bubble "+this.ivar+" was clicked");

for(i=0;i<bubbleA.length;i++){

if(i!=this.ivar){

new Tween(bubbleA, "_x", mx.transitions.easing.Elastic.easeOut,bubbleA._x, Stage.width-bubbleA._width, 1, true);

new Tween(bubbleA, "_y", mx.transitions.easing.Elastic.easeOut,bubbleA._y, Stage.height-bubbleA._height, 1, true);

} else {

new Tween(bubbleA, "_x", mx.transitions.easing.Elastic.easeOut,bubbleA._x, 0, 1, true);

new Tween(bubbleA, "_y", mx.transitions.easing.Elastic.easeOut,bubbleA._y, 0, 1, true);

}

}

}

}