Thursday, January 8, 2009

How to play multiple effect at one time

Here is a quick example of playing multiple effects at one time in flex. if you try to run multiple effect w/o put them in a parallel effect, they just wont work. You have put all your effect in parallel effect to play them simultaneously.

<?xml version="1.0"?>
<!-- Simple example to demonstrate the Parallel effect. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:Parallel id="expand" target="{img}">
<mx:Move xTo="{canvas.width/2 - 50}" yTo="{canvas.heig
ht/2 - 100}"/>
<mx:Resize widthTo="100" heightTo="200"/>
</mx:Parallel>

<mx:Parallel id="contract" target="{img}">
<mx:Move xTo="20" yTo="20"/>
<mx:Resize widthTo="30" heightTo="60"/>
</mx:Parallel>

<mx:Panel title="Parallel Effect Example" width="100%"
; height="100%"
paddingTop="10" paddingLeft="10" paddingRight="
10" paddingBottom="10">

<mx:Text width="100%" color="blue"
text="Use the Button controls to move and resize the phone imag
e in parallel."/>

<mx:Canvas id="canvas" width="100%" height="
100%">
<mx:Image id="img" x="20" y="20" wi
dth="30" height="60"
source="@Embed(source='assets/Nokia_6630.png')"/>
</mx:Canvas>

<mx:ControlBar>
<mx:Button label="Expand" click="expand.end(); exp
and.play();"/>
<mx:Button label="Contract" click="contract.end();
contract.play();"/>
</mx:ControlBar>

</mx:Panel>
</mx:Application>

I hope this will help. This example is from Flex Help. You can find more on it here

Thanks

Sunday, December 14, 2008

Add scrollbar to the left corner of VBox

Just a quick tip:

Many of us including me are trying to adding scrollbars in the left side of the containers instead of the right side:

Here is a solution, may be you have already found it somewhere.

1. Create a custome component extending it to VBox.
2. override its updateDisplayList method in the following way:

protected override function updateDisplayList( w:Number, h:Number ):void
{
super.updateDisplayList( w, h );

if( verticalScrollBar && verticalScrollBar.visible )
{
verticalScrollBar.scrollRect = new Rectangle(w,0,-w,h);
}
}

3. You are done ;)

Monday, June 2, 2008

Importing Component classes in Flash CS3

Just to Note:
Components in Flash CS3 must appear within the library, even if you want to use them programmatically.

Wednesday, March 12, 2008

Access an ovelapped Button in flex

If you have a component which is overlapping a button, you will not able to access that button. To access a mouse event on that button, you should have to set the mouse children property of the above component to false.

For example:

myabovecomponent.mouseChildren = false;

Removing Focus from any flex Component

Days are gone when we use _focusrect in flash to remove the ugly yellow focus from focussed movieclip/buttons. In flex we can remove focus from particular component by setting its focusalpha style to 0.

For example suppose you want to remove focus from TextArea component you can use:

mytextareainstance.setStyle("focusAlpha",0);

Hope this will help.

Wednesday, December 5, 2007