Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where to use script with Flash interface?

Status
Not open for further replies.

SteveHigh

Technical User
Jan 17, 2007
158
0
0
GB
Hello

I am a newcomer to Flash, but I have recently bought a site which I am now trying to customise.

I have an ASP script (which sort of works) and which I need to use with the contact form built-in to my Flash interface (the fields are Name, Email, Country, and Message).

I understand that the ASP script lies between the Flash interface and the server which, I image, requires me to have a separate ASP file in the same way as I would with a normal HTML interface.

What I am unsure about is where I insert, in the Flash interface, the script which allows me to connect to my ASP page? (The vendor suggests I use PHP, but that is unchartered territory.)

For example, I use this: Server.Transfer "whatever.asp" in my existing site to link to a CDONTS email script and an MS Access database. My script also checks that the email address which is input is a valid one, and JavaScript places the cursor in the first field in my online form.

Where do I insert this kind of script in Flash?

Many thanks.

Steve

 
Hello Ken

Many thanks for your reply.

The .FLA file contains a symbol/movie clip of an email contact form (please see into which, when online, the site visitor will input his name, email, country, and message), before clicking submit.

The whole email form (which also contains text and a photo) appears to be part of the whole page which makes up the symbol/movie clip.

When I click on the submit button, it is static text only as the bottom screen shot (above link) indicates. In other words, there doesn't appear to be any code behind it.

I presume that it is behind this submit button that I need to link the Flash interface using the LoadsVars class, which you suggest, with some ASP email script I have. But where do I use, and how!?

Am I on the right track or am I way off course?

Many thanks

Steve
 
Hello Ken

I have created the submit button and I can now see it as the final item in my Library folder as a symbol.

If I press F9, do I click on the + sign and choose Built In Classes | Client/Server | LoadVars, or do I point to the LoadVars (under Types)?

And what, if I can ask, do I do then?!

Many thanks again for all your help.

Steve
 
I would not attach a script to a button by selecting the button on Stage then F9. That's a legacy from old versions of Flash and it's a bad practice.

Write your script in the main timeline:

yourButtonInstanceName.onRelease = function():Void{
trace(this);
}

Kenneth Kawamoto
 
Thanks Ken for all your advice and help. You say I should write

yourButtonInstanceName.onRelease = function():Void{
trace(this);
}

in the main timeline, but where in the main timeline? Which frame? Do you mean click on a frame and then insert something in Properties? What about LoadVar? How does the script above connect to an ASP page?

Thanks.

Steve
 
In the main timeline in the frame where the button sits. You have to give your button a name and use it in place for yourButtonInstanceName.

Once the above script is working next step is LoadVars - but make the above script works first.

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top