Sun. Nov 28th, 2021

On this article you’ll be taught the world of Flash improvement with ASP.NET. I’ve lately designed a web site, which completely covers the entire Flash to ASP.NET communication strategies talked about on this article, in addition to a step-by-step introduction to ASP.NET improvement with C# utilizing Visible Studio.NET coolest IDE and Adobe Flash CS.

Step 1

Open Adobe Flash CS. Create a brand new doc choosing Flash File (Motion Script 2.zero). You might be enthusiastic about Motion Script three (AS3) however I select Motion Script 2 (AS2) for simpler perceive. Simply step with me and I guarantee you, you’ll change into a great Flash developer after studying this text. Now you will note a single tab particularly ‘Untitled 1’ within the Adobe Flash. After saving the file ‘Untitled 1’ textual content will substitute along with your most well-liked filename. I named it ‘AspFlash.fla’. Keep in mind FLA is a flash supply file and your output film can be SWF, which can have to be embedded in ASP.Web ASPX file later.

Adobe Flash split-down with a number of window, don’t confused. You do not want to know the all window options. Begin with left referred to as ‘Instruments’, within the middle high window referred to as ‘Timeline’, subsequent down window referred to as ‘Scene’, subsequent backside window referred to as ‘Properties’ and the correct most window split-down with many window ‘Colour’, ‘Align’, ‘Elements’ and ‘Library’. These whole home windows could be switched on/off by ‘Window’ menu. Take a look at the ‘Scene’ window which can be your design space. From the ”Properties’ window you may change colours and measurement as per your necessities.

Step 2

Now add some element from the ‘Elements’ window develop ‘Consumer Interface’. Oh! a number of stuff. Drag just one ‘TextInput’ and one ‘Button’ in your ‘Scene’ window and align them accurately. Choose ‘TextInput’ and put an occasion title (e.g. TextInput1) from ‘Properties’ window. With out occasion title, Motion Script won’t acknowledge any parts. Do identical for the ‘Button’ occasion title (e.g. SendData) and from the ‘Parameters’ tab change ‘Button’ label (e.g. Ship Information).

Step three

Right here we begin out predominant coding half. Choose ‘Layer 1’ from ‘Timeline’ window and press F9 (keyboard operate key). You will notice ‘Actions’ window, the place you writes you are AS code. Kind or copy pest the next codes.
SendData.onPress = operate() ;

The LoadVars object is used for exchanging information between flash – server. The LoadVars object is able to both sending information to the server for processing, loading information from the server, or sending information to the server and ready for a response again from the server in a single operation. The LoadVars object makes use of name-value pairs to alternate information between the consumer and the server. The LoadVars object is finest utilized in a state of affairs that requires two-way communication between the Flash Film and server-side logic, however does not require massive quantities of information to be handed.

Ship technique sends the variables within the send_lv object to the desired URL. The string is posted to the URL utilizing the HTTP GET technique, in order that ASP.Web simply learn mydata variable in QueryString.

Step four

Kind or copy pest the next codes to learn the QueryString in Flash – Motion Script 2. In Motion Script 2 there are not any strategies like ASP.Web offers, so I wrote the next codes to get QueryString from URL. The _url technique returns the URL of the ‘AspFlash.swf’ file that was loaded with ASPX web page.
//Studying QuaryString
myURL = this._url;
myPos = myURL.lastIndexOf(“?”);
if (myPos > zero) {
var myRawParam = myURL.substring(myPos + size(‘mydata=’) + 1, myURL.size);
myParam = myRawParam.toString().cut up(“‘”).be part of(“”);
if (myParam!= undefined)

Step 5

Save your file from File menu. Now we have to make the ultimate SWF transfer and embed it to ASPX web page. From File menu click on ‘Publish Settings’ and you will note a brand new window containing three tabs (Codecs, Flash and HTML). Within the Codecs tab verify Flash and HTML varieties, with the intention to get the SWF embedded code in HTML web page. Now press button ‘Publish’ to construct the ultimate transfer. If there are not any error occurred, flash will present you to 2 recordsdata (e.g. ‘AspFlash.swf’ and ‘AspFlash.HTML’) in root folder the place supply file ‘AspFlash.fla’ situated.

Step 6

Now begin Visible Studio.Web (VS) and create a brand new web site and title it ‘AspFlash’. VS create a default web page particularly ‘Default.aspx’. From resolution explorer double click on on ‘Default.aspx’ file to view Markup code (additionally referred to as Inline code) like following.

Now copy ‘AspFlash.swf’ and ‘AspFlash.HTML’ recordsdata in to your net root listing. I imply ASPX, SWF recordsdata must be situated in identical listing. Open ‘AspFlash.HTML’ file and duplicate whole ‘object’ tag and paste it inside tag of ‘Default.aspx’ file.

After pasting the above code little modified wanted on ‘AspFlash.swf’ parameter like the next. Take a look at the road ‘AspFlash.swf?mydata=”’ what we added. Flash learn _url­ information with mydata which can be equipped by ASP.Web later.

Lastly, add two ASP.internet commonplace controls on ‘Default.aspx’ web page i.e. TextBox and Button. Change Button textual content property to ‘Ship Information’.

Step 7

On this step it is advisable to open ‘Default.cs’ file by clicking ‘View Code’ pointing on ‘Default.aspx’ from Resolution Explorer of VS. By default VS added Page_Load occasion process. That you must add some textual content on Page_Load occasion process together with button1_click occasion process like the next.

protected void Page_Load(object sender, EventArgs e)

protected void button1_Click(object sender, EventArgs e)

Step eight

Now construct the web site utilizing F5 (keyboard operate key) and kind some textual content in Flash film and click on ‘Ship Information’ to ship Flash information to ASPX web page. You will notice ASPX ‘TextBox’ textual content modified along with your Flash ‘TextInput’ textual content.

Similar manner sort some textual content in ASPX ‘TextBox’ and click on ‘Ship Information’ Button to ship ASPX information to Flash film. Benefit from the communication approach between ASP.Web and Flash. If want additional help, be at liberty to contact me by way of e-mail.

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *