BTA Flexing

My passion RIAs…………..Shardul Singh Bartwal

Archive for the ‘Flex 3.0’ Category

Flash,Flex Vs HTML 5

Posted by Shardul Singh Bartwal on February 25, 2012

I was checking the HTML 5 with Java script,CSS 3 and Jquery around since last 4 months.Also was keeping my eyes on this since 2008,but never get inspired to do anything.Now also I found that HTML 5 is still in the state where Flash was 7 to 8 years back.HTML 5 can replace maximum of simple banners and animated advertisements which were created using the flash.For that also the development cost is going to increase and quality will be not up to that extent as the Flash has provided long earlier.

But for the Audio/Video Streaming,Image manipulation,Gaming and Enterprise applications HTML5 needs to take still around 10 years.Also currently I don’t found any thing as impressive as AMF for the Client Server communication over the internet.The reason for this is simply that HTML 5 is also a markup language.You can check the link below,you will realize where the HTML 5 is in reality:-

http://www.w3.org/TR/html5-diff/

So the only thing which I will like to say is that Flash and HTML 5 will be needed in the same way
as earlier they were used together on the web.If you will try to replace Flash by HTML 5 for the small
purpose then you have to pay lot more then flash.And if you will be trying to create the Enterprise Application with HTML 5 then I think you will come back to Flex one day.Flash player is ruling since last 15 plus years,its not so simple to replace that.

Keep Rocking………..

Posted in ActionScript 3.0, Flex, Flex 3.0, Uncategorized | 3 Comments »

Official Flex User Group Tour date announcement started by Adobe

Posted by Shardul Singh Bartwal on January 29, 2012

Its nice to see that adobe has started their International Flex User Group Tour
to discuss their last year ends announcements about Flex and Flash Platform.They
have announced the dates for the North America.

Schedule can be checked at:-

http://blogs.adobe.com/flex/2012/01/announcing-flex-user-group-2012-tour-north-america-dates.html

Waiting for the turn of Asia including India.

Enjoy Flexing…….
Shardul

Posted in ActionScript 3.0, AIR, Flex, Flex 3.0, Flex 4 | Leave a Comment »

Understanding and Uses of index.template.html in Flex Application

Posted by Shardul Singh Bartwal on February 20, 2011

I have seen multiple developers writing the required java-script code if required in their Application~Name.html (means the application html). And if they require using some java script or embedding related stuffs then they are doing in this file. Later on when they build their application the things get lost.
This is more important when you are going to create a flex application in which you have to not put your swf on any another .html or other page of any language by embedding. Means you are going to always use your .html file created by the flex. Then index.template.html is the place where you have to write all these things which you want to be persistent after every build.

Enjoy Flexing………..

Posted in Flex 3.0, Flex 4 | 1 Comment »

Selected tab skining in Flex 3 Tabbar

Posted by Shardul Singh Bartwal on November 22, 2010

I was trying to skin the tab-bar in flex 3.Was facing some issue,as I dot find any particular property for skinning the selected tab,although there is a property ‘selectedTabTextStyleName’ for the style of the selected text. But ultimately it is done.Below is the code for the skinning of the selected tab of the tab-bar hope you will find it worth of your purpose.Below is the same code. Please feel free to give your idea if you have done this by any other way.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
	 layout="vertical">
<mx:Script>
	<![CDATA[
		import mx.collections.ArrayCollection;
	
	         import mx.controls.tabBarClasses.Tab

		[Bindable]
		private var arrayCollection : ArrayCollection = new ArrayCollection([
		{lbl:'Football'},
		{lbl:'Cricket'},
		{lbl:'BollyBall'}
		])
		
		private function setTabSkin():void
		{
		  var tab:Tab = tabBar.getChildAt(tabBar.selectedIndex) as Tab;			  
		  tab.setStyle("fillColors", ["#0xBBBBBB", "#EEEEEE"]);
                  tab.setStyle("backgroundColor", "#999999");
                  tab.setStyle("borderColor", "#000000");
                  tab.setStyle("themeColor", "#222222");
		}
	]]>
