1 Reply Latest reply on Sep 14, 2006 6:52 AM by inlineblue

    how to show random effects for showEffect and hideEffect when viewstack changes

      Hi all,

      I have used viewstack to display different pages.
      When ever i move to next page in the viewstack. i want some random effect to play.
      when viewstack changes, I want each time hideEffect and showEffect should take different values
      for example page can have effects WipeUp, WipeDown, WipeRight etc..

      these effects randomly i want to show.

      so what i did is , i stored the id value's of all those effects ( WipeUP, WipeDown ......) in an Array.

      whenever viewstack changes i am taking a randow value from this array and assing to an object which is binded to showEffect and hideEffect of canvas component. but this is not working.
      only initial value of the object only it is taking every time,
      will anyone please tellme how to do this., I hope you understood what i really want.

      Following is the sample code which i tried.

      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" >
      <mx:Script >

      import mx.collections.ArrayCollection;
      private var hideEffectArr:Array=new Array(["myWD"],["myDsolve"],["myWU"],["myWL"],["irisOut"],["myWR"]);
      private var showEffectArr:Array=new Array(["myWU"],["myDsolve"],["myWD"],["myWR"],["irisIn"],["myWL"]);
      private var randomEffectValue:Object={hideValue:"myWD",showValue:"myWU"};
      private function randomEffect():void{
      var r1:int=Math.round(Math.random()*10)
      } else {



      <mx:WipeUp id="myWU" duration="1000"/>
      <mx:WipeDown id="myWD" duration="1000"/>
      <mx:WipeRight id="myWR" duration="2000"/>
      <mx:WipeLeft id="myWL" duration="2000"/>
      <mx:Dissolve id="myDsolve" duration="2000"/>
      <mx:Iris id="irisOut" duration="1000" showTarget="true"/>
      <mx:Iris id="irisIn" duration="1000" showTarget="false"/>

      <mx:VBox >
      <mx:LinkBar dataProvider="{myViewStack}" borderStyle="solid"
      backgroundColor="#EEEEFF" />
      <mx:ViewStack id="myViewStack" borderStyle="solid" width="100%" creationCompleteEffect="{myWR}"
      <mx:Canvas id=" chrysler " label=" Chrysler "
      hideEffect="{randomEffectValue.hideValue}" showEffect="{randomEffectValue.showValue}" >
      <mx:Label text="Chrysler cars"/>
      <mx:Image source="@Embed(source='assets/town.png')" />
      <mx:Canvas id="hondaInfo" label="Honda Info"
      hideEffect="{randomEffectValue.hideValue}" showEffect="{randomEffectValue.showValue}">
      <mx:Label text=" Honda Info"/>
      <mx:Image source="@Embed(source='assets/element.png')" />
      <mx:Canvas id="fordInfo" label="Ford Info"
      hideEffect="{randomEffectValue.hideValue}" showEffect="{randomEffectValue.showValue}">
      <mx:Label text="Ford Info"/>
      <mx:Image source="@Embed(source='assets/fordGT.png')" />

      Thanks in advance