Archive

Archive for the ‘flash builder’ Category

Using Illustrator, Flash Catalyst and Flash Builder to create an avatar widget

February 6th, 2010 1 comment

bmw_z1Since I have a little more spare time now … I decided to hack a little bit :) . Avatar is the new hype nowadays :) and I wanted to understand how simple (or how complicated) will be to build an avatar widget. So I gave it a try, but instead of a Na’vi avatar, I decided to apply some artwork on top of an BMW Z1 :) .

I’ve made a video with my little workflow that you can watch it here (I couldn’t believe how easy it was).

You can also see the running demo (and download the source files) here.

Debug Flex and PHP using Flash Builder 4 and PDT

July 9th, 2009 4 comments

It took me more that I would have liked but here’s a screencast on how to debug flex and php applications using Flash Builder 4 and PDT.

 

Debug Flex and .NET using ASP.NET Development Server

July 29th, 2008 1 comment

If you followed my previous post you probably now have a Flex + .NET project that makes a WebService call. If not, here’s a project you can use testDotNet.zip. To import this in Flex Builder choose File->Import->Flex Project and follow the steps.

Next open Visual Web Developer and open a Web Site in the same location as the Flex Builder project.  Open web.config and make sure you have <compilation debug=”true”> (this inserts debugging symbols for the .NET code).

Now we need to use the same ASP.NET Developer Server for both the Flex Builder and Visual Web Developer. Since by default both tools try to start one instance we need a little trick to do that:

Start the MXML project through Flex Builder; this will start ASP.NET Developer Server usually on port 3000. Then go to Visual Web Developer; on Project Property Page (Right Click on the Project in the Solution Explorer) click Start Options and select Use Custom Server and enter http://localhost:3000/testDotNet/

image

Start also the .NET project just to connect the Visual Web Developer to the ASP.NET Developer Server instance. Now you will be able to debug both Flex and .NET code:

image

image

Categories: debugging, flash builder, tips & tricks Tags:

Using Import Web Service wizard to connect Flex to .NET

July 28th, 2008 13 comments

Since I was deeply involved in Flex Builder support for working with .NET I thought that it would be a good idea to write some articles on how you can use these technologies together. I will create a “Hello World” project but the focus will be on how you can better make use of the available tools.

For tooling I will be using Flex Builder and Visual Web Developer 2008 Express Edition (VWD).

First let’s create a simple ASP.NET Web Service project using VWD:

image

I slightly modified the HelloWorld method in Service.cs to receive a parameter:

[WebMethod]
public string HelloWorld(String name) {
    return "Hello " + name + "! Nice talking to you!";
}

Now let’s get into Flex Builder and try to get something from the .NET Server. First we will create a new Flex Project on top of the .NET one. To do that click on New->Flex Project and choose ASP.NET as the server technology:

image

Make sure the location is the same as the VWD .NET project. Now run the default MXML file to start the ASP.NET Developer Server.

Next we will generate the glue code for calling the Web Service using the Import Web Service Wizard. Choose Data -> Import Web Service (WSDL) from the Flex Builder menu. On the first page the main source folder is selected by default. You can leave it like this. On the second page you need to choose the WSDL URI. When you launched the MXML application the ASP.NET Developer Server should have started by default on port 3000 (see the tray icon). In this case the WSDL URL should be something like http://localhost:3000/testDotNet/Service.asmx?WSDL.

image

The third page should look like this:

image

Now you should have some typed AS classes that provide easy access the .NET Web Service methods. The cool thing about this is that Flex Builder knows now how to do autocompletion on Web Service calls. So making a little application that will showcase this is just too easy:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import generated.webservices.HelloWorldResultEvent;
            import generated.webservices.Service;
            public function sayHello():void {
                var service:Service = new Service();
                service.addhelloWorldEventListener(
                    function (event:HelloWorldResultEvent):void {
                        Alert.show(event.result);
                    });
                service.helloWorld(myName.text);
            }
        ]]>
    </mx:Script>
    <mx:TextInput x="176" y="171" id="myName"/>
    <mx:Text x="70" y="173" text="Enter Your Name"/>
    <mx:Button x="344" y="171" label="Click to receive greeting" click="sayHello()"/>

</mx:Application>
Categories: flash builder, flex Tags:

AS and Flex Project trick

July 7th, 2008 Comments off

