aktell
06-17-2009, 10:09 AM
Hi there,
Please if somebody could help here.
I would like to (goNext) & (goPrevious) from my menu navigation within my Application file. Of course this is done usually within the component Img. Gallery .mxml file itself, but as it is I need to have the ability also to work the (buttons/functions) from outside the component file. Unfortunately I have not been able to master this ! using this exact code.
<mx:Script>
<![CDATA[
import com.Pathway.ShCaImgGallOne;
private var pictures:Array;
private var currentIndex:int = 0;
[Bindable]
private var currentPicture:ShCaImgGallOne;
private function goNext():void {
if (currentIndex < pictures.length - 1){
currentIndex++;
}
else {
currentIndex = 0;
}
switchPicturesONE();
}
private function goPrevious():void {
if (currentIndex != 0){
currentIndex--;
}
else {
currentIndex = pictures.length - 1;
}
switchPicturesONE();
}
private function switchPicturesONE():void {
fadeInOne.end();
fadeOutOne.end();
pictureONE.visible = false;
}
private function updateCurrentPicture():void {
currentPicture = pictures[currentIndex];
}
public function set dataProvider(value:Array):void {
pictures = value;
currentIndex = 0;
updateCurrentPicture();
}
public function get dataProvider():Array {
return pictures;
}
]]>
</mx:Script>
Thanks in advance aktell
Please if somebody could help here.
I would like to (goNext) & (goPrevious) from my menu navigation within my Application file. Of course this is done usually within the component Img. Gallery .mxml file itself, but as it is I need to have the ability also to work the (buttons/functions) from outside the component file. Unfortunately I have not been able to master this ! using this exact code.
<mx:Script>
<![CDATA[
import com.Pathway.ShCaImgGallOne;
private var pictures:Array;
private var currentIndex:int = 0;
[Bindable]
private var currentPicture:ShCaImgGallOne;
private function goNext():void {
if (currentIndex < pictures.length - 1){
currentIndex++;
}
else {
currentIndex = 0;
}
switchPicturesONE();
}
private function goPrevious():void {
if (currentIndex != 0){
currentIndex--;
}
else {
currentIndex = pictures.length - 1;
}
switchPicturesONE();
}
private function switchPicturesONE():void {
fadeInOne.end();
fadeOutOne.end();
pictureONE.visible = false;
}
private function updateCurrentPicture():void {
currentPicture = pictures[currentIndex];
}
public function set dataProvider(value:Array):void {
pictures = value;
currentIndex = 0;
updateCurrentPicture();
}
public function get dataProvider():Array {
return pictures;
}
]]>
</mx:Script>
Thanks in advance aktell