BTA Flexing

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

Archive for June, 2008

3D in Flex 3

Posted by Shardul Singh Bartwal on June 20, 2008

Using Google SketchUp File into Flex 3


 3D in flex! Yes, we all know that it is possible but how to implement? Here I am with the solution for this. One thing more if we are going to use 3D in flex then hmmm… I think we should also go for the ‘Google SketchUp to pickup the 3d.By doing so we will also get the way to use the Google SketchUp with flex. So let start step by step for doing this.

1)      If you are not having the Google SketchUp you can get it from here. Just download it and install.


2)      Now simply create you 3D in Google SketchUp.


3)      After creating your 3D just go to ‘File’ Menu. Then ‘Export ’submenu and then ‘3D Model’.

File    >>   Export   >> 3D Model.

Then save you 3D with .kmz extension. Let I am giving my file the name ‘abc’ so it will be saved as ‘abc.kmz’.


4)      Now a very stylish step….just rename your abc.kmz to Now unzip    

Your ‘’.There will be a folder ‘model’.Just open it and find your ‘abc.dae’ file.This .dae extension shows the file of collada type, which is supported by the flex. You can close the Google SketchUp now.


5)   Now you require the PaperVision 3D.Download it from here. Now unzip it and open the folder Papervision3D_1_5, inside it open PV3D_1_5.Here is a folder src also open it. Now just copy com and org folder from here and paste them into the src folder of your flex application.


6)  In your flex application create a folder asset and paste the abc.dae file of step 4 into it.


      7) Now…………just copy and paste the code below into your main mxml.





<?xml version=”1.0″ encoding=”utf-8″?>

<mx:Application xmlns:mx=”





import mx.core.UIComponent;

import org.papervision3d.scenes.Scene3D;

import org.papervision3d.cameras.Camera3D; 

import org.papervision3d.objects.DisplayObject3D;

import org.papervision3d.render.BasicRenderEngine;

import org.papervision3d.objects.parsers.DAE;

import org.papervision3d.view.Viewport3D;



private var myCam:Camera3D = new Camera3D(); 

private var objScene:Scene3D = new Scene3D();

private var objRenEngin:BasicRenderEngine = new BasicRenderEngine();

private var objViewport3D:Viewport3D = new Viewport3D(10,10,true,true);



private var objCls:Class;


private function init(event:Event): void


 var objUIComponent:UIComponent = new UIComponent();

 v1.addChild(objUIComponent );


 var objDAE:DAE = new DAE();

 objDAE.load(XML(new objCls() ) );

 var model:DisplayObject3D = objScene.addChild( objDAE );







private function enterFrameHandler(event:Event):void






<mx:VBox id=”v1” width=”100%” height=”100%/>






Now run your application…………..and see 3D in flex 




Enjoy flexing………………




Posted in Flex 3.0 | Tagged: | Comments Off on 3D in Flex 3

Using Multiple Methods of a WebService In Flex 3.0

Posted by Shardul Singh Bartwal on June 12, 2008

One of my friend ask me about how to access multiple methods of a web Service.

I have created a web service which is having 4 methods. Three of them are just returning

a text String. While there is method ‘Login’ which accepts two arguments both of string

type and returns two diffent of text messages depending upon the argument passed. If  u

Pass “Admin” as first argument and also “Admin” as the second argument then it returns

“Login Success” otherwise “Loging Failed”.

            Here is the code of the webservice as well as the flex implementation of it.

Hope it will help you.





using System;

using System.Web;

using System.Web.Services;

using System.Web.Services.Protocols;


[WebService(Namespace =;)]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class Service : System.Web.Services.WebService


    public Service () {


    private string userid=“”;

    private string pwd=“”;

    private string loginResult = “”;



    public string Login(string _userid ,string _pwd)


         this.userid =_userid;

         this.pwd = _pwd;

        if ((_userid == “Admin” )&&(_pwd == “Admin”))


            loginResult = “Loging Success”;




            loginResult = “Loging Failed”;


        return loginResult;




    public string HelloWorld() {

        return “Hello World”;




    public string HiWorld()


        return “Hi World”;




    public string BiWorld()


        return “Bi World”;






Flex Application MXML


<?xml version=”1.0″ encoding=”utf-8″?>

<mx:Application xmlns:mx=”” layout=”absolute


 <myService:Service id=”myService>


<mx:HBox width=”100%” height=”100%” horizontalAlign=”center>

            <mx:VBox width=”300” height=”300” horizontalAlign=”center>

              <mx:Button id=”myButton” label=”Call hiWorld Method Of WebService” click=”myService.hiWorld()” /> 

              <mx:Label id=”l1” text=”{myService.hiWorld_lastResult}/>


            <mx:VBox width=”300” height=”300” horizontalAlign=”center>

              <mx:Button id=”myButton1” label=”Call helloWorld Method Of WebService” click=”myService.helloWorld()” /> 

              <mx:Label id=”l2” text=”{myService.helloWorld_lastResult}/>


            <mx:VBox width=”300” height=”300” horizontalAlign=”center>

              <mx:Button id=”myButton2” label=”Call biWorld Method Of WebService” click=”myService.biWorld()” /> 

              <mx:Label id=”l3” text=”{myService.biWorld_lastResult}/>


            <mx:VBox width=”300” height=”300” horizontalAlign=”center>

              <mx:Button id=”myButton3” label=”Call Login Method Of WebService” click=”myService.login(‘Admin’,‘Admin’)”/> 

              <mx:Label id=”l4” text=”{myService.login_lastResult}/>









Enjoy Flexing………………



Posted in Flex 3.0 | Leave a Comment »