Tuesday, March 29, 2011

Web Technologies: Flex 4 usfull plugins

Web Technologies: Flex 4 usfull plugins: "I found and using following plugins into mu Flash Builder 4 1. Ant Build - to be able to write ANT scripts for medium and large projects. T..."

Web Technologies: Flex 4, PHP, MySQL

Web Technologies: Flex 4, PHP, MySQL: "In this blog posting I will show you how to connect Flex to PHP an load MySQL data without writing single line of code. Couple things we ne..."

Web Technologies: Flex Write To File

Web Technologies: Flex Write To File: "Can Flex Write To File? What do You Think? The answer is - YES Below is the Code snippet <?xml version='1.0' encoding='utf-8'?> <s..."

Flex Write To File

Can Flex Write To File?

What do You Think?

The answer is - YES

Below is the Code snippet

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               minWidth="400"
               minHeight="300">

    <fx:Script>
        <![CDATA[
            protected function button1_clickHandler(event:MouseEvent):void
            {
                var fr:FileReference=new FileReference();
                var xml:String='<level>I am writting XML File out</level>';
                var ba:ByteArray=new ByteArray();
                ba.writeMultiByte(xml, 'utf-8');
                fr.save(ba, "myXML.xml");
            }
        ]]>
    </fx:Script>

    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:Button label="Write Out"
              horizontalCenter="0"
              verticalCenter="0"
              height="30"
              width="100"
              click="button1_clickHandler(event)"/>
</s:Application>

You can Download the code: http://www.bestwebpartners.com/BlogData/WriteToClientDisk.mxml

Flex 4 usfull plugins

I found and using following plugins into mu Flash Builder 4

1. Ant Build - to be able to write ANT scripts for medium and large projects. To compile and release projects.
http://download.eclipse.org/releases/galileo/

2. SVN - to keep track of the version and code
http://subclipse.tigris.org/update_1.6.x

3. Code Flex Formatter to make sure your code always looks the same and it is easy to read by someone else
http://flexformatter.googlecode.com/svn/trunk/FlexFormatter/FlexPrettyPrintCommandUpdateSite/

Flex 4, PHP, MySQL

In this blog posting I will show you how to connect Flex to PHP an load MySQL data without writing single line of code.

Couple things we need to install before we start.

1. Flash Builder - https://www.adobe.com/cfusion/tdrc/index.cfm?product=flash_builder
2. MySQL Database - http://dev.mysql.com/downloads/mysql/5.1.html
3. SQL Youg - MySQL Admin - http://www.webyog.com/en/downloads.php or you can use MySQL Administrator - http://dev.mysql.com/doc/administrator/en/

Lets Start!

Step 1:

Create new database:


  • Connect to your database server via SQLyog
  • Right click on root@local and create new database
  • Name it - test





    Step 2:


    Create table:
  • Right Click on test->Tables
  • Add Columns to table: id  - int, name, email, clientIP as varchar(40), make id - primary key

    or just run the following query in Query Window

    CREATE TABLE `subscribers` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` varchar(50) DEFAULT NULL,
      `email` varchar(50) DEFAULT NULL,
      `clientIP` varchar(30) DEFAULT NULL,
      PRIMARY KEY (`id`)
    )

    Step 3:

    Add some test data on the table, my data looks like this:


    Step 4:

    • Open Flash Builder 4 IDE
    • Create new Flex project
    • Select Application server type - PHP
    • I named my project - Flex_PHP_MySQL
    • Switch from Source to Design mode




    Step 5:

    Add label to the application by draging the label from Components panel.
    Add text to label - "Total Count:"
    Add new label next to it - this is our table records counter

    Step 6:

    Right click on second label and and click on Bind to Data...

    Question will popup