hai!
just try running the following code.. Actually it should make a vbox bounce from right to left on click and then bounce back to right.. but it doesnot.. It doesnot bounce back it only keeps moving left on evry click.. can u find where i have gone wrong?
regrds,
nithya
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" backgroundColor="#FFFFFF" hScrollPolicy="off">
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" backgroundColor="#FFFFFF" hScrollPolicy="off">
<mx:Script>
var price:Number;
public function setPrice( price:Number ) : Void
{
this.price = price ;
var priceDown = new mx.effects.Move( this.basketTotal );
priceDown.yBy = 20;
priceDown.duration = 100;
var priceUp = new mx.effects.Move( this.basketTotal );
priceUp.yBy = -20;
priceUp.duration = 100;
var soundEffect = new CashSoundEffect();
var priceRegister = new mx.effects.Sequence();
priceRegister.addChild( priceDown );
priceRegister.addChild( priceUp );
priceRegister.addChild( soundEffect );
priceRegister.playEffect();
}
<![CDATA[
function toggleBasketEffect()
{
var currentEffect = basketPanel["mouseDownEffect"];
if ( currentEffect == "basketMoveLeft" )
{
basketPanel["mouseDownEffect"] = "basketMoveRight";
}
else
{
basketPanel["mouseDownEffect"] = "basketMoveLeft";
}
}
function bounce(t, b, c, d)
{
if ((t /= d) < (1 / 2.75))
{
return c * (7.5625 * t * t) + b;
}
else if (t < (2 / 2.75))
{
return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
}
else if (t < (2.5 / 2.75))
{
return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
}
else
{
return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
}
};
]]>
var price:Number;
public function setPrice( price:Number ) : Void
{
this.price = price ;
var priceDown = new mx.effects.Move( this.basketTotal );
priceDown.yBy = 20;
priceDown.duration = 100;
var priceUp = new mx.effects.Move( this.basketTotal );
priceUp.yBy = -20;
priceUp.duration = 100;
var soundEffect = new CashSoundEffect();
var priceRegister = new mx.effects.Sequence();
priceRegister.addChild( priceDown );
priceRegister.addChild( priceUp );
priceRegister.addChild( soundEffect );
priceRegister.playEffect();
}
<![CDATA[
function toggleBasketEffect()
{
var currentEffect = basketPanel["mouseDownEffect"];
if ( currentEffect == "basketMoveLeft" )
{
basketPanel["mouseDownEffect"] = "basketMoveRight";
}
else
{
basketPanel["mouseDownEffect"] = "basketMoveLeft";
}
}
function bounce(t, b, c, d)
{
if ((t /= d) < (1 / 2.75))
{
return c * (7.5625 * t * t) + b;
}
else if (t < (2 / 2.75))
{
return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
}
else if (t < (2.5 / 2.75))
{
return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
}
else
{
return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
}
};
]]>
</mx:Script>
<mx:Panel height="100%" width="700" hScrollPolicy="off">
<!--<mx:Number id="edgeDistance"/>
<mx:Number id="panelWidth" />
<mx:Number id="panelHeight" />-->
<mx:Effect>
<mx:Move name="basketMoveLeft" xBy="295" easing="bounce" duration="1000"/>
<mx:Move name="basketMoveRight" xBy="-295" easing="bounce" duration="1000"/>
</mx:Effect>
<mx:Canvas width="700" height="100%" hScrollPolicy="off">
<mx:HBox borderStyle="solid"
mouseDownEffect="basketMoveRight"
mouseDown="toggleBasketEffect()"
width="47%"
height="100%"
id="basketPanel" x="670" hScrollPolicy="off">
<!-- The “grab bar” -->
<mx:VBox width="25" height="100%"
borderStyle="solid" backgroundColor="#66CCFF" verticalGap="-1">
<mx:Text text="S" fontSize="10" width="15" fontWeight="bold"/>
</mx:VBox>
<mx:Effect>
<mx:Sequence name="productHoverIn">
<mx:Fade alphaFrom="100" alphaTo="50" duration="250" />
<mx:Pause duration="1000" />
<mx:Resize widthTo="150" heightTo="150" duration="1000"/>
</mx:Sequence>
</mx:Effect>
<mx:Effect>
<mx:Parallel name="productHoverOut">
<mx:Fade alphaFrom="50" alphaTo="100" duration="500" />
<mx:Resize widthTo="100" heightTo="100" duration="500" />
</mx:Parallel>
</mx:Effect>
<mx:Loader contentPath="product.jpg" width="100" height="100"
mouseOverEffect="productHoverIn"
mouseOutEffect="productHoverOut"
mouseDown="setPrice(39.99)"
id="product" />
<!-- The Shopping Basket -->
<mx:VBox verticalAlign="bottom">
<mx:Label styleName="title" text="Shopping Basket"/>
<mx:Spacer width="1"/>
<mx:Label text="Basket Empty" />
<mx:Spacer height="1"/>
<mx:VBox id="basketTotal">
<mx:TextArea editable="false"
borderStyle="none"
styleName="price" text="{price}"/>
</mx:VBox>
</mx:VBox>
</mx:HBox>
</mx:Canvas>
</mx:Panel>
</mx:Application>
<mx:Panel height="100%" width="700" hScrollPolicy="off">
<!--<mx:Number id="edgeDistance"/>
<mx:Number id="panelWidth" />
<mx:Number id="panelHeight" />-->
<mx:Effect>
<mx:Move name="basketMoveLeft" xBy="295" easing="bounce" duration="1000"/>
<mx:Move name="basketMoveRight" xBy="-295" easing="bounce" duration="1000"/>
</mx:Effect>
<mx:Canvas width="700" height="100%" hScrollPolicy="off">
<mx:HBox borderStyle="solid"
mouseDownEffect="basketMoveRight"
mouseDown="toggleBasketEffect()"
width="47%"
height="100%"
id="basketPanel" x="670" hScrollPolicy="off">
<!-- The “grab bar” -->
<mx:VBox width="25" height="100%"
borderStyle="solid" backgroundColor="#66CCFF" verticalGap="-1">
<mx:Text text="S" fontSize="10" width="15" fontWeight="bold"/>
</mx:VBox>
<mx:Effect>
<mx:Sequence name="productHoverIn">
<mx:Fade alphaFrom="100" alphaTo="50" duration="250" />
<mx:Pause duration="1000" />
<mx:Resize widthTo="150" heightTo="150" duration="1000"/>
</mx:Sequence>
</mx:Effect>
<mx:Effect>
<mx:Parallel name="productHoverOut">
<mx:Fade alphaFrom="50" alphaTo="100" duration="500" />
<mx:Resize widthTo="100" heightTo="100" duration="500" />
</mx:Parallel>
</mx:Effect>
<mx:Loader contentPath="product.jpg" width="100" height="100"
mouseOverEffect="productHoverIn"
mouseOutEffect="productHoverOut"
mouseDown="setPrice(39.99)"
id="product" />
<!-- The Shopping Basket -->
<mx:VBox verticalAlign="bottom">
<mx:Label styleName="title" text="Shopping Basket"/>
<mx:Spacer width="1"/>
<mx:Label text="Basket Empty" />
<mx:Spacer height="1"/>
<mx:VBox id="basketTotal">
<mx:TextArea editable="false"
borderStyle="none"
styleName="price" text="{price}"/>
</mx:VBox>
</mx:VBox>
</mx:HBox>
</mx:Canvas>
</mx:Panel>
</mx:Application>
Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.