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("product s.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 4487
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.dataF ormat = URLLoaderDataFo rmat.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&pa ram2=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
Motoma 3,237
Recognized Expert Specialist
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
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
On the aspx page I have the object tag as follows:
|
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 so I
can't use the site. What complete losers!
When are businesses going to understand that the purpose of a web
site is to communicate with customers or business parterns and NOT
so your "web master or "web engineer" can show off what they...
|
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 clients (Internet Explorer).
My flash content was originally brought in via the “flash satay” method,
but I have since used some server-side magic do deliver one <objecttag
|
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 load fires and the web page is displayed. But then if I close that page and then click on the same button the page load does NOT fire and I get the original web page back again. If I do this in Fire Fox it works but not in IE. If I put a simple...
|
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 on flash opens info underneath map in a separate div. div that has hide/show content is called "operator"
I found this code, but i'm not sure it's what I need, and it's not working...
Flash file>button on stage>script:
| |
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 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...
|
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 gets filled when the Flash buttons are clicked.
Those pieces work as expected. On several of the iframe pages I have some movable panels that are Javascript driven. They work fine the first time the page is loaded.
However, if the user goes to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |