Tuesday, December 22, 2009

component lifecycle. implementation..

http://livedocs.adobe.com/flex/3/html/help.html?content=ascomponents_advanced_3.html

Monday, December 21, 2009

Good Example For CusomComponent and CustomPopup to..

http://blog.flexexamples.com/2007/08/06/creating-custom-pop-up-windows-with-the-popupmanager-class/

Thursday, December 17, 2009

File Upload Component

http://www.flex888.com/296/9-flex-file-upload-examples-visited.html

PrelaodingImages /swf using custom Preloader





import mx.controls.Alert;
import flash.utils.Timer;
import mx.controls.List;
import mx.collections.ArrayCollection;
import mypack.CustomPreloader;


/**
* Example for Loading Images before Laoding.. Here the images are loaded into images_ary once they are completly loaded using Custom Preloader...
*
* */
public var mycollection:ArrayCollection = new ArrayCollection([
{id: 4, filename: 'amalfi-bw.jpg', width:700, height:400,duration:3000,path:"http://www.themxlab.com/images/wallpaper/wallpaper_main_jpg/the_mx_lab-wallpaper16.jpg"},
{id: 4, filename: 'amalfi-bw.jpg', width:700, height:400,duration:3000,path:"http://www.shrani.si/f/2L/oL/2yFebWXf/bliss-600dpi.jpg"},
{id: 4, filename: 'amalfi-bw.jpg', width:700, height:400,duration:3000,path:"http://www.ultrahd.name/ultrahd_wallpapers/chrome38blue-7680x3200.jpg"},
{id: 4, filename: 'amalfi-bw.jpg', width:700, height:400,duration:3000,path:"http://www.proaerialvideo.com/wallpapers/hawaii.jpg"},
{id: 2, filename: 'Hippo.jpg', width:600, height:400,duration:3000,path:"http://lsst.astro.washington.edu/images/ImageSimColorLarge.jpg"},
{id: 3, filename: 'amalfi.jpg', width:600, height:400,duration:3000,path:"http://helpexamples.com/flash/images/image1.jpg"},
{id: 4, filename: 'amalfi-bw.jpg', width:700, height:400,duration:3000,path:"http://wall-efans.com/images/JPEG/wp-6.jpg"}]);


private var images_ary:ArrayCollection= new ArrayCollection();
private var currentImage:Number=0;
[Bindable] private var timer:Timer
function ImageLoader()
{
for(var i:Number=0;i< mycollection.length;i++)
{ var obj:Object = mycollection.getItemAt(i);
loadImage(obj.path);
}
}

function loadImage(url:String)
{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded);
loader.load(new URLRequest(url));
}

function onImageLoaded(e:Event)
{
var image:LoaderInfo = e.target as LoaderInfo;
// var image:Bitmap =new Bitmap(Bitmap(e.target.content).bitmapData.clone());
images_ary.addItem(image);
currentImage++;
if(currentImage < mycollection.length)
loadImage(mycollection.getItemAt(currentImage).path);
}

function getImages():ArrayCollection
{
return images_ary;
}
private function loadimages()
{
timer= new Timer(5000,images_ary.length);
timer.stop();
timer.start();
timer.addEventListener(TimerEvent.TIMER,callmethod);
}

var temp:int=0;
var l:LoaderInfo;
var myimagecollection:ArrayCollection = new ArrayCollection();

private function callmethod(evt:TimerEvent)
{
/*myimage.addItem(images_ary.pop() as Object);
l = myimage.getItemAt(temp) as LoaderInfo;
Alert.show("BytesLoaded"+l.bytesLoaded);
Alert.show("Total Bytes"+l.bytesTotal);
Alert.show("Bytes"+l.bytes);
imageloader.source = l.content;
temp++;*/
l= images_ary.getItemAt(temp) as LoaderInfo;
imageloader.source = l.content;
temp++;
}
]]>















