how to show random showEffect and hideEffect when viewStack changes.


hi ,

i using viewstack show multiple pages.

when user navigates between pages want show following effects randomly
wipeup, wipedown, wiperight, wipeleft , dissolve etc.. showeffect , hideeffect each page,.

to this, have taken array store id of effects (wipeup, wipedown .....).
when viewstack changes, assigning random value array object binded viewstack page hideeffect , showeffect.
but not working, initial value have assingned object value taking . not changing randomly

anyone me how this.

i have tried in following way.

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

<![cdata[
import mx.collections.arraycollection;
import mx.controls.alert;

private var hideeffectarr:array=new array(["mywd"],["mydsolve"],["mywu"],["mywl"],["irisout"],["mywr"]);
private var showeffectarr:array=new array(["mywu"],["mydsolve"],["mywd"],["mywr"],["irisin"],["mywl"]);

[bindable]
private var randomeffectvalue:object = {hidevalue:"mywd",showvalue:"mywu"};

private function randomeffect():void{

var r1:int=math.round(math.random()*10)

if(r1<6){
randomeffectvalue.showvalue=showeffectarr[r1];
randomeffectvalue.hidevalue=hideeffectarr[r1];
} else{
randomeffectvalue.showvalue=showeffectarr[0];
randomeffectvalue.hidevalue=hideeffectarr[0];
}
}


]]>

</mx:script>

<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}" change="randomeffect()">

<mx:canvas id=" chrysler " label=" chrysler "
hideeffect="{randomeffectvalue.hidevalue}" showeffect="{randomeffectvalue.showvalue}">
<mx:vbox>


<mx:label text="chrysler cars"/>
<mx:image source="@embed(source='assets/town.png')" />
</mx:vbox>
</mx:canvas>
<mx:canvas id="hondainfo" label="honda info"
hideeffect="{randomeffectvalue.hidevalue}" showeffect="{randomeffectvalue.showvalue}">


<mx:vbox>
<mx:label text=" honda info"/>
<mx:image source="@embed(source='assets/element.png')" />
</mx:vbox>
</mx:canvas>
<mx:canvas id="fordinfo" label="ford info"
hideeffect="{randomeffectvalue.hidevalue}" showeffect="{randomeffectvalue.showvalue}">
<mx:vbox>
<mx:label text="ford info"/>
<mx:image source="@embed(source='assets/fordgt.png')" />
</mx:vbox>
</mx:canvas>
</mx:viewstack>
</mx:vbox>
</mx:application>


thanks in advance

regards
avanthika






More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support