i have a simple xml gallery ( ViewNavigatorApplication ), first view is thumb and second view named as “SlideView”.
All views change are happening nicely using SlideTransition to each other from “navigation content area buttons”
SlideView has an image control, showing each image at a time. In slide view , i detect slide gestures and it change source property of image control and new image pops up.
Problem is, i want new image to slide in each time, when source property (which is binded to current slide). any ideas?
current slide view basic code is like
protected function swipeGestureHandler(event:TransformGestureEvent):void
{
if (event.offsetX == -1) {
_dm.currItem.nextSlide();
}
else if (event.offsetX == 1 ) {
_dm.currItem.prevSlide();
}
}
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:Image id="slideImage" visible="true" width="100%" height="85%"
source="{_dm.currItem.currSlide}" />
i tried defining some effects in fx declaration area like
<fx:Declarations>
<s:Wipe id="wipeOut" direction="left" duration="500" />
<s:Wipe id="wipeIn" direction="right" duration="500" />
<s:Move id="MoveLeft" target="{slideImage}" xBy="300" duration="500"/>
<s:Move id="MoveRight" target="{slideImage}" xBy="-300" duration="500"/>
</fx:Declarations>
and using them in image control like
hideEffect="{MoveLeft}" showEffect="{MoveRight}"
but its of no use…
any ideas, please help..
You are close. The show/hide events won’t get generated when you change the
Image‘s source. Instead, trigger these effects manually yourself when the user makes a swipe gesture.MoveLeft.play()(assumes that thetargetof the effect is the Image)MoveRight.play()To polish this effect, you might want to have two
Imageobjects in your view. When transitioning to the next image, you can set the source of the otherImageobject to the new value before playing any effects (to try and pre-load the image).