package mypack
{
import flash.display.*;
import flash.utils.*;
import flash.events.*;
import flash.net.*;
import mx.preloaders.*;
import mx.events.*;

public class CustomPreloader extends Sprite
implements IPreloaderDisplay
{
// Define a Loader control to load the SWF file.
private var dpbImageControl:flash.display.Loader;

public function CustomPreloader() {
super();
}

// Specify the event listeners.
public function set preloader(preloader:Sprite):void {
// Listen for the relevant events
preloader.x = (stage.stageWidth-preloader.width)/2;
preloader.y = (stage.stageHeight-preloader.height)/2;
preloader.addEventListener(
ProgressEvent.PROGRESS, handleProgress);
preloader.addEventListener(
Event.COMPLETE, handleComplete);

preloader.addEventListener(
FlexEvent.INIT_PROGRESS, handleInitProgress);
preloader.addEventListener(
FlexEvent.INIT_COMPLETE, handleInitComplete);
}

// Initialize the Loader control in the override
// of IPreloaderDisplay.initialize().
public function initialize():void {
dpbImageControl = new flash.display.Loader();
dpbImageControl.contentLoaderInfo.addEventListener(
Event.COMPLETE, loader_completeHandler);
dpbImageControl.load(new URLRequest("preloader.swf"));
}

// After the SWF file loads, set the size of the Loader control.
private function loader_completeHandler(event:Event):void
{
addChild(dpbImageControl);
dpbImageControl.width = 50;
dpbImageControl.height= 50;
dpbImageControl.x = 100;
dpbImageControl.y = 100;
}

// Define empty event listeners.
private function handleProgress(event:ProgressEvent):void {

}

private function handleComplete(event:Event):void {
}

private function handleInitProgress(event:Event):void {
}

private function handleInitComplete(event:Event):void {
var timer:Timer = new Timer(2000,1);
timer.addEventListener(TimerEvent.TIMER, dispatchComplete);
timer.start();
}

private function dispatchComplete(event:TimerEvent):void {
dispatchEvent(new Event(Event.COMPLETE));
}

// Implement IPreloaderDisplay interface

public function get backgroundColor():uint {
return 0;
}

public function set backgroundColor(value:uint):void {
}

public function get backgroundAlpha():Number {
return 0;
}

public function set backgroundAlpha(value:Number):void {
}

public function get backgroundImage():Object {
return undefined;
}

public function set backgroundImage(value:Object):void {
}

public function get backgroundSize():String {
return "";
}

public function set backgroundSize(value:String):void {
}

public function get stageWidth():Number {
return stage.width/2;
}

public function set stageWidth(value:Number):void {
}

public function get stageHeight():Number {
return stage.height/2;
}

public function set stageHeight(value:Number):void {
}
}
}

Preloader cool Example

http://askmeflash.com/article_m.php?p=article&id=7

Wednesday, December 16, 2009

PreLoading Images and SWF Files





/**
* Example for Loading Images before Laoding.. Here the images are loaded into images_ary once they are completly loaded...
*
* */

import mx.controls.List;
import mx.collections.ArrayCollection;

public var mycollection:ArrayCollection = new ArrayCollection([
{id: 2, filename: 'Hippo.jpg', width:600, height:400,duration:3000,path:"Hippo.jpg"},
{id: 4, filename: 'amalfi-bw.jpg', width:700, height:400,duration:3000,path:"Hippo.jpg"},
{id: 1, filename: 'Car Abonded', width:400, height:400,duration:3000,path:"Hippo.jpg"}
]);


private var images_ary:Array= new Array();
private var currentImage:Number=0;
function ImageLoader()
{
for(var i:Number=0;i< mycollection.length;i++)
{
var obj:Object = mycollection.getItemAt(i);
loadImage(obj.path);
}
}

function loadImage(url:String)
{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded);
loader.load(new URLRequest(url));
}

function onImageLoaded(e:Event)
{
var image:Object = new Object();
image= e.target as Object;
// var image:Bitmap =new Bitmap(Bitmap(e.target.content).bitmapData.clone());
images_ary.push(image);
currentImage++;
if(currentImage < mycollection.length)
loadImage(mycollection.getItemAt(currentImage).path);
}

function getImages():Array
{
return images_ary;
}

private function loadimages()
{
var temp:int=0;
var l:LoaderInfo;
var myimage:ArrayCollection = new ArrayCollection();
for each(var num in images_ary)
{
myimage.addItem(images_ary.pop() as Object);
l = myimage.getItemAt(temp) as LoaderInfo;
imageloader.source = l.content;
temp++;
}
}

]]>










BiSuite Using Flex..

Hi All,


Any one want to wish to develop a BusinessIntelligenceSuite,Custom REporting using Flex and Open Source Technologies..


Then i am here for u..