</mx:Script>
	<mx:TabBar id="tabBar" itemClick="setTabSkin()" selectedIndex="0" creationComplete="setTabSkin()" dataProvider="{arrayCollection}" labelField="lbl"/>

</mx:Application>

Posted in AIR 2.0, Flex 3.0 | Leave a Comment »

TypeError: Error #2007: Parameter blendMode must be non-null.

Posted by Shardul Singh Bartwal on November 17, 2010

This is the error which make wasted lot of mine time.Finally I get to know that this will appear if we will using
any swc which is created in the advance versions of flex sdk main in 3.3 or 3.4 and we are created the project in the lower version of sdk e.g. 3.2. If you want to come out from this then either go for the higher or equal to the swc version of sdk for the entire application or rebuild your swc with the higher version.Hope this will help you if you will facing this non meaning title error 🙂

Keep rocking……..Enjoy Flexing……

Posted in Flex 3.0, Uncategorized | Leave a Comment »

Protected: Bitmap Text in ActionScript 3.0

Posted by Shardul Singh Bartwal on November 12, 2010

This content is password protected. To view it please enter your password below:

Posted in ActionScript 3.0, Flex 3.0 | Enter your password to view comments.

Byte Array to BitmapData and BitmapData to Byte array in Flex 3.

Posted by Shardul Singh Bartwal on October 14, 2010

In the code below I am initially getting the byte array of my canvas with the increased size. Converting it into Bitmap data.And again converting that Bitmap data into ByteArray. So that you can use the particular step which one you require.

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

<mx:Script>
<![CDATA[
import mx.controls.Alert;

import mx.graphics.ImageSnapshot;
import mx.graphics.codec.JPEGEncoder;

private var imageSnapshot:ImageSnapshot
private function inLargeImage():void
{
var jPEGEncoder:JPEGEncoder = new JPEGEncoder(90);
imageSnapshot = ImageSnapshot.captureImage(imgCanvas,500, jPEGEncoder,true);

//imageSnapshot.data is ByteArray.
byteArrayToBitmapData(imageSnapshot.data);
}

private var loader : Loader = new Loader();
private function byteArrayToBitmapData(byteArray : ByteArray):void
{
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, getBitmapData);
loader.loadBytes(byteArray);
}
private var bitmapData:BitmapData
private function getBitmapData(e:Event):void {
var content:* = loader.content;
bitmapData = new BitmapData(content.width,content.height,true,0x00000000);

var matrix:Matrix = new Matrix();
bitmapData.draw(content, matrix,null,null,null,true);
targetImage.source = new Bitmap( bitmapData );

}

private function saveInLargeImage() : void
{
if(bitmapData == null)
{
Alert.show("InLarge Image first,and then try again.")
return;
}

var encoder:JPEGEncoder = new JPEGEncoder(90);
var byteArray:ByteArray = encoder.encode(bitmapData);
var fr : FileReference= new FileReference();
fr.save(byteArray,'abcd.jpg');
}

]]>
</mx:Script>

<mx:VBox horizontalAlign="center" verticalAlign="middle" width="100%" height="100%">
<mx:VBox id="imgCanvas" width="600" height="450" horizontalAlign="center"
verticalAlign="middle" backgroundColor="0x0000FF">
<mx:Image source="image1.jpg"/>
</mx:VBox>

<mx:Image id="targetImage"/>

<mx:Button click="inLargeImage()" label="Inlarge Image"/>
<mx:Button label="Save To Your Computer" click="saveInLargeImage()"/>
</mx:VBox>

</mx:Application>
<pre>

Hope you will enjoy this……..

Posted in ActionScript 3.0, AIR, Flash Builder 4.6, Flex, Flex 3.0, Flex 4, Uncategorized | Tagged: , , , , , , , , , , , , , , , , , , , , | 2 Comments »

Using Image Inside the Sprite in Flex

Posted by Shardul Singh Bartwal on September 18, 2009

Using Image Inside the Sprite in Flex

If we want to add any Image inside the Sprite class in flex,then It is not possible to add image inside the sprite. But if your requirement is as such in that case you can achieve this by adding the Loader inside the sprite. Below is the code for the same.

