I've read through the article, and i need a tutotrial on "how to create quiz(display randomly each time) by using flash MX". Can help?
Insert data with Flash Remoting and Cold Fusion MX (RIA)
Hello people, how
are you?
First I want to thanks to all the people that voted in my article about insert
data into database. And all the people that are untill now sending me e-mails
sugesting articles and giving me advices about my articles.
Well, to start
this new article, I have to say that it is based on my last article about flash,
but now it will use a new server technology that is called Flash Remoting, that
consists in read c Cold fusion Component (*.cfc) and instatiate it to read,
update, delete or insert data under the database.
And since now, enter in the wonserfull world of the Rich Internet Application.
Creating
our Cold Fusion Component:
note: this article presume that the user already
have some knowledgements about a Cold Fusion Component Buit-in
Insert.CFC
<cfcomponent>
<cffunction
name="InsertUser" access="remote" returntype="boolean">
<cfargument
name="name_user" type="string" required="true">
<cfargument
name="email_user" type="string" required="true">
<cfquery
datasource="easycfm">
INSERT
INTO users (NAME_USER, EMAIL_USER)
VALUES
('#NAME_USER#', '#EMAIL_USER#')
</cfquery>
<cfreturn
1>
</cffunction>
</cfcomponent>
This component
is based in a database that have 3 columns ("ID_USER - NAME_USER - EMAIL_USER")
The column ID_USER is an auto-identity column, and the other
are text.
Made this, now
we have to start to buid aor interface in Flash MX.
We have to make something like this:

With
the interface already done, it's time to put some action script into flash actions.
First rename the layer called Layer 1 to Actions.
Open this layer in the expert mode (F9) and put the code bellow:
stop();
//stop any other action in the frame
#include "NetServices.as"
//Include the service to connect with flash remote
#include "NetDebug.as"
//Include the service to debug the movie
NetServices.setDefaultGatewayURL("http://localhost:8500/flashservices/gateway");
//make the connection to the gateway, wich in this case
is in por 8500
conn_data = NetServices.createGatewayConnection();
//Make a variable with the connection
service = conn_data.getService("Easycfm.insert",
this);
//Take the service in the CFC
function makeUser() {
Parameter = new Object();
Parameter.name_user = Name_txt.text;
Parameter.email_user = Email_txt.text;
//Make some variables populating it with the data os the
form
service.insertUser(Parameter);
//Insert the user
delete Parameter;
//Delete the parameter already used
}
function Insert_Result(results) {
if (results) {
gotoAndPlay(5);
//Test if the CFC already run
}
}
//End of the code
Whith this code
already pasted in the apropriate frame, you can now test your application, remembering
to publish it as an SWF File.
And start to develop new Rich Internet Applications from this simple tutorial,
click here to take the example.
Questions, comments...mail-me
Thanks for your attention,
Marcos Placoná
I've read through the article, and i need a tutotrial on "how to create quiz(display randomly each time) by using flash MX". Can help?
The only problem I have with inserting, editing and deleting from an swf is securing access to the swf file. You can embed the swf into a cfm page and secure the cfm page but how can you secure the swf from someone accessing if from a url?