It is so cool if show your products in 360 degree view on your website to your customer? In fact it is not difficult to realize after you read the following example. First you need prepair a serial images about your products in different views. The basic principle is by using SliderBar to control the image. Generally, you will meet the problem: how to avoid the image flickering when move the sliderbar? Then it have told you the answer. Using loader component which could avoid flickering. Components Sequence, Canvas and TextArea are also used in this example. More details please see the following source
- <?xml version=“1.0“ encoding=“utf-8“?>
- <mx:Application xmlns:mx=“http://www.adobe.com/2006/mxml“ layout=“absolute“ backgroundGradientAlphas=“[1.0, 1.0]“
- backgroundGradientColors=“[#FFFFFF, #FFFFFF]“ creationComplete=“init()“ viewSourceURL=“srcview/index.html“>
- <mx:Script>
- <![CDATA[
- private function init():void{
- myFade.play();
- myFade2.play();
- myCanvas.alpha = 0;
- }
- //Use SliderBar to show the image in 360 view
- private function onChange():void{
- //Use loader component to avoid flickering
- var loader:Loader = new Loader();
- loader.load( new URLRequest( “aliceImage/“+ int(hs.value)+ “.jpg“ ) );
- loader.contentLoaderInfo.addEventListener(Event.COMPLETE , function ():void{
- myImage.source = loader;
- });
- }
- ]]>
- </mx:Script>
- <mx:Sequence id=”myFade”>
- <mx:Pause duration=”1000″/>
- <mx:Fade target=“{myCanvas}“ alphaFrom=“0“ alphaTo=“100“ duration=“10000“/>
- </mx:Sequence>
- <mx:Sequence id=“myFade2“ target=“{myCanvas2}“ effectEnd=“{comment.visible = true;}“>
- <mx:Pause duration=“1500“/>
- <mx:Parallel>
- <mx:Move yTo=”{myCanvas2.y +10}”/>
- </mx:Parallel>
- </mx:Sequence>
- <mx:Canvas id=“myCanvas“ backgroundImage=“DSC_0074.jpg“ width=“1002“ height=“721“ x=“0“ y=“0“ borderColor=“#FFFFFF“ themeColor=“#B1E1FF“ alpha=“0.85“>
- <mx:Canvas id=“myCanvas2“ width=“328“ height=“344“ x=“644“ y=“10“ cornerRadius=“10“>
- <mx:Image id=“myImage“ x=“10“ y=“-4“ width=“317“ height=“309“ source=“aliceImage/1.jpg“/>
- <mx:HSlider id=”hs” x=”10″ y=”313″ change=”onChange()” value=”0″ minimum=”1″ maximum=”20″ enabled=”true” liveDragging=”true” snapInterval=”1″ allowTrackClick=”true” width=”305″/>
- </mx:Canvas>
- </mx:Canvas>
- <mx:TextArea alpha=“0“ visible=“false“ showEffect=“myBlur2“ id=“comment“ x=“690“ y=“396“ width=“258“ height=“77“ backgroundAlpha=“0.1“ editable=“false“ borderStyle=“solid“ borderThickness=“0“>
- <mx:text><![CDATA[1/8 PoP Wonderland Alice in Wonderland
- Sells Day?Mar.2008?Maker?alter
- Price?60$ 15% off
- Maker Suggested Price?65$]]></mx:text>
- </mx:TextArea>
- </mx:Application>