tg
07-20-2006, 06:03 PM
ok... playing with the trial of flex builder 2. and so far this seems like its gonna be really really sweet. i am pretty excited.
but i have a quick question about the tabnavigator.
here is my code:
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function initializeApp():void{
//create necessary listeners
createListener();
//get the project data
disableForm();
}
public function createListener():void {
//button events
btnAdd.addEventListener(MouseEvent.CLICK, projAdditions);
btnEdit.addEventListener(MouseEvent.CLICK,projAddi tions);
btnCancel.addEventListener(MouseEvent.CLICK,cancel Changes);
//tab events
tn.addEventListener(Event.TAB_CHILDREN_CHANGE,tabC licked);
//projData.addEventListener(MouseEvent.CLICK,onProjD ataClick);
//reqData.addEventListener(MouseEvent.CLICK,onProjDa taClick);
//projAnalyst.addEventListener(MouseEvent.CLICK,onPr ojAnalystClick);
//projTime.addEventListener(MouseEvent.CLICK,onProjT imeClick);
//grid events
}
public function tabClicked(e:Event):void{
var i:Number=tn.selectedIndex;
if(i==0 || i==1){
onProjDataClick();
}else if(i==2){
onProjAnalystClick();
}else{
onProjTimeClick();
}
}
public function onProjTimeClick():void{
Alert.show("vew project Time","test");
}
public function onProjAnalystClick():void{
Alert.show("vew project Analysts","test");
}
public function onProjDataClick():void{
Alert.show("vew project data","test");
}
]]>
</mx:Script>
<mx:TabNavigator id="tn" width="100%" height="345" x="2" y="1">
<mx:Canvas label="Project Information" width="100%" height="100%" id="projData">
<suff here/>
</mx:Canvas>
<mx:Canvas label="Project Analysts" width="100%" height="100%" id="projAnalyst">
<stuff here/>
</mx:Canvas>
<mx:Canvas label="Project Work Time" width="100%" height="100%" id="projTime">
<stuff here/>
</mx:Canvas>
</mx:TabNavigator>
ok. just an fyi. all the code works. no errors in fb2, compiles and runs fine.
here is the problem.
i am trying to capture the click event on the TAB. in the tabnavigator.
currently the way i have it set up, it doesnt capture when i click the TAB. it triggers the event when i click into the CONTENT held within the canvas for that tab.
there has to be some hidden event somewhere (or maybe not so hidden -- im new to this). that is triggered so it knows to switch between content in tabs. know what i mean?
i have tried MouseEvent.CLICK and EVENT.TAB_CHILDREN_CHANGE (altho this is not really meant for the tabnavigator i dont think).
both work the same way as mentioned above. but not the way i need them to work.
any suggestions on where to look? or what to try?
appreciate all comments and suggestions. thanks.
but i have a quick question about the tabnavigator.
here is my code:
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function initializeApp():void{
//create necessary listeners
createListener();
//get the project data
disableForm();
}
public function createListener():void {
//button events
btnAdd.addEventListener(MouseEvent.CLICK, projAdditions);
btnEdit.addEventListener(MouseEvent.CLICK,projAddi tions);
btnCancel.addEventListener(MouseEvent.CLICK,cancel Changes);
//tab events
tn.addEventListener(Event.TAB_CHILDREN_CHANGE,tabC licked);
//projData.addEventListener(MouseEvent.CLICK,onProjD ataClick);
//reqData.addEventListener(MouseEvent.CLICK,onProjDa taClick);
//projAnalyst.addEventListener(MouseEvent.CLICK,onPr ojAnalystClick);
//projTime.addEventListener(MouseEvent.CLICK,onProjT imeClick);
//grid events
}
public function tabClicked(e:Event):void{
var i:Number=tn.selectedIndex;
if(i==0 || i==1){
onProjDataClick();
}else if(i==2){
onProjAnalystClick();
}else{
onProjTimeClick();
}
}
public function onProjTimeClick():void{
Alert.show("vew project Time","test");
}
public function onProjAnalystClick():void{
Alert.show("vew project Analysts","test");
}
public function onProjDataClick():void{
Alert.show("vew project data","test");
}
]]>
</mx:Script>
<mx:TabNavigator id="tn" width="100%" height="345" x="2" y="1">
<mx:Canvas label="Project Information" width="100%" height="100%" id="projData">
<suff here/>
</mx:Canvas>
<mx:Canvas label="Project Analysts" width="100%" height="100%" id="projAnalyst">
<stuff here/>
</mx:Canvas>
<mx:Canvas label="Project Work Time" width="100%" height="100%" id="projTime">
<stuff here/>
</mx:Canvas>
</mx:TabNavigator>
ok. just an fyi. all the code works. no errors in fb2, compiles and runs fine.
here is the problem.
i am trying to capture the click event on the TAB. in the tabnavigator.
currently the way i have it set up, it doesnt capture when i click the TAB. it triggers the event when i click into the CONTENT held within the canvas for that tab.
there has to be some hidden event somewhere (or maybe not so hidden -- im new to this). that is triggered so it knows to switch between content in tabs. know what i mean?
i have tried MouseEvent.CLICK and EVENT.TAB_CHILDREN_CHANGE (altho this is not really meant for the tabnavigator i dont think).
both work the same way as mentioned above. but not the way i need them to work.
any suggestions on where to look? or what to try?
appreciate all comments and suggestions. thanks.