# \[AS3\] ask: Start Stop many MovieClip from one Controller

**URL:** https://forum.kirupa.com/t/as3-ask-start-stop-many-movieclip-from-one-controller/590280
**Category:** flash
**Created:** [March 26, 2015, 8:24am UTC](https://forum.kirupa.com/t/as3-ask-start-stop-many-movieclip-from-one-controller/590280 "2015-03-26T08:24:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sangjagon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sangjagon/32/7223_2.png) [@sangjagon](https://forum.kirupa.com/u/sangjagon)
#### Post date: [March 26, 2015, 8:24am UTC](https://forum.kirupa.com/t/as3-ask-start-stop-many-movieclip-from-one-controller/590280/1 "2015-03-26T08:24:55Z")

</div>

Dear Kirupa Forum,

Need your help, I’m a beginner in Flash especially in AS3. I have a little project, as follow:

\*\*\* Assume instance name = MovieClip name

In layer [Display], I have 3 MC, they are mcDisplay1, mcDisplay2 and mcDisplay3, inside each this MC has mcPump1, mcPump2 and mcPump3.  
In layer [Controller], I have mcController, inside this has txtName, btnClose, btnStart and btnStop.  
My aim is, to Start/Stop the mcPump from different mcDisplay using only this mcController.  
The script code below that I know is still not make satisfied:

```
// *****code begin here*****
//-----------
mcDisplay1.mcPump1.addEventListener(MouseEvent.CLICK, iController);
mcDisplay2.mcPump2.addEventListener(MouseEvent.CLICK, iController);
mcDisplay3.mcPump3.addEventListener(MouseEvent.CLICK, iController);

mcController.btnStart.addEventListener(MouseEvent.CLICK, startAction);
mcController.btnStop.addEventListener(MouseEvent.CLICK, stopAction);
mcController.btnClose.addEventListener(MouseEvent.CLICK, hideMe);
//-----------
mcController.visible=false;
//-----------
function iController(me:MouseEvent):void{
 	mcController.visible=true; 	

 	switch(me.currentTarget){
 	 case mcDisplay1.mcPump1:
	  mcController.txtName.text=”Pump_1”; 
    break;
case mcDisplay2.mcPump2:
	mcController.txtName.text=”Pump_2”; 
 break;
case mcDisplay3.mcPump3:
	mcController.txtName.text=”Pump_3”; 
 break;}
}
//-----------
function startAction(me:MouseEvent):void{	
 	switch(mcController.txtName.text){
 	 case ”Pump_1”:
	//mcPump1 Start; 
 break;
case ”Pump_2”::
	//mcPump2 Start;
 break;
case ”Pump_3”:
	//mcPump3 Start;
 break;}
}
//-----------
function stopAction(me:MouseEvent):void{	
 	//similar to startAction
}
//-----------
function hideMe(me:MouseEvent):void{	
 	mcController.visible=false;
}
//-----------

// *****code end here*****

```

Please if anyone of you have a better idea to share to me to get the aim.

Thanks  
sangjagoan
