RE: [flexcoders] Re: How to identify which child of tabNavigatoris clicked?

2010-03-17 Thread Nini7016 Nini7016

Thanks for your help :) :)


To: flexcoders@yahoogroups.com
From: james.alan.finni...@gmail.com
Date: Wed, 17 Mar 2010 16:55:14 +
Subject: [flexcoders] Re: How to identify which child of tabNavigatoris clicked?


















 



  



  
  
  



Here's a complete working example to start with...



?xml version=1.0 encoding=utf-8?

mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
applicationComplete=TabOnglet()



mx:Script

![CDATA[

import mx.events.IndexChangedEvent;

import mx.containers.TabNavigator;

import mx.containers.Canvas;

import mx.controls.Button;



public function TabOnglet():void

{

this.setStyle(borderStyle , solid);

//this.percentHeight = 100;

this.percentWidth = 100;

this.createTab(new TabNavigator());

//create an listen to the event

this.initEventListener();



}

/**

 *

 * @param tabNavigator

 *

 */ 

 

private var _myTab:TabNavigator;



private function createTab(tabNavigator:TabNavigator) : void

{

_myTab = tabNavigator;

_myTab.percentHeight = 100;

_myTab.percentWidth = 100;



var canvas1: Canvas= new Canvas();

canvas1.percentHeight=100;

canvas1.percentHeight = 100;

canvas1.percentWidth = 100;

canvas1.label = BPMN;



var canvas2: Canvas= new Canvas();

canvas2.percentHeight=100;

canvas2.percentHeight = 100;

canvas2.percentWidth = 100;

canvas2.label = BPEL;

canvas2.id=bpel;



tabNavigator.addChild(canvas2);

tabNavigator.addChild(canvas1);



this.addChild(tabNavigator);



tabNavigator.addEventListener(Event.CHANGE, changed);

}



private function changed(evt:IndexChangedEvent):void{



trace(Tab changed from ( + evt.oldIndex + ) to ( + 
evt.newIndex + ));

}



/**

 * initialise the event

 *

 */   

private function initEventListener() : void

{



trace(this +  cré un écouteur);

   

//trace(_myTab.getTabAt(1) + 
this.getTabAt(1)__r);

//this.addEventListener(MouseEvent.CLICK, interceptClick, true);

//var tab:Button = _myTab.getTabAt(1);

//tab.addEventListener(MouseEvent.CLICK,interceptClick); 

//this.getChildAt(1).addEventListener(MouseEvent.CLICK, 
interceptClick, true);

  

}





]]

/mx:Script



/mx:Application



--- In flexcoders@yahoogroups.com, Nini7016 Nini7016 nahloulaha...@... wrote:



 

 Hello 

 

 

 I would like to know which child of tabNavigator is clicked :

 

 There is my code : 

 

 public function TabOnglet()

 {

 super();

 this.setStyle(borderStyle , solid);

 //this.percentHeight = 100;

 this.percentWidth = 100;

 this.createTab(this);

 //create an listen to the event

 this.initEventListener();

 

 }

 /**

  *

  * @param tabNavigator

  *

  */  

 private function createTab(tabNavigator : TabNavigator) : void

 {

 var canvas1: Canvas= new Canvas();

 canvas1.percentHeight=100;

 canvas1.percentHeight = 100;

 canvas1.percentWidth = 100;

 canvas1.label = BPMN;

 

 var canvas2: Canvas= new Canvas();

 canvas2.percentHeight=100;

 canvas2.percentHeight = 100;

 canvas2.percentWidth = 100;

 canvas2.label = BPEL;

 canvas2.id=bpel;

 

 tabNavigator.addChild(canvas2);

 tabNavigator.addChild(canvas1);

 }

 /**

  * initialise the event

  *

  */

 private function initEventListener() : void

 {

 

 trace(this +  cré un écouteur);

 

 trace(this.getTabAt(1) + 
 this.getTabAt(1)__r);

 //this.addEventListener(MouseEvent.CLICK, interceptClick, true);

 var tab:Button = this.getTabAt(1);

 tab.addEventListener(MouseEvent.CLICK,interceptClick);  

 //this.getChildAt(1).addEventListener(MouseEvent.CLICK, 
 interceptClick, true);



 }

 

 in the browser it displays

RE: [flexcoders] Re: How to identify which child of tabNavigatoris clicked?

2010-03-17 Thread Nini7016 Nini7016

it is me again :)
I don't understand evt.oldIndex 
how we can identify which child is cliked ???

Because depending the tab clicked i will do action  :(

Thank you very much :) :)
it is very helpful 

To: flexcoders@yahoogroups.com
From: james.alan.finni...@gmail.com
Date: Wed, 17 Mar 2010 16:55:14 +
Subject: [flexcoders] Re: How to identify which child of tabNavigatoris clicked?


















 



  



  
  
  



Here's a complete working example to start with...



?xml version=1.0 encoding=utf-8?

mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
applicationComplete=TabOnglet()



mx:Script

![CDATA[

import mx.events.IndexChangedEvent;

import mx.containers.TabNavigator;

import mx.containers.Canvas;

import mx.controls.Button;



public function TabOnglet():void

{

this.setStyle(borderStyle , solid);

//this.percentHeight = 100;

this.percentWidth = 100;

this.createTab(new TabNavigator());

//create an listen to the event

this.initEventListener();



}

/**

 *

 * @param tabNavigator

 *

 */ 

 

private var _myTab:TabNavigator;



private function createTab(tabNavigator:TabNavigator) : void

{

_myTab = tabNavigator;

_myTab.percentHeight = 100;

_myTab.percentWidth = 100;



var canvas1: Canvas= new Canvas();

canvas1.percentHeight=100;

canvas1.percentHeight = 100;

canvas1.percentWidth = 100;

canvas1.label = BPMN;



var canvas2: Canvas= new Canvas();

canvas2.percentHeight=100;

canvas2.percentHeight = 100;

canvas2.percentWidth = 100;

canvas2.label = BPEL;

canvas2.id=bpel;



tabNavigator.addChild(canvas2);

tabNavigator.addChild(canvas1);



this.addChild(tabNavigator);



tabNavigator.addEventListener(Event.CHANGE, changed);

}



private function changed(evt:IndexChangedEvent):void{



trace(Tab changed from ( + evt.oldIndex + ) to ( + 
evt.newIndex + ));

}



/**

 * initialise the event

 *

 */   

private function initEventListener() : void

{



trace(this +  cré un écouteur);

   

//trace(_myTab.getTabAt(1) + 
this.getTabAt(1)__r);

//this.addEventListener(MouseEvent.CLICK, interceptClick, true);

//var tab:Button = _myTab.getTabAt(1);

//tab.addEventListener(MouseEvent.CLICK,interceptClick); 

//this.getChildAt(1).addEventListener(MouseEvent.CLICK, 
interceptClick, true);

  

}





]]

/mx:Script



/mx:Application



--- In flexcoders@yahoogroups.com, Nini7016 Nini7016 nahloulaha...@... wrote:



 

 Hello 

 

 

 I would like to know which child of tabNavigator is clicked :

 

 There is my code : 

 

 public function TabOnglet()

 {

 super();

 this.setStyle(borderStyle , solid);

 //this.percentHeight = 100;

 this.percentWidth = 100;

 this.createTab(this);

 //create an listen to the event

 this.initEventListener();

 

 }

 /**

  *

  * @param tabNavigator

  *

  */  

 private function createTab(tabNavigator : TabNavigator) : void

 {

 var canvas1: Canvas= new Canvas();

 canvas1.percentHeight=100;

 canvas1.percentHeight = 100;

 canvas1.percentWidth = 100;

 canvas1.label = BPMN;

 

 var canvas2: Canvas= new Canvas();

 canvas2.percentHeight=100;

 canvas2.percentHeight = 100;

 canvas2.percentWidth = 100;

 canvas2.label = BPEL;

 canvas2.id=bpel;

 

 tabNavigator.addChild(canvas2);

 tabNavigator.addChild(canvas1);

 }

 /**

  * initialise the event

  *

  */

 private function initEventListener() : void

 {

 

 trace(this +  cré un écouteur);

 

 trace(this.getTabAt(1) + 
 this.getTabAt(1)__r);

 //this.addEventListener(MouseEvent.CLICK, interceptClick, true);

 var tab:Button = this.getTabAt(1);

 tab.addEventListener(MouseEvent.CLICK

RE: [flexcoders] Re: How to identify which child of tabNavigatoris clicked?

2010-03-17 Thread Nini7016 Nini7016

first of all, thank you very very much for your answers,, it is really very 
helpful ...I 'am hapyy
so, here in the function changed i can do this : 


private function changed(evt:IndexChangedEvent):void{
 
trace(Tab changed from ( + evt.oldIndex + ) to ( + 
evt.newIndex + ));
if(oldIndex ==0){ // when we clik in 
the second tab (tab which has index1) Alert.show(we 
cliked in the tab1)}else
  Alert.show(we cliked in the tab0)
}
 Give me your opinion please ?
Thanks :) 
Nice afternoon :)