A few days ago I was trying to use the FDS AJAX Bridge to push some messages in an AJAX grid. So I created a Flex + WTP + BlazeDS project and went to change the default Application from the default MXML file to my FDMSBridge.as (The 1×1 pixel SWF). Guess what? You can’t add AS files, only MXML ones

image

This might be a little bug, but I found a workaround. I manually edited .actionScriptProperties file and in the <application> section added the FDMSBridge.as:

<?xml version="1.0" encoding="UTF-8"?>
<actionScriptProperties mainApplicationPath="testBlaze.mxml" version="3">
<compiler additionalCompilerArguments="-services "C:/work/wksp/samples/testBlaze/WebContent/WEB-INF/flex/services-config.xml" -locale en_US" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" rootURL="http://localhost:8080/testBlaze" sourceFolderPath="flex_src" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path=""/>
<libraryPathEntry kind="1" linkType="1" path="flex_libs"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="FDMSBridge.as"/>
<application path="testBlaze.mxml"/>
</applications>
<modules/>
<buildCSSFiles/>
</actionScriptProperties>

Now the FDMSBridge.as should be compiled as a normal Flex application:

image

Categories: flash builder, tips & tricks Tags:

Debugging Flex and PHP with Flex Builder and Zend Studio

June 6th, 2008 2 comments

So I am a big fan of debugging. I know that for most people this isn’t exactly what they get out of the bed in the morning, but nevertheless I know that this prevents them going to sleep in the evening. My first thing when I look into a technology and it’s tools ecosystem is “how will I debug this?”. I find more useful to spend some time configuring my environment for debug earlier in the project rather than later, when things might get hotter.

These days I was looking into Flex and PHP and naturally I started by trying to configure my environment so I can debug this. My goal was to be able to to debug both Flex code and PHP code, to track the dataflow through a server request. I’ve tried different solutions, and here is the simpler one:

Solution

First installed Zend Studio for Eclipse (http://www.zend.com/en/products/studio/downloads). Make sure you install also the Zend Studio Toolbar for your browser.

Next installed the Flex Builder Plugin from (http://www.adobe.com/cfusion/tdrc/index.cfm?product=flex_eclipse) and choose as Eclipse location the folder where you installed Zend Studio (Usually c:\Program Files\Zend\Zend Studio for Eclipse – 6.0.0\ for my Windows machine). You might get the following warning:

image

You just need to follow the 3 steps and it should be fine.

The next thing is to install the Zend Debugger server. I found a good tutorial here so I will not get into much detail.

Now we will create a combined Flex + PHP Project:

  • New -> Flex Project
  • Choose PHP as Application Server Type

image

image

I will use the following MXML File:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="initApp()">
    <mx:Script>
        <![CDATA[
            import mx.rpc.events.ResultEvent;
            import mx.rpc.http.HTTPService;
            var gateway:HTTPService = new HTTPService();

            function initApp() {
                gateway.url = "hello.php";
                gateway.method = "POST";
                gateway.useProxy = false;
                gateway.addEventListener(ResultEvent.RESULT, resultHandler);

            }
            function sendRequest():void {
                gateway.request =  {"name":enteredName.text};
                gateway.send();


            }

            function resultHandler(e:ResultEvent):void {
                myText.text = e.result.toString();
            }
        ]]>
    </mx:Script>
    <mx:Button x="301.5" y="10" label="Send" click="sendRequest()"/>
    <mx:Text id="myText" x="10" y="62" width="493" height="181" fontFamily="Arial" fontSize="36"/>
    <mx:Label x="10" y="12" text="Enter Your Name:"/>
    <mx:TextInput id="enteredName" x="121" y="10"/>
</mx:Application>

and a little hello.php.

<?php
    $name = $_POST['name'];
    echo "Hello $name !";
?>

As a little note, I create the PHP files directly in the bin-debug folder which is a link to the real folder on your local Web Server.

Now to debug the whole thing:

  • From the Flex perspective I choose Debug As -> Flex Application.
  • On the browser go on the Zend Studio Toobar and click on Debug.
  • If there are checked menu items uncheck them first.
  • Check the All Pages on this site

image

  • put some breakpoints both in flex and in php code:

image image

  • Now when you click the Send button in the application you will hit both breakpoints.

I will try to get this working also with Flex Builder and PDT and post an eventual solution. I managed to get something working with Zend Server Debugger with it’s too unstable to call it a solution.

Categories: debugging, flash builder Tags: