PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
“Collect All” To Make Professional Mobile Application in Flash Lite 1.1 Enable Device
A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 47

Thread: “Collect All” To Make Professional Mobile Application in Flash Lite 1.1 Enable Device

  1. #1
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    “Collect All” To Make Professional Mobile Application in Flash Lite 1.1 Enable Device

    This will be a free online discussion of making a professional mobile application with all the aspect needed for a successful application, ready to go to the client and to the users. Or you can say a tutorial with everything to built up a professional mobile application.
    What ever experience you have or not in the programming or designing, we will discus in detail in-depth of every issue from both users and client point of view. We will discus every bits of method and tricks with real world scripting and all other languages associated with Flash Lite 1.1. (ColdFusion, CGI ASP, PHP, or Perl script, MySQL database .txt file etc).

    So let’s start:
    As a matter of small size screen, little processing speed and limited memory space, Flash Lite can play a very good role in front-end and can handle dynamic objects. Programs that are object oriented.
    There are many articles about Why Flash Lite? But here, Why Flash Lite 1.1?
    The answer is very simple, this discussion is “from the beginning to the end” of mobile application in flash. And from Flash Lite 1.1 Adobe started to fight with mobile market with other programming languages, and the flash developer got a chance to explore there intellect to a new professional world.

    What Flash Lite 1.1 can do, and what other languages can help?
    You will need to know what this little player can do, and what task will we give to do in a small device. Actually you will find in latter discussion How to handle a total application project. Flash Lite 1.1 has all the features that a professional platform need. The question is how to handle it. If you are new to flash then read the entire discussion of every issues, either you can skip those you know. Basically I use Flash only to handle the front-end programming and user interface. Thanks to Adobe to built such a platform which can able to handle external languages from device and also from the server. You also need to know what the other languages can help to build a Flash Lite Application. As like a web base application which reflects in a browser through html tags, are totally depends on server side languages and the browser capabilities with the help of many plugins. Actually the front-end of a web application interact with the users by the help of back-end programming languages. So, to make an application on mobile with Flash Lite you can just depend on the server side programming with the dynamic interactivity capabilities and power of Flash Lite.
    What an Application Need?
    1. Text Information.
    2. Pictures.
    3. Sound.
    4. Video.
    5. Security.
    6. Validation.
    7. Popularity.
    8. Interactivity.
    9. And obvious the Money.

    So if this is the basic need of a user then Flash Lite cannot build the total application without the help of some other programs. To fulfill the above need of an application you need a space where you store all the stuffs which all users can interact with it. Mean you have to have a server space along with a domain name. That is not enough. To make an organized application which can interact faster with users you also need an organized storage to keep all the information or data for your application. That means a Database which holds the data. Flash Lite cannot handle database directly as it is not a server side program. So you also need a server side language support for your Flash Lite application. As I mentioned earlier, Flash Lite can reads data from an external file, such as a text file or text generated by a ColdFusion, CGI ASP, PHP, or Perl script. A .txt file extension is not a programming language but other which mentioned above are the language by which you can interact with Flash Lite by passing information and get a result as it send.
    To build an application you need:
    1. Flash.
    2. Server space with a domain name.
    3. A database support.
    4. A server side language support.



    continue...

    marlopax

    Tuesday, August 11, 2009.
    Last edited by marlopax; 08-10-2009 at 05:26 PM.

  2. #2
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Use of a localhost server.

    At first we need some test to go to the final real time experiment. This is the thing you need always to develop a dynamic application.
    Before you book a domain and test your application to that server, install a local server on your own computer so that you can develop your application whenever you want without have a net connection on your machine.
    What is a Localhost Server?
    Servers are actually machines that store web sites on the internet. The programs that control the access of users to those web sites are also referred to as servers. The most popular of those programs is the free Apache server.
    You can download and install the Apache Server program on your Windows machine, and create an environment similar to the internet right on your computer.
    There are many free software over internet by which can install a localhost server in a very simple installation process. I can suggest you a very light weight localhost server software with a very specific configuration for your application development.
    “WampServer”, You can get it in this link bellow:
    http://www.wampserver.com/en/download.php
    Download and install it in a drive where you want to install. Read the instruction of wampserver how to install and run on your computer. When you run the server on your computer without an actual connection to the internet it will act as a real web server is called a localhost server.
    How to use this localhost?
    After installation you can see an icon on your system tray where the system clock is. By clicking the icon a menu will popup from where you get the option to start the service. Click “Start All Service” and then open internet explorer and type in the address localhost. If all are going correct you will see a wampserver welcome page display on the explorer. Type "http://localhost/?phpinfo=1" or click on the phpinfo() from the tools section bellow of that welcome page. A long listed page will appear of php information.
    You might think, why php? Because this wampserver support php language and a database called mysql. Not only for that, there is also a big reason to start with php. You can find all the reasons and benefits of php language in net. Very honestly speaking I am more comfortable in this language than other server side language. But in this discussion forum thread I will discus all the other languages which can interact with Flash Lite 1.1.
    So, now you are ready to speak from a server. Do some experiment with this server first. Browse the installation folder of wamp (example: c:\wamp). Inside the wamp folder you will find a folder named “www” open that folder. Now you open a .txt file from notepad which is the default text editor of windows and save in that www folder by any name (example: test.txt) and put some text into it and save it. Open internet explorer and type"http://localhost/test.txt", you can see the text in the browser page which you put in the test.txt file. Your fist server experiment is success, Congratulation. So, this is the way to interact with server by putting stuffs in the www folder and browse it in internet explorer.
    What we are going to do in mobile application?
    We now load that text into our Flash Lite 1.1 application. Flash Lite can load .txt file from local machine and also from the server. Mean a real web server. Not from localhost server when you run your mobile application from a mobile device. So, in this case, we can only test it in the computer through the emulator which Flash CS3 IDE gives “Device Central”, you can use flash emulator in older version also ( see the flash documentation for this purpose). This is enough for development. Open Device Central and click a new flash document and choose Flash Lite 1.1 device from the list and then click Create button. This will open a new .fla file with all the specification of Flash Lite 1.1. I recommend you to choose a device from Device Central which you have for real experiment. That will pay you interest when you test it in real world. Otherwise you can do what ever you feel better, for development all are same.
    Now open the action panel in flash and make a dynamic text field on the stage. Open properties panel, select the text field and give a Variable name of that text field you find in the properties panel (for example: varTxt). Now do some modifications on your test.txt file in the localhost “www” folder. Type this line bellow:
    VarTxt=Hello World.
    And save it. Open the action panel and type the script to load the text variable into your flash application.
    loadVariables("http://localhost/test.txt",_root);
    Test the movie. You’ll see the “Hello World” is shown in the emulator.
    Now we can go for some server side code in php.
    To write php code you can simply use the notepad for this case but text editor which can recognize server side code with line number and coloured syntax as like the action panel do is better for code writing. This helps to keep track of the error in which line it is.
    Download Notepad++ from the net and install it to write server languages. Or you just open notepad. Both will do the same thing when you save it in .php extention. Save the file in the www folder and name it test.php and type the code bellow:
    <?PHP
    echo “varTxt=Hello World”;
    ?>

    PHP code is open with <? Or <?PHP and closed with ?> or ?>PHP. everything in between this two tag is the php code. But the inside code is obvious in php syntax. Here echo is a very commonly used code in php which shows the end result as an output. With this first experiment this will do a good start with php and Flash Lite 1.1.
    Change the flash script:
    loadVariables("http://localhost/test.php",_root);
    Here the difference is only in extension from .txt to .php. Now, test it. You can realize that flash can load the same thing as it load from the .txt file. But if you place the echo code outside of the opening and close tag, nothing will show as an output.

    continue...

    marlopax

    Tuesday, August 11, 2009
    Last edited by marlopax; 08-13-2009 at 03:25 AM.

  3. #3
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Dynamic loading of .txt and .php file

    Loading a .txt file or .php file into flash is dynamic because it is loading from a remote server or Flash load the inside content of those from an external file. So, after you build a Flash Lite application you can change the content without editing the compiled application file. This is a great indication to go towards a professional mobile application. You build application, distribute it to the users and change the content so that the users can always get an updated material on every change you made to the .txt file.
    The dynamic text field in flash called text variable and the var name is the name of that variable. If there is more than one text field on a same frame in flash and you want to load different data in different variables from an external .txt file, you need a separator to separate the name of the variable and the content of the variable. You had already done that in the previous experiment. The “=” sign separates variable name and the content of that variable. So, now another sign will use to separate the variable name from the same .txt file, that is “&” sign. Edit the test.txt file and type this code bellow and save it:
    &product_1=Natural Paper&shade_1=Buff &price_1=14.5&
    &product_2=Raw Paper&shade_2=Vermilion &price_2=23.7&

    In this text I use two different sign to separate the variable name and the content of those variables. The “&” sign and the “=” sign. If you read the text carefully you will notice what I am going to do and what I am trying to make of a mobile application.
    Yes, a product base application.
    Take a look at the text: Here I separate three variables with their content. First one is product_, second one is shade_ and the last one is the price_. And I also mentioned “1” and “2” for different products. This is what the other kind of trick to separate different things in flash application. Those numbers are to separate the product. You can think this number as a serial number of those products. There are many ways to separate different things for flash externally. Lets look what flash can do with this type of .txt file.
    Open Device central and create a new Flash Lite 1.1 file. In that .fla file make three dynamic text fields and type the variable names (first one “product”, second one “shade” and the last one “price”). Also make three static texts to identify the three dynamic text fields on stage in the application. Put text as a name of the variable type so that the users can able to understand which text field will represent what values or data. Now select the first key frame in the timeline and type the loadVariables code which you did earlier to load the test.txt file. Make a button out off the stage, no matter what graphic you put for that button because the users couldn’t see the button as it is out of the stage. Flash developers usually call this type of offstage button “keyCatcher”. So you can take a static text and type keyCatcher in it and convert the text into a button symbol by pressing F8 or Modify>Convert To Symbol.
    Select the keyCatcher button and type the code bellow in action panel:
    Actionscript Code:
    on (keyPress "<Right>") {
        i=i+1;
        product=eval("product_" add i);
        shade=eval("shade_" add i);
        price=eval("price_" add i);
    }
    on (keyPress "<Left>") {
        i=i-1;
        product=eval("product_" add i);
        shade=eval("shade_" add i);
        price=eval("price_" add i);
    }
    If all are going in right direction then test it in emulator and navigate with the left and right key of the emulator mobile button or press it in keybord. You can see that the value of the test.txt file will reflect on your mobile emulator.

    continue...

    marlopax

    Wednesday, August 12, 2009
    Last edited by marlopax; 10-13-2010 at 10:29 AM.

  4. #4
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    How a .txt file act as a database in Flash Lite Application?

    I’m going to give a short knowledge before starting work with database in MySQL. This is because I realized that a .txt file have a tremendous power to act as a data storage. Not only to use as a container file for dumping data in one or two variables, but it can act as a small database for small scale businesses. I really mean it. But for now I am giving a short start with .txt file as a database. Latter I will discus in total depth with a complete application, based on the database with a .txt file. You can realize the power or .txt and can built a 5000 members login within one .txt file, and a catalogue with another 5000 different data. Is it enough for a small scale business? So, this is the end of the future talk. Let’s begin with the topic first.
    Save a .txt file named dataTxt.txt into the www folder as your data container and type the data bellow:

    Actionscript Code:
    &category1_item1_Name=Shopping Bag&
    &category1_item1_Size=24x17x4 inch depth&
    &category1_item2_Name=Shopping Bag&
    &category1_item2_Size=16x11x3 inch depth&
    &category2_item1_Name=Lampshade&
    &category2_item1_Size=9.5 inch Radius&
    &category2_item2_Name=Lampshade&
    &category2_item2_Size=24 inch Hexagonal&
    &category2_item3_Name=Lampshade&
    &category2_item3_Size=16 inch Octagonal&

    Here, I separate the data into sectors or columns and serials or rows. Notice the above data which I separated are into four different sectors or columns (category, item, Name and Size) and serials or rows (1, 2, 3 and so on). Latter when I discus on MySQL database, you will see that the database structures are based on column, rows and fields. In this .txt file I use the field by separating them with “=”sign.
    Now this dataTxt.txt file is your database file which you can categorized on Flash Lite 1.1 front-end user interface.
    So, straight to Flash, take three dynamic text fields on stage and give there variables name:

    1. Message
    2. Name
    3. Size


    Take two static text field and type “Categoy1” and “Category2” and place it at the position of two left and right soft keys, so that the users can understand the function of the two soft keys. Take a keyCatcher and place the button in offstage.
    In the main timeline select the keyframe and write the two line code in action panel:

    fscommand2("SetSoftkeys",left,right);
    loadVariables("http://localhost/dataTxt.txt",_root);


    Note: fscommand2 has a bunch of functions. If you want to know more about this command, just read Flash Lite 1.1 help.
    To recognize the two soft keys you have to use this fscommand2 code. loadVariables will load the data in the starting of the movie. If you test the movie in this condition you will see nothing but flash has already loaded the data. In the output window of the emulator you can see the message that the flash has finished request for "http://localhost:80/dataTxt.txt". Mean your data has been loaded.
    Now type the code for keyCatcher:

    Actionscript Code:
    on (keyPress "<PageUp>") {
        category = 1;
        item = 0;
        message = "Category " add category;
        Name = eval("category" add category add "_item" add n add "_Name");
        Size = eval("category" add category add "_item" add n add "_Size");
    }
    on (keyPress "<PageDown>") {
        category = 2;
        item = 0;
        message = "Category " add category;
        Name = eval("category" add category add "_item" add item add "_Name");
        Size = eval("category" add category add "_item" add item add "_Size");
    }

    on (keyPress "<Up>") {
        item = item-1;
        Name = eval("category" add category add "_item" add item add "_Name");
        Size = eval("category" add category add "_item" add item add "_Size");
    }
    on (keyPress "<Down>") {
        item = item+1;
        Name = eval("category" add category add "_item" add item add "_Name");
        Size = eval("category" add category add "_item" add item add "_Size");
    }

    Test the program and navigate with the two soft keys and the up and down 4 way navigator button of the mobile emulator.

    Explanation of the code:
    Read minutely the keyCatcher code. Flash action script is very easy to understand even you are new in scripting. keyPress”<PageUp>” and keyPress”<PageDown>” are for two soft keys and keyPress”<Up>” and keyPress”<Down>” are for the up and down button of the 4 way navigation buttons.
    The code (category=1) and (item=0), this is to fetch the item data from the column category and row items.
    On the code of keyPress”<Up>” and keyPress”<Down>” function, the (item=item -1) and (item=item +1) is to change the number of the row and display the next and previous item.

    To know about the “eval” code see the flash help.

    Hope, you enjoyed the discussion and learn the first step for a professional application.

    continue...

    marlopax

    Thursday, August 13, 2009
    Last edited by marlopax; 10-13-2010 at 10:32 AM.

  5. #5
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Front-end and Back-end Programming and their Benefits

    Any program you do inside of a flash movie is a front-end program or front-end script. There is no harm if you do the entire task with front-end programming. But it could harm if someone can hack your intellect logic of programming by anyhow breaking your compiled application and get all the code by doing nothing mean getting all your code absolutely free. Doing mobile application it is also essential to reduce the front-end programming and make it in back-end as far as possible. The programming code makes the application file heavy, more coding will gain more file size, as like the graphics and assets of flash increases the file size of the application. All developer tries to develop there applications lighter so that they can run smoothly and faster over net and also in the local machine because of very limited space in mobile devices. So, developer develops their applications lighter so that it can run faster in the small devices. And it also more secure to develop your application by back-end programming.
    Back-end Programming with PHP
    As we saw in the last example, flash can load data directly from a .txt file which act as a database. But flash could not load data directly from a MySQL database. To load data from a database we need a program which can built a bridge in between flash and database.
    PHP server side programming language is a perfect match to build a bridge in between. It is free, easy to learn, open source program, large communities in net, perfect to driven data from MySQL database, has capabilities to handle many things needed for a mobile application, secured, powerful and reliable in any mean. PHP has the power to built complex programs, handle complex data structure and make flash program light weight by doing most of the task which you code inside of the flash program.
    When a flash application runs in a device and executes the code with calculations, comparison validating and other stuffs, it blocks the memory of the device. More coding task will block more memory. You might face such application which is very light in file size but when it executes the code the mobile OS hanged. This is because the task it executes will block a huge device memory. Think otherwise, if you sent the same task to a back-end program and get back the end result and the program do all the stuffs which the flash was doing depending on the memory of the device without taking the device memory and sending back just the result you are looking for.
    Here is a simple example which can show you how secure your code would be if you develop by back-end programs and how light it will if you do all the things with a server side programming language on a remote back-end place.
    Flash actionScript:
    valueA=25;
    valueB=14.5;
    result=valueA – valueB;
    trace(result);
    //output: 10.5
    PHP serverScript:
    <?PHP
    $valueA=25;
    $valueB=14.5;
    $result=valueA – valueB;
    echo “$result”;
    //output: 10.5
    ?>
    Look at the above script of Flash and PHP. Both are very similar in look and also do the same thing in output. The output will come same if you put the flash code into flash as a front-end program or you call PHP and get back the same output into flash as a back-end programming. The only difference is in which way you execute the result as output. If you put the code inside the flash application, you don’t need a net connection on that device to execute the output, but it will be mandatory if you depend upon a server side language for the output to come.
    For front-end programming it will take device memory to process the code and also to execute the result, but for back-end programming it will only take the memory to execute the result. So, you can save the memory space and also the processor task of processing the entire code. For more complex programming you can switch on to back-end programming which is more secured both for users and developers point of view.

    How far the back-en programming code is secured?

    Over net there is hundreds of ways by which anyone can able to hack your valuable code but the server side language code is totally secured. Nobody could see the code inside of a PHP file. Test it to make yourself sure.
    Put the above PHP code in a .php file and save it in the www folder. type the address to the target php file from internet explorer, when the output result comes, right click on that and go to the View Source code. There you just see the output not the code. To know more about this issue visit to php.net for the php documentation.

    Interact with PHP from Flash

    Edit the php code and in the line of echo:
    echo “&result=$result”;

    This echo will format the output as we do in a .txt file and send it to flash so that the flash can understand. Basically Flash Lite 1.1 can only read the variable and the content of that variable. You can do a lot of things by passing this simple method which Adobe built in Flash Lite 1.1 Player.

    Now take a dynamic text field giving a var name result and select the first keyframe in the root timeline type the code of loadVariables targeting the .php file. That’s it. PHP will do all the calculation and sent the result to flash.

    Test it, in the mean time I am taking a break from this discussion and built an example for you so that you can get a live demonstration just on you hand.

    continue...

    marlopax

    Friday, August 14, 2009

  6. #6
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Flash & PHP talks

    You will be happy to hear that there are only three things in Flash and PHP to talk to each other. Flash do its own work and PHP does its own. No one bother what they are doing inside, neither Flash nor PHP. Flash just call a .php file from a server and send some values. PHP process those values as per the program and send the result back to the flash and flash displays that result. To explorer this knowledge we will pass through an example.

    The three things of Flash & PHP talks are:

    1. Collect the values.
    2. Call .php file.
    3. Received the result and display it.

    Process:

    1. Collect the values in variables:
    valueA=eval(“valA”);
    2. Use the POST method in calling the .php file:
    loadVariables("http://xyz.com/calForm.php",_root,"POST");
    3. Receive result and display as PHP sends the result.

    By collecting the values, Flash sends to the PHP through this POST method. PHP also receive with that same method and send the result by using the echo method after processing. Let’s start the example on detailed discussion.

    Start with Flash Lite 1.1 first

    Take two input variables on stage and named the var “valueA” and “valueB” and also place a Static text just in the position of right soft key and type calculate. Take two dynamic text put one for the result var name result and other to display the sign var name sign. Place the sign text field on the top position of left soft key. Make a keyCatcher and write the code bellow:

    Timeline code:

    fscommand2("SetSoftkeys",left,right);
    sign="+-*/";


    keyCatcher code:

    Actionscript Code:
    on (keyPress "<PageDown>") {
        if (sign ne "+-*/" && valueB ne "") {
            sendValueA = eval("valueA");
            sendValueB = eval("valueB");
            sendSign = eval("sign");
            loadVariables("http://localhost/calFlashPHP.php", _root, "POST");
            sign = "+-*/";
        }
       
    }
       
    }on (keyPress "<PageUp>") {
        if (count == 0) {
            if (valueB eq "") {
                if (valueA ne "") {
                    sign = "+";
                    count=count + 1;
                }
            }
        }else if (count == 1) {
            if (valueB eq "") {
                if (valueA ne "") {
                    sign = "-";
                    count=count + 1;
                }
            }
        }else if (count == 2) {
            if (valueB eq "") {
                if (valueA ne "") {
                    sign = "x";
                    count=count + 1;
                }
            }
        }else if (count == 3) {
            if (valueB eq "") {
                if (valueA ne "") {
                    sign = "/";
                    count=0;
                }
            }
        }
    }

    Now save a .php file named calFlashPHP.php into www localhost folder, and type the php code into that PHP file.

    PHP code:

    PHP Code:
    <?php
    if (($_POST['sendValueA'] == "") || ($_POST['sendValueB'] == "") || ($_POST['sendSign'] =="")) {
      echo 
    "&result=Please Enter a value";
      exit;
     }
    if (
    $_POST['sendSign'] == "+") {
      
    $result $_POST['sendValueA'] + $_POST['sendValueB'];
    } else if (
    $_POST['sendSign'] == "-") {
      
    $result $_POST['sendValueA'] - $_POST['sendValueB'];
    } else if (
    $_POST['sendSign'] == "*") {
      
    $result $_POST['sendValueA'] * $_POST['sendValueB'];
    } else if (
    $_POST['sendSign'] == "/") {
      
    $result $_POST['sendValueA'] / $_POST['sendValueB'];
    }
    echo 
    "&result=$result&valueA=$result&valueB=&count=0";
    ?>

    Test the Flash Lite application.


    continue...

    marlopax


    Sunday, August 16, 2009
    Last edited by marlopax; 10-13-2010 at 12:20 PM.

  7. #7
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    A Real Application to Demonstrate the Flash Lite 1.1’s flavor

    Sorry, for my bad English.

    The above example is a simple calculator application for Flash Lite 1.1 mobile. You might think that why you use a back-end program for that simple calculation whereas Flash Lite can easily handle this things. You are right, but I gave you to give you an idea how to secure your code and can make a huge program for a small device by using server side language integration with Flash Lite 1.1. On the other hand you can force users to use net connection on mobile to get such kind of calculations which needs database help to get proper results.

    For example, EMI calculator for Vehicles which need the current price of a particular vehicle. It is not possible to store the entire updated price for every vehicles a company deals with in a mobile application. And it is also not possible for a human to remember all the stuffs.

    Why on mobile, and for whom to use?

    The world’s fastest growing communicating device and flexibility helps people to keep in touch with everything in the world. It takes a little space in pocket but act as a laptop to handle most need when you are roaming around or enjoying your holidays with your kids, but can still in touch and enjoy the technology.

    People who are dealing with market to sale there product (here for vehicles) have to move to the customers to sale it. It is handier to use mobile than to take a big size machine. You can get net connections you can call your boss to handle further need for your dealings with that same machine. There are lots of reasons for making mobile applications, and there is no doubt that a good mobile application is needful for today’s world.

    A Real Application to Demonstrate the Flash Lite 1.1’s flavor

    Here I am going to give you a Real Mobile Application in detail. You might feel the need and the seriousness of this application. But before that we need some discussion about the Flash Lite UI and functionality which is important for this application.

    To develop this type of application you need to write all the points by which can an application could get popular and needful in its sector of business. It is not necessary to generate money from an application by putting advertisements into it. But it is also a good way of to get fund if your application became popular. Or your client may want to put his next coming product as an advertisement. Or it could be essential to put a space for related product as an advertisement so that this EMI Calculator will give business to your client.

    Whatever it would be, you need to write all the points so that you can build the application in an organized way and also to show to the client how useful and essential purpose your application serves for his business.

    Mobile User Interface

    As this is not a desktop or a laptop, you will have to be very careful for a mobile UI (User Interface). This will play a very important role for both visual aspects and also for fast interaction. Flash is a very good tools to make vector graphics which takes less weight than a raster graphic. It is my suggestion that try to build UI as lighter as you can. If you are not strong in graphic or visualization, leave those jobs to a right person who can handle and having experience on mobile environment.

    Tips for Graphic Developers:

    1. Use minimum graphic objects on your application.
    2. Use 8bit graphics for raster graphic uses.
    3. Avoid gradients in both vector and raster graphics as because it both increases file size.
    4. If you use borders or lines on your UI, then don’t forget to convert it into shapes. It will decreases file size in flash.
    5. Use device fonts for dynamic text,
    6. Use minimum 10 points font size for readability. It will better to use 12 points font size for better readability on small devices.
    7. Colour and composition is also very important in this case. As we know the visualization is the foremost key to attract users to use your application. So this will play a very important role from other similar application to attract user to use comfortably.
    8. Make your UI flexible so that you can change your graphic any time you need.
    9. Always keep in mind that all we do is for survive. So make an UI for multi purpose use and for multi business.
    10. I will better to keep system date, time, signals and battery indicator on the header part of your UI.
    11. Always give the option to exit from the application or quit from every sequences. This will help the user to use the device properly.
    12. Make all the design Interface in different JPG file as an output design and must test it on real device.
    13. Last and foremost point to remember is to make your UI simple, logical, iconic as well as a description part which will describe the icon, light weight, less animation, less high resolution raster files, smooth to visualize, sophisticated, corporate look and with better captions.

    Organize your Application

    Noting all the points to build an application is important to remember for future works. As this is a business related application it is always good to make a business plan for it, otherwise it will be a big loss of time and money.

    Target Options

    First analyze your target audience, how will it be going to use the end application. Then survey the target device on which could be the most users will use this application. After finding these two things you will able to start with the visual part for the application which will take a lot of analysis and discussion to settle it as a standard UI on all the different devices you target for.

    Testing Device

    It is essential to keep at least two devices in different display screen for testing. It will better if you buy new device for testing. But if you start your development with a little fund I suggest you to buy 2nd hand device which are in good condition. In my case I always try for the 2nd hand handsets. And a SIM card on minimum net plan. This will cut down your development cost.

    Functionality and Flexibility

    Now find out the function part of the application. This is the phase where you have to think from both users and business point of view.

    Let’s first start to discus from the business point of view. All business needs relationship to grow. Here, for the EMI Calculator there is a relationship between Loan Provider or Bank and the Vehicle Company. Both are related to each other to give a successful growth in the business. So you have to keep in mind when you are going to develop such high class business application. For this example you have to relate with the Vehicle Company to get the updated model of the vehicle with the prices and also have to relate to the loan provider or bank in most cases to get there terms rate of interest etc. To develop such functionality you have to have a very clear idea about both of the business because in this application both can be you client or either of one. You have to find out what they both needs in this field so that you can take the opportunity to make your business with both of them.

    Now from the users point you have to think about the navigation and the flow of the application. It should be simple to understand and fast to navigate. Provide guidelines and help to use the application. Give the option to exit in any point of the application. Within this short time of use you must give new offers to the customers so that they can pay extra interest on that application. In this case the users will be the employee of bank or of the Vehicle Company or both, so the company might want to give offer to them for new incentives and new targets, which can directly reflect on a special section of the application. There must be a login section and obviously a WELCOME screen of your application.


    continue...

    marlopax


    Monday, August 17, 2009
    Last edited by marlopax; 08-17-2009 at 02:37 PM.

  8. #8
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    EMI Calculator application:


    Here is a plan for the EMI Calculator application:


    1. Application will start by a welcome screen.
    2. Login Section.
    3. List of Vehicles with Picture.
    4. Detailed Information of the particular Vehicle which was selected from previous list.
    5. EMI plans and agreement for loan.
    6. EMI Form and Calculate Button or Soft key.
    7. Result Display Screen.
    8. Order Form and Submit Button of Soft key and re-calculate option.

    This is a dummy plan for demonstrating this example. For real application you have to consider more detail notes for every issue. But for this example and also to put steps in the real application this is enough.

    To demonstrate the function I will start first from plan number 6 and 7.

    EMI Form and Calculate Button or Soft key

    For this dummy EMI calculator the basic need is as follows:

    a. Price.
    b. Down Payment.
    c. Flat Rate of Interest.
    d. Tenure.
    e. Number of Installment
    in month is basically one month less from total tenure. But you will face in more formula in this sector in real application. This is depending upon the banks who are giving the loans. It is also vary on different countries laws and plans of loans.
    After getting the inputs we will apply the formula to calculate EMI result.

    Formula:

    EMI = (Price subtract Down Payment) divide 100 multiply Tenure add (Price subtract Down Payment) divide (Tenure multiply 12 subtract 1).
    This is the general formula of EMI calculation. This may vary for different applications.

    Apply Formula into PHP:

    Net Finance = a - b;
    Exposure = (a-b) * 100 / a;
    EMI = ((((a-b) * c) / 100) * d + (a-b)) / (d * 12-1);

    It is a better practice if you name the variables by which it will be clear to understand which variables holds what value and which one is doing what function.

    PHP:

    Actionscript Code:
    <?PHP
    $getPriceAmount=$_POST["sendPriceAmount"];
    $getDownPayment=$_POST["sendDownPayment"];
    $getFlatInterest=$_POST["sendFlatInterest"];
    $getTenure=$_POST["sendTenure"]

    $getNetFinance=$getPriceAmount - $getDownPayment;
    $Exposure=$getNetFinance * 100 / $getPriceAmount;
    $getExposure= sprintf("%01.2f",$Exposure)." %";
    $getNumberOfInstallment=$getTenure * 12-1;

    $getEMI = (((($getNetFinance * $getFlatInterest) / 100) * $getTenure + $getNetFinance) / $getNumberOfInstallment);
    $intEMI = (((($getNetFinance * $getFlatInterest) / 100) * $getTenure + $getNetFinance) / $getNumberOfInstallment);
    settype($intEMI,"integer");
    $setEMI="$intEMI.50";

    if($getEMI>$setEMI){
    $EMI=$intEMI+1;
    }else{
    $EMI=$intEMI;
    }

    echo "&netFinance=$getNetFinance&exposure=$getExposure&EMI=$EMI";
    ?>


    Save the PHP script into the www folder “EMI.php”.

    Now take EMI.fla on Flash Lite 1.1 specification, test the EMI.php from flash. to do that type the following actionScript in the first keyframe on main Timeline:

    sendPriceAmount=56000;
    sendDownPayment=6000;
    sendFlatInterest=12.5;
    sendTenure=3;
    Loadvariables("http://localhost/EMI.php",_root,"POST");


    Make three dynamic variables on stage and named the var "netFinance", "exposure" and " EMI". Test the EMI.fla and see whether it get the proper result from PHP.


    continue...


    marlopax


    Wednesday, August 19, 2009
    Last edited by marlopax; 10-13-2010 at 12:22 PM.

  9. #9
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Setting Database into Text File

    It is now time to set text file as a database of Vehicles Category and item with their prices, so that the updated price, rate of interest will always on the hand of users.

    Text database:

    &nCategory=2&

    &sendInterestRate=12.5&
    &catg1=Bajaj Auto Ltd.&

    &nItem1=3&
    &catg1_item1_Name=Pulsar 220 DTS-Fi&
    &catg1_item1_Rate=85000&
    &catg1_item2_Name=Pulsar 150 DTS-i&
    &catg1_item2_Rate=57000&
    --
    --
    &loaded=data&

    This is a part of the data text for your EMI.txt database. I’m sure you can do it as per your requirement.

    Note: Remember “nCategory” is representing the numbers of category, and “nItem” is representing the numbers of item.
    After the database has done, save it into www folder “EMI.txt”.


    continue...

    marlopax


    Friday, August 21, 2009

  10. #10
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Work On Flash as a User Interface

    Now in EMI.fla, in the first frame type the loadVariables code to load the variables from EMI.txt, and make a vertical movieClip list which will act as a menu list by which the user can select the category from the list. I had post a sample in ("YES" and "NO" in Flash lite 1.1 enabled Phone Vertical Menu with Flash Lite 1.1.), if any one wants to learn from that they can download and get study. You can modify the script if you need for this EMI calculator experiment.

    I am also giving you detailed steps to achieve the EMI application for those who didn’t able to download the sample file.

    Flash > EMI.fla:

    1st frame script:


    Actionscript Code:
    loadVariables("http://localhost/EMI.txt", _root);
    fscommand2("SetSoftkeys", left, right);
    /:loading=&#8221;Loading”;
    /:Select = 1;
    /:Feed = "data";
    /:Pick="start";
    /:ItemNum=1;
    /:CountLoad=0;

    This code will first fire the loadVariables to load the text from EMI.txt from the server. Then set the soft keys to active. Rest of the variables is the declaration of variable values which will need for the program.

    2nd frame:

    Set a dynamic text field with a var name “loading” on the middle of the stage.
    This will act as a pre-loader. This is a very good concept to make a simple text as pre-loader because it will help to reduce the file size and also give a smart look on mobile screen.

    3rd frame script:

    Actionscript Code:
    if (loaded eq /:Feed) {
        gotoAndStop(/:Pick);
    } else {
        if (/:CountLoad<4) {
            /:CountLoad++;
            loading = loading add " .";
        } else {
            /:CountLoad = 0;
            loading = "Loading";
        }
        gotoAndPlay(2);
    }

    Preloader & Verification:

    This is a verification script which continuously checks whether the text is fully loaded or not. As we set last line of the EMI.txt file “&loaded=data&”, so it will check till the very last line of the EMI.txt load and when passed it meant that all the data was loaded. It is also show the pre-loader screen, situated in the 2nd frame, with animated dots after the text“Loading”, till it loads the whole data. Here the countLoad variable is looping till the” if” condition and go back to the previous value 0 when it increase the value greater than 4. In between this condition the dynamic text field will show a “Loading” and dots animation. After passed the (if “loaded”) condition the header immediately jump into the “/:Pick” frame lebel. I put the value of the frame lebel name into the variable named “Pick”, so that I can change it dynamically and reuse this “if” condition with the pre-loader screen several times in this program.


    continue...

    marlopax


    Saturday, August 22, 2009
    Last edited by marlopax; 10-13-2010 at 12:24 PM.

  11. #11
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Making Menu:

    After the pre-loader program, we need to build a menu so that the users can select the vehicles makers from the menu list. There is one important thing to remember in developing mobile application, as we discus earlier about the small screen of this device we have to handle the interface and the navigation very carefully so that you can able to gather all the information which users needs, and the end result of the program in a very logical manner so that the users do not feel bored to go through it. It is still in research of the best way to navigate on a small screen, and the concept of menu is comes first.

    Concept of Menu:

    For mobile content, there is lots of experimentation and adoption took places in the mobile world. Issue is to server the content to the user in a very organized way so that it will be very easy to understand and also to remember the process of that navigation which will both save the time and interest of the application. It needs a very balance concept to represent the flow of the entire navigation system of your application. Some concepts of “menu” are given bellow:

    1. Icon Menu.
    2. Sliding Menu Horizontally.
    3. Dropdown Menu.
    4. Tree Type Menu.
    5. Text Menu.
    6. Text with Picture Menu.
    7. Spherical Menu.
    8. Shuffle Menu.
    9. Animated Menu and more…


    These all are acceptable way of menu systems to bring the application more interesting. But all have some drawbacks in representations for the right informative navigation.

    For icon menu, you have to build a unique graphic for a particular topic by which people can easily understand what the icon is going to represent. If you have hundreds of items in a menu, it is impossible to remember all the graphics of all the items. So it is better to leave the idea of making icon menu when you have a big list of items for a menu.

    Sliding menu is good and easy to navigate but for a long list of items will fed up to navigate if missed to select once which the users wanted to select the item from the list, as because the users couldn’t see what comes next and what goes out or when will the icon comes what the users wants to select.
    Dropdown menu is good for large screen and it is difficult to handle in small screen. But sometimes developer uses this type of menu systems on mobile application because it is easy to track the main menu, sub-menu and so on.
    Tree type menu is also the same as dropdown menu.

    Text menu is very good for both to understand and also for device memory. It can handle a large number of items in menu list and also it is the best way for fast navigation. But it has getting problem when it represent with a long name.
    Text with picture menu is a smarter way to represent on the small screen, but it blocks more memory as it loads with a huge list. It also became slow if the users will navigate for a long time with all the items.

    Spherical, Shuffle and Animated menus are specially made to give an attractive look of the application and it couldn’t run in all smart mobile devices. It has also limitation for larger list of items.

    So the researchers and developers recommended developing menus with brief text information about the topic which it represents in every menu systems you built. It helps to understand what the item is representing for. I will discus latter in detail about the menu development in “Building Menu” section. For now I am going to give you an example of a “Simple Text Menu” for this EMI calculation application.

    Structure of Simple Text Menu:

    Menu on a mobile screen looks like a list or series of buttons but actually that’s all are movieClips which having controls with an off-screen button “keyCatcher”. This concept of making menu with movieClips instead of buttons helps to develop the application more dynamic and less repetition of code in every buttons in the list or it helps to write the code in one place. By this concept developer can write code only in a keyCatcher button and get it work for all the movieClips in the menu.

    This concept is also because of the mobile OS, which do not have the cursor or a mouse support. User have the only option to navigate to the menu is with the 4 way button. Touch screen technology has solved the deficiency of cursor. But I want to stick for non cursor and non touch screen device with Flash Lite 1.1. This is because I believe that this is the base of mobile application and also this version of Flash Lite has a long way to go with many sophisticated business application, as because it has most of the power to develop a very professional application.

    continue...

    marlopax


    Monday, September 07, 2009

  12. #12
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Steps of Text Menu Development:

    • Need:
    1. One MovieClips.
    2. One keyCatcher Button.


    The movieClips you need for a menu will act as a button so it needs two states (on and off). Make a movieClips (mc) with two frames, each frame contains a variables with a same var name in both states, here I put “var = title”, this will display the item name for each items in the menu list. The visual graphics of two frames must be different from each other and I should like a on and off state as you usually do in button graphic. Make the 1st frame graphic off state and put a stop(); action in the 1st frame timeline so that the mc will always show the off state when it start.

    MovieClips instance name “item_1”.

    Frame Action:


    Actionscript Code:
    n = 2;
    /:space = 20;
    item_1/:title = eval("/:catg" add 1);
    while (n<=/:nCategory) {
        duplicateMovieClip("item_1", "item_" add n, n);
        setProperty("item_" add n, _y, getProperty("item_" add n, _y)-20+/:space*/:n);
            tellTarget ("item_" add n) {
            title = eval("/:catg" add /:n);
        }
        n=n+1;
    }
    tellTarget ("item_" add /:select) {
            gotoAndStop(2);
        }

    This script will duplicate the item_1 mc place them vertically bellow of each movieClips.

    Now make a keyCatcher which will control the movieClips menu list.

    keyCatcher Script:

    Actionscript Code:
    on (keyPress "<Up>") {
        if (/:select>1) {
            /:select--;
        } else {
                    tellTarget ("item_" add /:select) {
                gotoAndStop(1);
            }
            /:select = /:nCategory;
        }
        tellTarget ("item_" add /:select) {
            gotoAndStop(2);
        }
        tellTarget ("item_" add (/:select+1)) {
            gotoAndStop(1);
        }
    }
    on (keyPress "<Down>") {
        if (/:select</:nCategory) {
            /:select++;
        } else if (/:select == /:nCategory) {
            /:select = 1;
        }
        tellTarget ("item_" add /:select) {
            gotoAndStop(2);
        }
        tellTarget ("item_" add (/:select-1)) {
            gotoAndStop(1);
        }
    }

    The up and down action will increase and decrease the value of the select variable and according to that the state of movieClips will change to on and off.

    continue...

    marlopax

    Tuesday, September 08, 2009
    Last edited by marlopax; 10-13-2010 at 12:25 PM.

  13. #13
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Architecture of the Main Program:

    In the 4th keyframe, the program is actually starting. But what we are going to start? We are actually going to allow users to select the vehicles. And before that we want to allow users to choose the maker or the vehicles manufacturers so that we can able to categorize the products of different manufacturers and can show it accordingly and collect the right data to
    calculate.

    So our plan is to:

    1. Collect the makers in the 4th keyframe.

    2. Collect the vehicles or the products with their current prices in the 5th keyframe.

    3. Allow users to put some more information or values to calculate the EMI in the 6th keyframe, and put verifications script if any mistake will happen in the input field. This input field will be the field of down payment and the tenure or the number of years of the loans.

    4. In the 7th keyframe we will show the result, and also allow users to re-start the calculation process again so that the users can able to calculate on other vehicles or products.

    5. In 8th we will setup an order form to collect the information of the users if he/she are going to take loans for the vehicles.

    6. And lastly we made some couple of things to say about us, how to operate the program, what is the procedure to avail the loan, what things or documents are required, how the payments will made from this application etc. etc.

    To collect from the previous menu is the “catg” number by which we can fetch the item data of that particular category. Here, variable /:select holds the number from where we can get the appropriate category.

    keyPress Enter Code:

    Actionscript Code:
    on (keyPress "<Enter>") {
        for(r=1;r<=/:nCategory;r++){
        removeMovieClip("item_"add r);
        }
        gotoAndStop("category");
    }

    continue...

    marlopax

    Wednesday, September 09, 2009
    Last edited by marlopax; 10-13-2010 at 12:26 PM.

  14. #14
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    The moments you read:

    As far as this discussion goes I will describe you in full details, how to handle huge product data by the help of MySQL database and php. What we are doing here by using loadVariables from a text file, later on I will discus how to pull data from a database and work into Flash Lite 1.1. But it is necessary to discus with a simple text file format to understand how Flash Lite 1.1 works with sever site languages. This will help to understand the complex data structure and the pulling in and out of data which we are going to discus afterward.

    Category Frame: frame label name “category”

    Category Frame is the 5th keyframe of our program. In this screen we are going to show the product name and the price primarily but you can add the description of the product, the photograph of the product and other essential things related to the product catalog. To navigate this menu I’m going to use the left and right key of the 4 way buttons. Design your Product Show Screen as per your need but of this application I use four dynamic text fields to show the product details and the category name.

    The text fields are:

    On the top put the Multiline text field var name header.

    Bellow of the header text put another Multiline text field var name item.

    Then place two Single line text fields side by side one is for $ sign or other currency’s sign and other is to show the price. Name them priceDes and price.

    You need to pull the keyCatcher button from the library for the product detail code. Keep one thing in mind that you do not need more than one keyCatcher button for a single application in the library because it is a off screen button and not having different graphical view to make more than one as an asset.
    To show the first item after selecting the category we need to put some frame script on 5th keyframe.

    5th keyframe code:

    Actionscript Code:
    stop();
    header = eval("catg" add /:select);
    item=eval("catg"add /:select add"_item"add /:itemNum add"_Name");
    price=eval("catg"add /:select add"_item"add /:itemNum add"_currency")add " " add eval("catg"add /:select add"_item"add /:itemNum add"_Rate");
    sendPrice=eval("catg"add /:select add"_item"add /:itemNum add"_Rate");
    priceDes="Price:";

    5th keyframe keyCatcher code:

    Actionscript Code:
    on (keyPress "<Left>") {
        if (itemNum>1) {
            itemNum--;
            item = eval("catg" add /:select add "_item" add /:itemNum add "_Name");
            price = eval("catg" add /:select add "_item" add /:itemNum add "_currency") add " " add eval("catg" add /:select add "_item" add /:itemNum add "_Rate");
            sendPrice = eval("catg" add /:select add "_item" add /:itemNum add "_Rate");
        }
        if (itemNum<1) {
            priceDes = "";
        } else {
            priceDes = "Price:";
        }
    }
    on (keyPress "<Right>") {
        if (itemNum<eval("nItem" add /:select)) {
            itemNum++;
            item = eval("catg" add /:select add "_item" add /:itemNum add "_Name");
            price = eval("catg" add /:select add "_item" add /:itemNum add "_currency") add " " add eval("catg" add /:select add "_item" add /:itemNum add "_Rate");
            sendPrice = eval("catg" add /:select add "_item" add /:itemNum add "_Rate");
        }
        if (itemNum>eval("nItem" add /:select)) {
            priceDes = "";
        } else {
            priceDes = "Price:";
        }
    }
    on (keyPress "<Enter>") {
        gotoAndStop("form");
    }
    on (keyPress "<PageDown>") {
        for (r=1; r<=nCategory; r++) {
            removeMovieClip("item_" add r);
        }
        gotoAndStop("start");
        itemNum = 1;
    }
    on (keyPress "<PageUp>") {
        fscommand2("Quit");
    }


    continue...


    marlopax


    Wednesday, September 09, 2009
    Last edited by marlopax; 10-13-2010 at 12:27 PM.

  15. #15
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    6th frame: frame label “form”

    Interaction with users: This is an interesting area where your application is really interact with users by taking data from the users and calculate for the EMI results.

    We had already made the EMI.php file which needs four different values to calculate the EMI which we already had done in our previous example.

    Need:

    1. KeyCatcher.
    2. Seven Dynamic Text Field.
    3. Two Input Text Field for down payment and tenure input from users.

    6th frame script:

    Actionscript Code:
    header=header add "\n" add item;
    priceDescriptn="Price Amount:";
    getPrice=price;
    downPaymentDescriptn="Down Payment:";
    interestDescriptn="Rate of Interest:";
    interestRate=sendInterestRate add " %";
    TenureDescriptn="Tenure:";
    status=fscommand2("SetInputTextType","dnPayment","Numeric");
    status=fscommand2("SetInputTextType","tnr","Numeric");

    6th keyframe keyCatcher code:

    Actionscript Code:
    on (keyPress "<PageDown>") {
        if (/:dnPayment</:sendPrice && /:dnPayment != 0 && /:dnPayment!= "" && /:tnr<=7 && /:tnr!=0 && /:tnr!="" ) {
            /:sendPriceAmount = /:sendPrice;
            /:sendDownPayment = /:dnPayment;
            /:sendFlatInterest = /:sendInterestRate;
            /:sendTenure = /:tnr;
            loadVariables("http://localhost/vehiclesEMI.php", _root, "POST");
            /:Feed = "result";
            /:Pick = "endResult";
            gotoAndPlay(2);
        } else {
            if (/:dnPayment>/:sendPrice || /:dnPayment == "" || /:dnPayment<1 || /:dnPayment == " ") {
                /:dnPayment = "";
            }
            if (/:tnr>7 || /:tnr == "" || /:tnr<1 || /:tnr == " ") {
                /:tnr = "";
            }
        }
    }
    on (keyPress "<PageUp>") {
        fscommand2("Quit");
    }

    Reusing of Pre-loader:

    This is absolutely meaningless to make a pre-loader in every period in timeline after giving a load command. Here I’ll discus about the dynamic use and reuse of pre-loader.

    In the first frame script I initialized two variables which hold the loading verification data and the frame label name to direct the frame after the data loaded.

    /:Feed = "data";
    /:Pick="start";

    Now I changed the values in keyCatcher script of these two variables to make it dynamic and gave a command to reuse the pre-loader.

    /:Feed = “result”;
    /:Pick = “endResult”;
    gotoAndPlay(2);

    Here the value “endResult” is the name of the next frame label where the user will get the result of this long process.

    Frame 7: frame label “endResult”

    Make separate dynamic text field each data you collect from the beginning of the program and also for the results which you get from the php file. Here is the list of the variables which you need to show in the result page.

    List of Variables:

    header
    PriceAmountDes : getPrice
    DownPaymentDes : dnPayment
    FlatInterestDes : interestRate
    TenureDes : tnr
    --------
    netFinanceDes : netFinance
    exposureDes : exposure
    sendEMIDes : sendEMI

    7th frame script:

    Actionscript Code:
    PriceAmountDes="Price Amount:";
    DownPaymentDes="Down Payment:";
    FlatInterestDes="Flat Rate:";
    TenureDes="Tenure:";
    netFinanceDes="Net Finance:";
    exposureDes="Exposure:";
    sendEMIDes="EMI:";

    To calculate another product’s EMI put the code bellow in the keyCatcher of 7th keyframe. This will go to the “start” Frame Label and cycle the application.

    7th keyframe keyCatcher Script:

    Actionscript Code:
    on (keyPress "<PageDown>") {
        header = "";
        dnPayment = "";
        tnr = "";
        PriceAmountDes = "";
        DownPaymentDes = ":";
        FlatInterestDes = "";
        TenureDes = "";
        setPriceAmount = "";
        setDownPayment = "";
        setFlatInterest = "";
        setTenure = "";
        netFinanceDes = "";
        exposureDes = "";
        sendEMIDes = "";
        netFinance = "";
        exposure = "";
        sendEMI = "";
        loaded="";
        gotoAndPlay("start");

    }
    on (keyPress "<PageUp>") {
        fscommand2("Quit");
    }


    continue...

    marlopax

    Saturday, September 12, 2009
    Last edited by marlopax; 10-13-2010 at 12:29 PM.

  16. #16
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    MySQL database & PHP

    If you are clear about what type of text format is used or needed to build this application, you will understand the input structure for a menu or variables or a text field in Flash Lite 1.1. I’m going to give you a detailed concept of a database so that you can easily been able to make your own mobile application with a huge amount of data.

    Now I’m going to switch from .txt file to a database. The concept to pull data from MySQL with the help of a server side language like PHP is the same format as I did in the txt file. But there is a big difference between to load data directly into flash from PHP and from .txt file. Firstly I mention the raw size of the data inside a txt file will load entirely into the flash application when you load a .txt file, which you might not require the whole thing. Flash couldn’t pick the right data from a txt file either you store it according to your users’ need in different .txt file. If the data is huge, the application might be hanged. It is also quite impossible to load the right txt file as per the need of users because it will need a huge combination of data in every txt file. So, server side languages & MySQL combination is a perfect for your mobile application. You can totally leave it to the users to choose their combination of data with just a single coding in server side languages to pull the exact data from the database. So let’s start from the scratch.

    Database MySQL:

    Database is a container of tables. Tables are the container of information into rows and columns. One database can hold as many tables you want to create in it. Obviously there has a limit but I recommend you to read MySQL books for more detailed of this. Don’t worry about it I am quite sure that you don’t have to bother about the number of tables in a database you need for your entire application. It is a good concept to put one application under one domain and server. I’ll discus elaborately on “Managing Application & Business” to give you the right concept of management. Hold your breath and keep concentrate because lots of things are going to happen in this section of discussion.

    I am going to give the entire example in widow’s platform, whereas other platform like UNIX, Linux, and Solaris etc is not the same as windows. They have different approaches and supports for databases and commands.

    To start with database I’m now discus the Plan 2 of the EMI Calculator “Login Section”.

    continue...

    marlopax


    Wednesday, September 16, 2009

  17. #17
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Creating and Constructing Database:

    Start the wamp server if it is not running.

    1. Open the phpMyAdmin page.

    2. Under MySQL Database there is an input text field of Create new database. Put a name of the database (for example: db01sep2009mob_app) and click Create.

    3. Now under Create new table on database db01sep2009mob_app there are two fields Name and Number of fields. Write login in the Name field and 2 in the field of Number of fields and click the “Go” button. This will create two fields for user name and password.

    4. MySQL will create the login table and open a page where you now set the name of the column and the parameters of each column.

    5. Name userName in the first field and Password in the second.

    6. Type of the field will be VARCHAR for both.

    7. Length Values for userName is 50 and 255 for Password.

    8. In Index section select PRIMARY for userName only.

    9. Click Save button.

    10. Now insert some user name and password to test and understand what you just created.

    11. To insert data click the “Insert” button from the tab list. In this page MySQL give you option to insert two username and their password, you can ignore one if you want otherwise insert any name or character in the userName and in password field. Before you press the go button set the password function to MD5 for both the password input and then click on the “Go” button to save the data.

    12. MD5 is an encryption method which will encrypt the password so that the password will be secured. For more security I recommend to read some security books for more detailed concepts.

    13. You can now able to see what MySQL has done. Click the “Browse” button to see the data. Here you can see the password you put will set to an encrypted form.

    Insert some more username and password so that you can test the program to understand.


    continue...


    marlopax


    Thursday, September 17, 2009

  18. #18
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    PHP and MySQL Login on Mobile with Flash Lite 1.1

    We had already passes variables from Flash Lite 1.1 to PHP and get back to Flash Lite application. Now for the login program we need to get the variables from Flash Lite application and check it with the database if it is there is correct or not with the exact data of the database. So, here, two things will happen, one to get the data from flash and second to get the data from the database. But instead of getting data from the database it is better to called it to check the data from the database, because we are not going to pass the data from the database into flash for the login purpose, we just check with database data with the data we get from the flash and return a true or false Boolean value into the flash application so that the flash can handle it accordingly.

    So we are now going to discus how PHP interact with MySQL database.

    To get anything from the database, any server side language needs to connect to the database first. To connect a database we need a host name, a user name and a password to get the permission to access the database.

    Here is the code to connect a database from PHP:

    mysql_connect (“host name”, “user name”, “password”);

    After the connection has been done we need to select the database we want to get into it. To do this we need the name of the database. In this case the name of the database is db01sep2009mob_app which we already created.

    Here is the code to select the database:

    mysql_select_db (“database name”);

    Working on a localhost server the host name is “localhost”, user name is “root” and the password is “” mean nothing. You don’t have to give a password to connect a localhost server database.

    After the selection code we need the name of the table from where we can get the data. Here the table name is “login”. MySQL code is more like an English sentence which is easy to remember and very straight forward.

    To get data from a database table the code is:

    SELECT * FROM login WHERE userName = $_POST["userName"];

    This code will select everything from the table login where the database userName is equals to the userName which we get from the flash.

    Then a query code will require and the code is:

    mysql_query( );
    mysql_numrows( );


    I will explain latter on MySQL & SQL. But for now I will give you the total code structure of the login program.

    To make this code work we have to write like this:

    PHP Code:

    <?PHP

    $Name=$_POST[“userName”];

    $Password= md5($_POST["Password"]);

    mysql_connect ("localhost", "root", "");

    mysql_select_db ("db01sep2009mob_app ");

    $query = "SELECT * FROM login WHERE userName = '$Name'";

    $result = mysql_query($query);

    $num = mysql_numrows($result);

    $pass = mysql_fetch_array($result);

    ?>

    This little code will fetch the data from both flash and MySQL and hold into the PHP file to process.


    continue...

    marlopax


    Wednesday, September 23, 2009
    Last edited by marlopax; 09-22-2009 at 03:40 PM.

  19. #19
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Greetings

    Wish a very Happy Durga Puja 2009.
    Last edited by marlopax; 09-22-2009 at 03:43 PM.

  20. #20
    Moderator
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    since many of these posts seem like tutorials rather than a discussion, it might be useful to submit them to the tutorials section of FlashKit under mobile development.

    http://submissions.flashkit.com/cgi-...orials/add.cgi
    aviarts.com - web development and flash development

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center