MainApplication.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
layout="absolute" creationComplete="createSpriteWithBitmap()">
	<mx:Script>
	<![CDATA[
	import mx.controls.Image;
	private function createSpriteWithBitmap():void
	{
	var sp : SpriteWithBitmap = new SpriteWithBitmap();
	can.rawChildren.addChild( sp );
	}
	]]>
	</mx:Script>
	<mx:Canvas id="can" x="200" y="200"/>
</mx:Application>

SpriteWithBitmap

package 
{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLRequest;

import mx.controls.Alert;

public class SpriteWithBitmap extends Sprite
{
	//Pass the source path or url here. 
	private var url:String = "https://shardulbartwal.files.wordpress.com/2009/09/ssbrose.jpg";

	public function SpriteWithBitmap() 
	{
		loadImg();
	}
	private function loadImg():void 
	{
		var loader:Loader = new Loader();
		loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadFailure);
		var request:URLRequest = new URLRequest(url);
		loader.load(request);
		this.addChild(loader);
	}

	private function loadFailure(event:IOErrorEvent):void
	{
		Alert.show("Can't load :" + url);
	}
}

}

Enjoy Flexing………….

Posted in ActionScript 3.0, Flex, Flex 3.0 | Tagged: , , , | 4 Comments »

Zoom Any container with children In Flex 3.0

Posted by Shardul Singh Bartwal on September 15, 2009

Zooming in Flex

I saw many people searching for the finding solution for zooming functionality. They are normally trying it with the zoom effect or scaling which is very true. But the case is bit sensitive when you have to zoom all the components inside a component and so on. So surly this will be achieved through a recursive function which will zoom each and every control inside a container unto the nth level where a container will not have any more child. Below is the demo application for achieving this. Hope this will be useful for all those who are having such requirement.

For code click on the link below.
ZoomDemo Source Code

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
layout="absolute">
<mx:Script>
<!&#91;CDATA&#91;
import mx.core.Container;
import mx.core.UIComponent;
private function doZoom(component:UIComponent,val:Number):void
{
component.scaleX = val;
component.scaleY = val; 
if(component is Container)
{
var children:Array = Container(component).getChildren();
for(var i:int = 0; i < children.length; i++)
{
doZoom(children&#91;i&#93;, val);
}
}
} 
public function applyZoom():void
{
if(pnl == null)
{
return;
}
doZoom(pnl,zoomSlider.value);
}
&#93;&#93;>
</mx:Script>
<mx:HBox horizontalAlign="right">
<mx:VBox width="700" height="100%">
<mx:Panel id="pnl" width="400" height="400" title="Panel">
<mx:HBox width="100%" height="100%">
<mx:Button label="B1"/>
<mx:Button label="B2"/> 
<mx:Button label="B3"/>
</mx:HBox>
<mx:HBox width="100%" height="100%">
<mx:Button label="B11"/>
<mx:Button label="B21"/> 
<mx:Button label="B31"/>
</mx:HBox>
</mx:Panel> 
</mx:VBox>
<mx:VBox>
<mx:HSlider id="zoomSlider" minimum=".1" value="1"
maximum="2" change="applyZoom()" width="180"/>
<mx:Label text="Apply Zoom"/>
</mx:VBox>
</mx:HBox>
</mx:Application>

Hope you will like this………Enjoy Flexing…

Posted in ActionScript 3.0, Flex 3.0 | Tagged: , , , | 5 Comments »

Rotating Display Object around its Center

Posted by Shardul Singh Bartwal on July 19, 2009

Sometimes back I was looking for how to rotate any component from its Center.But I don’t got any proper solution for that.As all of us know the registration point of the any display object are its top left point i.e (0,0).Hence I used the ‘Rotation Effect’,and used the originX and originY for finding the center of the Display object.But I know that it was not proper solution.Currently I am here with the proper solution.Its very simple to acheive.You can also get the source code from here.Below is the Link.
Click Here For RotationDemo Source Code.

Posted in ActionScript 3.0, Flex 3.0 | 3 Comments »