To: flexcoders@yahoogroups.com
From: james.alan.finni...@gmail.com
Date: Wed, 17 Mar 2010 21:12:37 +
Subject: [flexcoders] Re: How to identify which child of tabNavigatoris clicked?


















 



  



  
  
  

The oldIndex is the tab that was current before you click on another tab.  So 
if you have two tabs (like in the demo) with the indices of 0 and 1 and you 
click on the second tab, the oldIndex will be zero (0) and the new tab will be 
one (1).  If you then click on tab 1, oldIndex will be 1 and newIndex will be 0.



The demo app. posted outputs that information in the trace window.



--- In flexcoders@yahoogroups.com, Nini7016 Nini7016 nahloulaha...@... wrote:



 

 it is me again :)

 I don't understand evt.oldIndex 

 how we can identify which child is cliked ???

 

 Because depending the tab clicked i will do action  :(

 

 Thank you very much :) :)

 it is very helpful 

 

 To: flexcoders@yahoogroups.com

 From: james.alan.finni...@...

 Date: Wed, 17 Mar 2010 16:55:14 +

 Subject: [flexcoders] Re: How to identify which child of tabNavigatoris 
 clicked?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  

 

 

 

   

 

 

 

   

   

   

 

 

 

 Here's a complete working example to start with...

 

 

 

 ?xml version=1.0 encoding=utf-8?

 

 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
 applicationComplete=TabOnglet()

 

   

 

   mx:Script

 

   ![CDATA[

 

   import mx.events.IndexChangedEvent;

 

   import mx.containers.TabNavigator;

 

   import mx.containers.Canvas;

 

   import mx.controls.Button;

 

   

 

   public function TabOnglet():void

 

 {

 

 this.setStyle(borderStyle , solid);

 

 //this.percentHeight = 100;

 

 this.percentWidth = 100;

 

 this.createTab(new TabNavigator());

 

 //create an listen to the event

 

 this.initEventListener();

 

 

 

 }

 

 /**

 

  *

 

  * @param tabNavigator

 

  *

 

  */ 

 

  

 

 private var _myTab:TabNavigator;

 

 

 

 private function createTab(tabNavigator:TabNavigator) : void

 

 {

 

   _myTab = tabNavigator;

 

   _myTab.percentHeight = 100;

 

   _myTab.percentWidth = 100;

 

   

 

 var canvas1: Canvas= new Canvas();

 

 canvas1.percentHeight=100;

 

 canvas1.percentHeight = 100;

 

 canvas1.percentWidth = 100;

 

 canvas1.label = BPMN;

 

 

 

 var canvas2: Canvas= new Canvas();

 

 canvas2.percentHeight=100;

 

 canvas2.percentHeight = 100;

 

 canvas2.percentWidth = 100;

 

 canvas2.label = BPEL;

 

 canvas2.id=bpel;

 

 

 

 tabNavigator.addChild(canvas2);

 

 tabNavigator.addChild(canvas1);

 

 

 

 this.addChild(tabNavigator);

 

 

 

   tabNavigator.addEventListener(Event.CHANGE, changed);

 

 }

 

 

 

   private function changed(evt:IndexChangedEvent):void{

 

   

 

   trace(Tab changed from ( + evt.oldIndex + ) to ( + 
 evt.newIndex + ));

 

   }

 

 

 

 /**

 

  * initialise the event

 

  *

 

  */   

 

 private function initEventListener() : void

 

 {

 

 

 

 trace(this +  cré un écouteur);

 



 

 //trace(_myTab.getTabAt(1) + 
 this.getTabAt(1)__r);

 

 //this.addEventListener(MouseEvent.CLICK, interceptClick, true);

 

 //var tab:Button = _myTab.getTabAt(1);

 

 //tab.addEventListener(MouseEvent.CLICK,interceptClick); 

 

 //this.getChildAt(1).addEventListener(MouseEvent.CLICK, 
 interceptClick, true);

 

   

 

 }

 

 

 

   

 

   ]]

 

   /mx:Script

 

   

 

 /mx:Application

 

 

 

 --- In flexcoders