-
“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.
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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=”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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
Greetings
Wish a very Happy Durga Puja 2009.
-
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
-
Thank you hp3 to give such honor and advice me to post this as a tutorial. I think I'm not got such eligibility to make this a tutorial.
It will be a discussion when someone join and write in it.
To me forum is a document of tutorials when somebody gave comments or answer to it.
But unfortunately in this thread I am the only person to answer and to discus with myself.
So should I continue?
Or you are indicating me to stop this writing here...
marlopax
Thursday, September 24, 2009
-
I spoke with other mods about this and they seemed to think it was ok for you to continue for the time being, however your tutorial would get more exposure to others if it were published in the tutorial section.
Newly submitted tutorials appear on the home page and used to also go out in the FlashKit newsletter (not sure if this is mailed anymore). So many people will see the tutorial. Also I dont think there are many tutorials in the mobile area. It would be a helpful reference for people to have it in the tutorial section.
-
Ok! Welcome everybody.
After a long period I am back into this discussion. Actually I’m decided to make this a m-book as hp3 gave me the suggestion to make it a mobile tutorial and also I had already in my mind to make it an useful guideline for novice to professional in the mobile area. But this will need more time and others’ help to make it success. It also needs more experiments on Flash Lite 1.1 area to make it on the pick level in the business, and I’m quite sure you will also stick with this little old 1.1 platform.
To me all the platforms are same. We do as per the market demand. Basically to me FL 1.1 is more focused and bigger area than the other FL .x platform, although we always do it in all the other versions. A small request to “Adobe Developer Group” to fix up some bugs on Flash Lite 1.1 and do improve the flexibility of player installation on device. May be it is a OS issue but it will be more better to have more memory heap on a device.
Let’s come back to the discussion. After the query we need to match the userName and Password with the database and return a value or string to flash.
This code which will do the thing:
if ($num == 1) {
if ($Password==$pass["Password"]) {
echo "&reason=Success&";
}else{
echo "&reason=Failure&";
}
}else{
echo "&reason=Please register&";
}
The Total 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);
if ($num == 1) {
if ($Password==$pass["Password"]) {
echo "&reason=Success&";
}else{
echo "&reason=Failure&";
}
}else{
echo "&reason=Please register&";
}
?>
continue...
marlopax
Thursday, October 01, 2009
-
Save the above php login code as EMI.php into the www root folder.
Save the above php login code as EMI.php into the www root folder.
In the EMI.fla file I use frame 8 for “About Us” section 9 and 10 for “Registration” and set the “login” from frame number 11. So give a frame label name “login” in frame number 11 and make two dynamic text field var = user and var = pass for username and password. Take a keyCatcher button and write the script bellow:
KeyCatcher Script:
on (keyPress "<PageDown>") {
/:reason="";
if (user ne "" && Pass ne "") {
userName = user;
Password = Pass;
loadVariables("http://localhost/EMI.php", _root, "POST");
gotoAndPlay("logLoop");
} else {
/:reason = "Required fields are empty.";
}
}
And also place the fscommand2 script on this frame 11 to set the softKeys
Frame Script:
fscommand2("SetSoftkeys", left, right);
continue...
marlopax
Thursday, October 15, 2009
-
Confirmation of Login from the server:
After sending the userName and Password to the server script, Flash Lite application has to stay in a loop state as a pre-loader to receive the confirmation report from the server so that it will immediately do the action when it received from the server. To make that pre-loader state we need two frames to loop.
In frame 12 take a dynamic text field with a var name “log” and named the frame label “logName”. Write on the text field “Please Wait”. Now, on frame 13 put this script:
Frame 13 Scripts:
if (reason eq "Success") {
gotoAndStop("start");
} else if (reason eq "Failure") {
gotoAndStop("login");
} else if (reason eq "Please Register") {
gotoAndStop("Register");
} else if (reason eq "") {
if (/:countLoad<4) {
/:countLoad++;
log = log add " .";
} else {
/:countLoad = 0;
log = "Please Wait";
}
gotoAndPlay("logLoop");
} else {
gotoAndStop("login");
}
continue...
marlopax
Friday, October 23, 2009
-
Registration Form in Flash Lite1.1 and PHP MySQL Interaction:
Registering a user is something different from a login section, because you need some more information of your users to store in your database. This information will help you for further communication to the users to sent newsletters, offers, promotions etc. It is also been important for a business to gather detailed information of your users to make your own user’s list so that you can analyze and get the statistics of the business area, level, sector etc. the followings are some of the basic information for registration form.
Information of Users:
• First Name
• Last Name
• Sex
• Age
• Country
• Address
• City
• Zip
• Phone Number
• E-mail
• Create Date
• User Name
Login Information:
• User Name
• Password
You’ll have to figure out what exactly information you need from the users for your business purposes, and then create a new table in the same database to store the information of the users. Here, for this application I’m going to store the (First Name, Last Name, Sex, Age, Country, Email ID and userName) in User Information table.
continue...
marlopax
Tuesday, November 10, 2009
-
Switching from TXT to PHP
To get into this discussion of registering into your Flash Lite application, we need to know about SQL functions and MySQL database. The basic thing is to insert data into the database and pull the data out into it or to compare it with the user input data etc. However, to do this we need to learn/know about the database structure and the relationship of the database. This is very important that how you construct the database according to your application. In this login registration example, I will discus to construct the database to get better perform of your application on real time. Instead, to keep all the data into one database table it is always better to store data into different table of a database. This will help to organize your application and to get faster performance.
To move further of the registration section, lets change the structure of the “EMI.fla” application. Instead, to loading the “EMI.txt” text file at the beginning of the application, with all the information of the product. Lets switch the loadVariables URL path to a new php file, which checks information whether is coming from a flash application and return the value otherwise echo a warning message to the browser. This is not for a security purposes, but if someone targets the path from a browser, it returns a custom error message. This will also be a faster process to load and check from server and take the application to the right path.
firstLoadEMI.php
Change the loadVariables url path from EMI.txt to “firstLoadEMI.php”. Create a php file into the www folder of that name, and instead of loading all the information of EMI.txt, just load the information to target the flash Playhead to the “login” Frame Label. Alternatively, you can just delete all the data from EMI.txt except the last line of loaded information (&loaded=data&).
It you load the “firstLoadEMI.php” then change the 1st frame loadVariables script to the following script.
Change loadVariables Code are:
whatToDo="EMI";
loadVariables("http://localhost/firstLoadEMI.php", _root,"POST");
Here, I introduce a new variables “whatToDo” with a string value before the loadVariables and post the value to the firstLoadEMI.php file. This “whatToDo” variable will act as a condition checker and allow developers to write all the codes of login, user registration, edit user information etc. into one php file. However, for now I am doing it in separate php file, which will change later on.
firstLoadEMI.php Code:
<?PHP
//This will hide the error message
iini_set('display_errors', 0);
$whatToDo=$_POST["whatToDo"];
if($whatToDo=="EMI"){
echo "&pick=login&whatToDo=login&loaded=firstLoad&feed= firstLoad&";
}else if(!$whatToDo){
echo "<strong>Warning:</strong> Browser Does Not Support.";
}
?>
This simple code will check with the posted value from flash application and return variables information back to the flash. Here, the “else if()” condition is to print on the browser if it run from browser. The “ini_set();” script will stop displaying the actual error occur and echo the “else if()” echo script.
The preloader code of flash application which will check the firstLoadEMI.php and go to the login frame will be as follows:
Preloader Code:
iif (loaded eq feed) {
gotoAndStop(pick);
} else {
if (/:CountLoad<4) {
/:CountLoad++;
loading = loading add " .";
} else {
/:CountLoad = 0;
loading = "Loading";
}
gotoAndPlay(2);
}
This code will wait for the result from firstLoadEMI.php file from the server and jump to the frame which echoed from the php script.
continue...
marlopax
Thursday, November 19, 2009
-
Some More Work in Login
In EMI.fla on frame label ”login”, change the keyCatcher script.
Code will be as bellow:
on (keyPress "<PageDown>") {
/:reason="";
if (user ne "" && Pass ne "") {
whatToDo="Login";
userNameSent = user;
PasswordSent = Pass;
loadVariables("http://localhost/EMI.php", _root, "POST");
user="";
Pass="";
gotoAndPlay("logLoop");
} else {
/:reason = "Required fields are empty.";
}
Now, in EMI.php file, write an “if condition” of whatToDo variables to check what the EMI application are looking for. Because we are going to write all the codes of login, registration, edit profile and so on in one php files “EMI.php”.
The login script will be as:
<?PHP
$whatToDo=$_POST[“whatToDo”];
/*--------------------Login--------------------*/
If($whatTODo==”login”){
$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);
if ($num == 1) {
if ($Password==$pass["Password"]) {
echo "&reason=Success&";
}else{
echo "&reason=Failure&";
}
}else{
echo "&reason=Please register&";
}
}
/*--------------------Login--------------------*/
?>
Therefore, when flash passes whatToDo variable with a sting value of ”login”, the code in EMI.php will execute the login function. By this way, we can write all the codes in one php file and call that php file from flash for every function of the EMI Application.
The login script passes values into a variables in three different “if conditions”. We are going to pick the success condition with a little more work on it, because in the success state we are going to send the product data of EMI to the flash application from the EMI.txt file. So that if the login makes success it will load all the product data from the EMI.txt file into the EMI Mobile Application, otherwise it just send either of the other two state of values of their conditions, and flash will handle the rest.
continue...
marlopax
Wednesday, November 25, 2009
-
Reading and loading data from a txt file by php
PHP can open a txt file, read data from it and can write data into the txt file.
Here, I will discus all the issues that need for the EMI application business.
PHP opens a text file by the fopen() function which needs two parameters.
1. The name of the file with extension
2. The mode to open the file
The possibilities of modes are in bellow
Possible values:
• "r" (Read only. Starts at the beginning of the file)
• "r+" (Read/Write. Starts at the beginning of the file)
• "w" (Write only. Opens and clears the contents of file; or creates a new file if it doesn't exist)
• "w+" (Read/Write. Opens and clears the contents of file; or creates a new file if it doesn't exist)
• "a" (Write only. Opens and writes to the end of the file or creates a new file if it doesn't exist)
• "a+" (Read/Write. Preserves file content by writing to the end of the file)
• "x" (Write only. Creates a new file. Returns FALSE and an error if file already exists)
• "x+" (Read/Write. Creates a new file. Returns FALSE and an error if file already exists)
PHP returns a line of a opened file by fgets() function. The feof() of PHP checks the end-of-file.
Here I am going to discus, how php open a txt file on read mode and return each line until the end of the file.
PHP code:
$file = fopen("EMI.txt","r");
while(!feof($file)){
$data = fgets($file;
echo $data;
}
Place this code in the success condition, so that it returns the product data after a successful login. It is better to put this code above the echo "&reason=Success&"; line because after loading the entire product data flash will receive the “success” value and proceed the pre-loader command.
continue...
marlopax
Saturday, November 28, 2009
-
Merry Christmas and Happy New Year to all
Let us continue
Now, we can discus how to build our registration form in Flash Lite 1.1 application. As we discus earlier that, for this application we are going to built the registration form with (First Name, Last Name, Sex, Age, Country, Email ID and User Name and Password) information. I used Frame Number 9 for registration form in this application and named the frame label “Register”. In this frame, built input variables text field for the above said information. Name each input text field var as the above-mentioned name. This is not mandatory to name as above (example: for First Name text field you can put “FName” or “FirstName” as var name to distinguish the input field, what will it for).
To submit the request use one of the soft key. I used right soft Key as submit button and labeled “Submit”. I also used a cancel and back to start frame in left soft key labeled “Cancel”.
KeyCatcher Button Script:
on (keyPress "<PageDown>") {
if (FName ne "" && LName ne "" && Age ne "" && Sex ne "" && Country ne "" && Email ne "" && UserName ne "" && Password ne "") {
whatToDo = "Register";
loadVariables("http://localhost/EMI.php", _root, "POST");
gotoAndPlay("logLoop");
}
}
on (keyPress "<PageUp>") {
gotoAndStop("login");
}
continue...
marlopax
Tuesday, January 05, 2010
-
MySQL, Relationship of database Table
Database Relationship is a vast subject in database system, which I will discus latter, but for now, I want to give you a brief knowledge about the database relationship.
Here, we will create two tables to store each user’s registration information. One is “login” table, which we already created in the early season, and the other is “user_information” table to store the detailed information of the users. To find out a particular user’s information you need a relationship column to relate with both the login and user_information tables. These columns must be unique in this case and both the columns in each table will hold the same unique data. In this case, userName will be the unique column for both of the tables to identify the particular information of a user.
continue...
marlopax
Sunday, January 24, 2010
-
Create “user_information” table:
• Create a table in the same database named user_information.
• Create required columns named First Name, Last Name, Sex, Age, Country, Email ID, Date and userName.
• userName column will be same as you did in the login table with Primary Key.
• FirstName VARCHAR (40) user’s first name.
• LastName VARCHAR (50) user’s last name.
• Sex CHAR (10).
• Age TINYINT (2) Attributes “UNSIGNED”.
• Country VARCHAR (50).
• Email VARCHAR (50) user’s e-mail address.
• CreateDate DATE.
Storing Data into Database:
Storing data into database with php from Flash Lite 1.1 need the SQL code to INSERT into the database. The code bellow will generated from the phpadmin page from the localhost server page. You will get this option “Create PHP Code” after inserting a data from the Insert tab. You can follow both the code to know how php store data into the database table.
Table user_information:
$sql_01 = "INSERT INTO `db01sep2009mob_app`.`user_information` (`FName`, `LName`, `Age`, `Sex`, `Country`, `CreateDate`, `Email`, `userID`) VALUES (\'your first name\', \'your last name\', \'your age\', \'your sex\', \'your country\', \'date in this format 0000-00-00\', \'your email address\', \'your user name\');";
Table login:
$sql_02 = "INSERT INTO `db01sep2009mob_app`.`login` (`userID`, `Password`, `createDate`,`subscribe`) VALUES (\'your user name\', MD5(\'your password\'));";
The above code will insert the data into two tables in the database “db01sep2009mob_app”.
continue...
marlopax
Tuesday, January 26, 2010
-
Tables of a database
There are many free books on web of this subject, to those who are not grew up with database and server side programming. However, the fundamental or basic reason is to manage data in an organized way so that the data can pull out much faster.
Now, we have to write code in EMI.php file for the registration process so that the user data from flash lite application will save into the database.
PHP Registration Code:
if($whatToDo=="Register"){
$userName=$_POST["UserName"];
$Password=md5($_POST["Password"]);
$FName=$_POST["FName"];
$LName=$_POST["LName"];
$Email=$_POST["Email"];
$Age=$_POST["Age"];
$Sex=$_POST["Sex"];
$Country=$_POST["Country"];
$Date=date('Y-m-d');
mysql_connect ($host, $user, $pass);
mysql_select_db ($database);
$tableInfo="user_information";
$tableLog="login";
$resultInfo = mysql_query( "SELECT * FROM $tableInfo WHERE userID= '$userName'");
$rowsInfo=mysql_num_rows($resultInfo);
if($rowsInfo==1){
echo"reason=This User Name has already taken.";
}else{
$resultInfo=mysql_query("INSERT $tableInfo SET
FName = '$FNamex', LName= '$LName',Age='$Age',Sex='$Sex',Country='$Country', Email='$Email',CreateDate='$Date',userID= '$userName'");
$resultLog=mysql_query("INSERT $tableLog SET userID= '$userName',Password= '$Password',createDate='$Date'");
}
}
continue...
marlopax
Tuesday, February 16, 2010
-
Editing User Information:
First of all, it is a thumb rule that an user has to login before editing the user information, and when user click to edit the information the form should filled up with the old entries from the database, so the user will able to change the right field.
Therefore, to edit the user information the structure will be like this:
1. Login before Edit
2. When user clicks to edit, flash application will call a php script, which execute the old entries from the database of the particular userID into the flash form.
3. When user saves the changes, the flash again call a php script, which will update the data into the database.
4. Return success message to flash application.
continue...
marlopax
Friday, February 26, 2010
-
Edit Form and function:
There is a big difference in logic on registration form and edit form. Registration form is a fresh blank from which every field has to fill up to register, whereas, in edit form user needs to know what is the past entries so that it will be easer to change the information to the users. It is also important which information the user is going to change. In this application, there are two types of information, the password information in login table of MySQL and the user’s personal information in the user_information table. Therefore, it is good to give the users an option of which data are going to edit. This will help to simplify the programming and error management part of mobile device as because you are going to retake the whole data into the database in two different tables, which may not return the proper error whether all the information has properly stored in both of the tables in the database. Therefore, it is better to edit one database table at a time to get better performance on mobile area.
To create the option is simply to take a frame with two buttons in it, which will take to the right edit frame. But I decide to create the edit form using a movie clip which might be little complicated from the above process but you can reuse this edit movie clip as a Flash Lite 1.1 Edit Profile Component in other applications. In latter discussion, I will elaborate the process to reuse your creation as a component to save development time.
To start with a movie clip edit profile system, take a frame after the registration frame. This is not necessary to take the edit frame just after the registration frame but here in this application I made this just after it. In this frame, draw a rectangle and quickly convert it into a movie clip by pressing F8 key, this rectangle will be the option window on the mobile screen when user click to edit the profile.
Now, edit this movie clip and on the 1st frame put a stop(); action and on 2nd frame gotoAndStop(); action so that it will stick to the first “option” frame. Take two more frames, one for “change password” and other for “edit user information”. Draw a graphic button in the first frame of the Edit Profile movie clip and convert it in movie clip. Inside this button move clip make two select and non-select stages of the button graphics and put a stop(); action on the first frame in it. Copy the button movie clip and place after each options. The first option is to change password and the second is to change the user information. By dividing the task, it will be easy to work with database and php because I personally experimented in a very low bandwidth slow seed connection on Nokia N70 handset, which has Flash Lite 1.1 embedded player in it and it work fine. This is because of splitting the data for two different tasks.
Some Experiences to be Share:
We experimented on many devices, which have Flash Lite 1.1 embedded for network connectivity and data transfer. To grow our knowledge on this area, we tested many Flash Lite application and games downloaded from net. Including the sample application of many renowned companies, who are developing applications for mobile devices, and come to the conclusion to built applications on backend and keep the front end light as much as it can develop, with better look with extremely light in weight programming architecture.
There is a chance for data loss in bad network condition but it can be consider for a better connectivity. Rather than that, Flash Lite performs quite good and fast on most of the devices we tested. It is always good to transfers the data as much short as it could be. Do not transfer huge data at a time from any application. It is better splitting your data for mobile applications, which helps to manage both the performance of the application and the memory management.
After testing on some data transfer from Flash Lite 1.1 application continuously (more than fifty times) we feel the application run slow than earlier. However, it may not the cause of transferring data continuously but it may happen for the network condition also. Nevertheless, there is a good sign in Flash Lite that it automatically refreshes the memory or you can release memory from the heap by unload and null to variables. We had tested in very poor network condition on Nokia N70 and it worked.
continue...
marlopax
Wednesday, March 03, 2010
-
Extract data into Edit Profile:
After a successful login, user will able to access the edit profile page/form in the flash application. There is a chance to take more information from your members, such as personal number, postal address etc. for that you have to construct some extra field in your database and some extra line script in php as required.
It is not required to pull data to change password. You can directly check the old password from the login variable and can compare the password from the old one and it is the same process to check the new password with the confirm password variable. After the check with if ( ) { } else { } statement, flash can sent the new password into the database to replace from the old one through PHP.
For editing of the personal data, it is necessary to extract the data from the database, and to do that the following PHP code will extract or to pull out the data/information into the edit profile input field.
PHP Code:
if($whatToDo=="Extract"){
mysql_connect($host,$user,$pass);
mysql_select_db($database);
$table="user_information";
$userName=$_POST[“userName”];
$query = mysql_query("SELECT * FROM $table WHERE userID = '$userName'");
$result = mysql_num_rows($query);
$row=mysql_fetch_row($query);
echo “&nData=".$result."&FirstName=".$row[0]."&LastName=".$row[1]."&Age=" .$row[2]."&Sex=".$row[3]."&Country=".$row[4]."&CreateDate=".date('m/d/Y',strtotime($row[5]))."&Email=".$row[6]. "&userName=".$row[7]."&";
}
“nData” an Extra Variable:
In the echo part of the above php code, I use “nData” variable to send a value into flash, just for future work of EMI application. The “nData” variable sends the results of the query, means the number of rows found with the same userID, which is here always be “1” as the userID is unique and MySQL never store similar data in primary keys. Actually, this is a good habit to keep your thinking continuous towards the future of your applications. To do such things, which you can do in future, you have to keep options from the beginning. I must say that there is no end of future progress and development, but it not meant that every development had a complete plan from the beginning. Flexibility of changing things or adding new features is always been good for your work and to the business. Here, “nData” variable could help for FM (fraud Management), or to send the Error messages into your Flash Lite application. In future post, I will do something with this “nData” variable. For now just bother this extra bytes variable into your application.
continue...
marlopax
Thursday, March 04, 2010
-
Now, the questions come around:
How you are planning to give access to your users to edit their information. Will any users can able to destroy their information from database, or can able to change their names with just less than three letters or can submit an invalid Email ID. Many functions will possible with backend programming, even you can also do with front-end programming whenever it needed or as your application needs. The following Flash Lite front-end programming code will set the validation of the FName Input Text Field.
Flash Lite Code:
fscommand2("SetInputTextType", "FName", "Alpha");
if (length(FName)<3) {
FName="Invalid";
}else if(FName eq "Invalid"){
FName="";
}else{
FName=FName;
}
The Alpha in fscommand2 will only allow users to type only alphabets even it denies to type space. Therefore, nobody can type more then one word in this input text field. After all the validation, just fire the EMI.php by POST method and with whatToDo = “Edit”;. The following php code will update the data of the particular user.
PHP Edit Profile Code:
if($whatToDo=="Edit"){
$userName=$_POST["userNameSent"];
$FName=$_POST["FName"];
$LName=$_POST["LName"];
$Age=$_POST["Age"];
$Sex=$_POST["Sex"];
$Country=$_POST["Country"];
$Email=$_POST["Email"];
$Address=$_POST["Address"];
$Mobile=$_POST["Mobile"];
mysql_connect ($host, $user, $pass);
mysql_select_db ($database);
$table="user_information";
$update = mysql_query("UPDATE $table SET FName = '$FName', LName ='$LName', Age = '$Age', Sex = '$Sex', Country ='$Country', Email = '$Email', Address ='$Address', Mobile = '$Mobile' WHERE userID= '$userName'");
$result=mysql_affected_rows();
if($result==1){
echo "&result=Success&";
}else{
echo “&result=Error&”;
}
}
continue...
marlopax
Friday, March 12, 2010
-
Emi +
For a professional mobile application, you need to build more and more dynamic with lots of scope in it, with full of features and multi-dynamic interaction, multi way communication to achieve the global business. EMI + is meant to build this simple Flash Lite 1.1 application into multi-dynamic application to reach its’ demand.
On early EMI application discussion, we have an example of how to load text file data through php into Flash Lite. In the text file, we kept all the data of every company’s product with there prices, which shows as a list menu in EMI application. Its might not be a realistic approach that loads same data for different users in different locations or in different countries. For this type of EMI like application, it is always vary the prices of the product and companies in every states and countries. These applications are mainly building for the users those who work both for the product marketing and for loan department. Therefore, the focus of EMI Application Business mainly divided on three sectors (agent companies and developer), where the actual demand is. That means this is for networking business where this small application communicate with multi businesses.
We will now discus on how to place small thoughts into big business. To make your most valuable ideas into a success, you have to build your application for global uses. Now, what is a global thought with this little application? The answer is very simple, your business and application plan should be flexible to use in every countries and in every applicable companies.
EMI + focus on Global Business
1. Client - - Person who are going for the Loan
2. Agent - - Person who sell the product to the Client
3. Product Manufacturing Company - - Who give agency to the Agent to sale their products
4. Loan Provider or Bank - - Who give the loan to the Client through the Agent
5. Application Developer - - Who provides the software application
The above sectors are the areas where the flexibility of EMI application reaches on global business. That means a single application can have the ability to use anywhere it needed with every features and components. The focus features are to store data of all areas and short out data or information of different areas as needed. We are going to create an agency component in EMI applications where the agent can browse the companies according to there location and countries and get agency by registering to them. Here, your goal is vast because you can build your application as an individual independent application from where the agent can choose both the loan provider and the product company for the agency. Somehow, I assume that the EMI Application have collaboration with both the loan providers and the product manufacturers, and have a big lists of them for every countries, and from there site they can have access to your database or your domain to update or insert their product information. This collaboration is a big issue in this EMI global business. As many you have associates with the companies you will make that much of company lists for the agents. Thus, an agent will more benefited with your applications and the client can choose as there requirement.
continue...
marlopax
Wednesday, March 24, 2010
-
Agency Component in Flash Lite 1.1 PHP & MySQL:
To start with this section of EMI +, you need separate tables in your database to put the name and descriptions and the other information of the associate companies. For the EMI discussions I have create tables in the same database.
Company List database table:
• Create a company list table, named – company_list
• Create three columns to hold the name, country and company’s information data
• Name VARCHAR (100) – the name of the company must be unique.
• CompanyCode CHAR (20), Primary Key – code number of company
• CompanyInfo VARCHAR (255) – brief information about the company
Insert some company’s name, some unique company code and other information in it.
Create another table for the agent.
Agent List database table:
• Create a agent list table, named – agent_list
• Create five columns in the agent_list table
• userID VARCHAR (50) – for user’s ID
• Agency VARCHAR (100) – for the name of the company
• agencyDate Date – create date of the agency
• agencyCode VARCHAR (10), Primary Key – the agency code column holds the primary key for this agent list table.
• agentArea VARCHAR (50) – the location of the agent
Leave the agent list database empty, mean do not insert any data in it. Create another table named company_locate, which holds the information of which location the company have its businesses.
Company Location database table:
• Create a company location table, named – company_location
• Create three columns in it
• CompanyCode CHAR (20) – in this table it will not be a primary key
• CountryCode CHAR (10) – it stores the code of the country
• CountryName VARCHAR (50) – the name of the country
In this data table, we will store the country code, company code and the name of countries. One thing keeps in mind to buildup any database is not to store unnecessary data or never construct data table columns that have no use. That will confuse your purposes and occupies space in your database. As here in this company location table, I create a column to hold the name of the countries, which will unnecessary, to get a query of a particular company location you need only the country code. However, you might have some other plan to use the data in the country column.
continue...
marlopax
Thursday, March 25, 2010
-
Country Code datable named “country_code”:
Create another data table to store the country code and country name. Stop creating this manually, because we are going to talk about how to create a database table through php. In this discussion, you will know/learn how to create table and columns in it and how to insert huge data from a text file into MySQL database through PHP.
To create a table in a database with PHP, we need to connect the database first, then to select the database and then to create the table with a name of that table. At first, we have to create a well format data in a text file with .txt extension, which we can easily use notepad to do this and save the text file in www root folder. The data we are going to store into the text file is only the country code and the country name, which will structure like the following example; you can also download the entire data in .txt format here:
http://www.marlopax.com/countryCode/countryCode.txt
Text File data structure:
AC:Ascension Island
AF:Afghanistan
AL:Albania
continue...
marlopax
Friday, April 09, 2010