i am using a flash template for my website.i am working on asp.net 2.0 for creating my website. this flash template has got buttons.on the click of the button i want the user to be redirected to the respective pages.hence i have written the following code in the action script window of flash for my "products" button
on (press)
{
getURL("products.aspx","_self","POST");
}
but when i run my page in asp.net the click of my products button does not show any change.it is still in the same page.what code should i write in order to make this button work?in short how do i redirect my flash button to the aspx page?Thanking in advance.
9 4465
Is it even possible to post variables to .NET? I have been searching the internet and only come up with info on how to do it with PHP. If anyone has any info on doing it with .NET (C#) I would appreciate it.
I am trying to create a flash email form with Actionscript 3.0 and have gotten this far with it: - var variables:URLVariables = new URLVariables();
-
var varSend:URLRequest = new URLRequest("http://thefreightrateco.com/dev/Contactus.aspx");
-
var varLoader:URLLoader = new URLLoader;
-
varSend.method = URLRequestMethod.POST;
-
varSend.data = variables;
-
-
stop();
-
-
stage.focus = tbName;
-
-
-
send_btn.addEventListener(MouseEvent.CLICK, sendEmail);
-
-
function sendEmail(event:MouseEvent):void
-
{
-
variables.tbName = tbName.text;
-
variables.tbEmail = tbEmail.text;
-
variables.tbBody = tbBody.text;
-
varLoader.load(varSend);
-
}
I have the same issue with the button not doing anything... I would prefer to use C# for the backend and am using .NET 2.0... Anyone have any ideas on what the problem is?
Hi! I really don't know anything about the .NET framework, I use php, but POST and GET are standard methods for sending variables to any server-side script.
Also if you are waiting any kind of response from the server when sending the request, it's just in vain, since you didn't added any event listener for the Complete event of the URLLoader object. Unless you add it and at least make the listener function trance something the flash movie won't do anything, but that doesn't mean it's not working.
You also missed the dataFormat for the URLLoader:
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
If you want you can check this link http://livedocs.adobe.com/flex/201/h...ons_173_2.html
It's very helpfull, but it's for flex, anyway it's the same thing, just ommit the scope part (private, public and stuff)
Best regards
The_Nephilim
I am trying to create a flash email form with Actionscript 3.0 and have gotten this far with it: - var variables:URLVariables = new URLVariables();
-
var varSend:URLRequest = new URLRequest("http://thefreightrateco.com/dev/Contactus.aspx");
-
var varLoader:URLLoader = new URLLoader;
-
varSend.method = URLRequestMethod.POST;
-
varSend.data = variables;
-
-
stop();
-
-
stage.focus = tbName;
-
-
-
send_btn.addEventListener(MouseEvent.CLICK, sendEmail);
-
-
function sendEmail(event:MouseEvent):void
-
{
-
variables.tbName = tbName.text;
-
variables.tbEmail = tbEmail.text;
-
variables.tbBody = tbBody.text;
-
varLoader.load(varSend);
-
}
I have the same issue with the button not doing anything... I would prefer to use C# for the backend and am using .NET 2.0... Anyone have any ideas on what the problem is?
Hello,
Thanks for the article... I did read it, but am still missing a few things.
This is what I have now: - var variables:URLVariables = new URLVariables();
-
var varSend:URLRequest = new URLRequest();
-
varSend.url = "http://www.thefreightrateco.com/dev/contactus.aspx";
-
varSend.method = URLRequestMethod.POST;
-
varSend.data = variables;
-
var varLoader:URLLoader = new URLLoader();
-
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
-
varLoader.addEventListener(Event.COMPLETE, sendEmail);
-
-
-
stop();
-
-
stage.focus = tbName;
-
-
-
send_btn.addEventListener(MouseEvent.CLICK, sendEmail);
-
-
function sendEmail(event:MouseEvent):void
-
{
-
variables.tbName = tbName.text;
-
variables.tbEmail = tbEmail.text;
-
variables.tbBody = tbBody.text;
-
trace(varSend.data);
-
varLoader.load(varSend);
-
//varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
-
}
The trace shows the right data and an error message: - tbEmail=Bob%40Bob%2Ecom&tbBody=Body%20of%20email&tbName=Bob
-
Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
-
at Error$/throwError()
-
at flash.net::URLVariables/decode()
-
at flash.net::URLVariables$iinit()
-
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
How do I append the query string to the URL?
I see, your problem is that your function sendEmail is only accepts mouse events.
Also, the event listener fot the URLLoader fires the function once the mail has already been sent. The mail is being sent when you click the button, the event listener for the URLLoader is just to keep track of the completition process.
So write a function to tell the user when the email has been sent.
and use the one you got (sendEmail) just for the mouse.
You cannot use a event handler function for various types of events.
You also need to pass the URL variables as a query string (like in Ajax), not by creating nonexistent properties.
Something like this: "param1=val1¶m2=val2";
Your code would be like this now: -
stop();
-
var variables:URLVariables = new URLVariables();
-
var varSend:URLRequest = new URLRequest("http://www.thefreightrateco.com/dev/contactus.aspx");
-
varSend.method = URLRequestMethod.POST;
-
var varLoader:URLLoader = new URLLoader();
-
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
-
varLoader.addEventListener(Event.COMPLETE, onComplete);
-
-
stage.focus = tbName;
-
-
-
send_btn.addEventListener(MouseEvent.CLICK, sendEmail);
-
-
function onCompete(e:Event):void {
-
trace('The email has been sent');
-
//you can add eny other functionality to actually tell the user
-
//I'm just tracing a legend
-
}
-
-
function sendEmail(event:MouseEvent):void
-
{
-
variables.decode("tbName=" + tbName.text + "&tbEmail=") + tbEmail.text + "&tbBody=" + tbBody.text);
-
varSend.data = variables;
-
-
trace(varSend.data);
-
-
varLoader.load(varSend);
-
}
Try that and tell me how it worked
Best regards
The_Nephilim
It is still giving me the same errors after I dropped the code you gave me in.
Thanks,
RRocket
Hello,
Thanks for the article... I did read it, but am still missing a few things.
This is what I have now: - var variables:URLVariables = new URLVariables();
-
var varSend:URLRequest = new URLRequest();
-
varSend.url = "http://www.thefreightrateco.com/dev/contactus.aspx";
-
varSend.method = URLRequestMethod.POST;
-
varSend.data = variables;
-
var varLoader:URLLoader = new URLLoader();
-
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
-
varLoader.addEventListener(Event.COMPLETE, sendEmail);
-
-
-
stop();
-
-
stage.focus = tbName;
-
-
-
send_btn.addEventListener(MouseEvent.CLICK, sendEmail);
-
-
function sendEmail(event:MouseEvent):void
-
{
-
variables.tbName = tbName.text;
-
variables.tbEmail = tbEmail.text;
-
variables.tbBody = tbBody.text;
-
trace(varSend.data);
-
varLoader.load(varSend);
-
//varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
-
}
The trace shows the right data and an error message: - tbEmail=Bob%40Bob%2Ecom&tbBody=Body%20of%20email&tbName=Bob
-
Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
-
at Error$/throwError()
-
at flash.net::URLVariables/decode()
-
at flash.net::URLVariables$iinit()
-
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
How do I append the query string to the URL?
Try this out: -
function EmailPost(name, email, body)
-
{
-
var postData = new LoadVars();
-
-
//Load up all the variables you want to POST
-
postData.tbName = name;
-
postData.tbBody = body;
-
postData.tbEmail = email;
-
-
postData.send("http://www.thefreightrateco.com/dev/contactus.aspx", "_self","POST");
-
}
-
Hi motoma, the functionalities of loadvars and others in AS2, in AS3 moved to the URLLoader Class, so LoadVars shouldn't work. at least in Flex2, I don't know if Flash CS3 offers some kind of backwards compatibility with AS2 when using AS3. Even thoug I don't think so, because you can choose which language you will use.
I'll try this exaple in flex to see if I made some typo in the way and post the working code.
Best regards,
The_Nephilim
Try this out: -
function EmailPost(name, email, body)
-
{
-
var postData = new LoadVars();
-
-
//Load up all the variables you want to POST
-
postData.tbName = name;
-
postData.tbBody = body;
-
postData.tbEmail = email;
-
-
postData.send("http://www.thefreightrateco.com/dev/contactus.aspx", "_self","POST");
-
}
-
Got it, all you had to change was the dataFormat of the URLLoader to text.
I also reorganized the code into a function, so it's easier to read now: -
send_btn.addEventListener(MouseEvent.CLICK, onClick);
-
-
function onClick(e:MouseEvent):void {
-
var src:String = "tbName=" + tbName.text + "&tbEmail=" + tbEmail.text + "&tbBody=" + tbBody.text;
-
var vars:URLVariables = new URLVariables(src);
-
var request:URLRequest = new URLRequest('http://www.thefreightrateco.com/dev/contactus.aspx');
-
request.method = URLRequestMethod.POST;
-
request.data = vars;
-
-
var loader:URLLoader = new URLLoader();
-
loader.dataFormat = URLLoaderDataFormat.TEXT;
-
-
loader.load(request);
-
}
-
I did this in Flex and it's working perfectly.
Best regards,
The_Nephilim
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Keith Rowe |
last post by:
Hello,
I am trying to reference a Shockwave Flash Object on a vb code behind page
in an ASP.NET project and I receive the following error:
Guid should contain 32 digits with 4 dashes...
|
by: post2google |
last post by:
I was thinking about where to go for lunch the other day, so I went to
hardees.com to see what the menu looked like these days. What
comes up is a big note that my flash version is not new enough...
|
by: Neo Geshel |
last post by:
Greetings.
BACKGROUND:
My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are
delivered as application/xhtml+xml for all non-MS web clients, and as
text/xml for all MS web...
|
by: mutlyp |
last post by:
I have an web application, for a menu to go to page to page wit in the web app I am using flash buttons. The problem is that the first time I click on the flash button everything works fine the page...
|
by: elamberdor |
last post by:
Hi All!
Trying to get a drop down hide/show div on a html page triggered by a button in flash.
(Intro: Very very Little experience in dynamic flash)
setup: html page, flash map on page, button...
|
by: anuparvathy |
last post by:
i am using a flash template for my website.i am working on asp.net 2.0 for creating my website. this flash template has got buttons.on the click of the button i want the user to be redirected to the...
|
by: johnlanglois |
last post by:
I found several discussions that hinted at my issue, but none that contained a solution.
I have a main page that contains a FLASH movie/Menu. The rest of the site is contained in an IFrame that...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
| |