ASP.Net and Flash Communication

Hello Readers, I've covered in this article only a small and simple overview of the world of Flash development with ASP. NET. I've recently developed a Web site that covers thoroughly all Flash, ASP. NET communication methods in this article, and a step-by-step introduction to ASP mentioned. NET development with C # using Visual Studio. NET IDE coolest and Adobe Flash CS. Step 1 Open Adobe Flash CS. Create a new document, select Flash File (ActionScript second 0). Perhaps you are interested in ActionScript 3 (AS3), but I choose ActionScript 2 (AS2) for the easier to understand. Only me to step, and I assure you, you are a good Flash developers will be after reading this article. Now you see a single tab, namely "1 Untitled" in the Adobe Flash. After saving the file "Untitled 1" text will be replaced with your preferred file name. I called it "AspFlash. Fla. Remember, FLA is a flash source file and output file SWF movie, the need to be embedded in ASP. Net ASPX file later. Adobe Flash split-down window with several, not to be confused. You do not know all the windows functions. Start with the left called "Tools" in the middle top window called "Time Line", close the window as a "Scene", next to bottom of the window called "Properties" and the right of the window split down the window with many ' color ',' Align ',' Components "and" Library ". The entire Windows can be on and off by the" Window "menu. Look at the" Scene "window, which will be your design area. From der''Properties "window you can color and size as per your requirements. Step 2 Now add a few components from the "Components" expand window 'User Interface'

. Oh! many things. Drag a "Text Input" and a "button" on your "Scene" window and align it correctly. Select 'Text Input "and put an instance name (eg TextInput1) from the window' Properties'. Without such as name, is ActionScript does not recognize components. The same for the 'button' instance name (eg SendData) and the 'Parameters' tab "Change Button" label (for example, sending data).

begin Step 3 Here is from the main coding part. Select "level 1" of "Timeline" window and press F9 (keyboard function keys). You will see "Actions" window, where you as you write code. Type or paste the following code plague. / / ** *************************************** *******//< / p> SendData. onPress = function () (
/ / declare and initialize variables var
send_lv: LoadVars = new LoadVars ();
/ / assign value parameters, such as ASP. Net QueryString
send_lv. mydata = TextInput1. text; send
/ / Send data
send_lv. ('default. aspx', ' _self ',' GET ');
) //****************** ********* *********************// The LoadVars object is for the exchange of data between flash – used server. The LoadVars object is in able either to send data to the server for processing, loading data from the server or sending data to the server and waits for a response from the server in one operation. The LoadVars object uses name-value pairs for the transfer data between the client and the server exchange. The LoadVars object is best used in a scenario, the two-way communication between the Flash Movie and server-side logic requires, however, require not to hand over large amounts of data < / p> are

Step 4 or copy the following code to plague the QueryString in Flash read – Action Script is second in ActionScript 2 is not methods, such as ASP . Net, so I wrote the following codes to get QueryString from URL. _url The method returns the URL of the 'AspFlash. swf "file, the aspx page is loaded. //******************************* ********** *******// / / Reading QuaryString
myURL = this. _url;
myPos = myURL. lastIndexOf ("?");< br /> if (myPos> 0) (var
myRawParam = myURL. substring (myPos + length ("mydata = ') + 1, myURL. length);
MyParam = myRawParam. toString (). ("'"). Join ("");< split br /> if (MyParam! TextInput1 = undefined) (
. text = MyParam;)

) //************************** * *********************// Step 5 Save your file File menu. Now we need to make the final SWF train and embed it on aspx page. From the File menu, click "Publish Settings" and you will be a new window with three tabs (see formats, Flash and HTML). In the Formats tab Check Flash and HTML types, so you do the SWF file embedded code in HTML page. Now press the "Publish" move to build the final. If there are no errors, you will have two Flash files (eg "AspFlash. Swf" and "AspFlash. Html ') in the root folder where the source file" AspFlash. fla is.

Step 6 Now start Visual Studio.

Net (VS) and create a new website called "AspFlash" . VS creates a default page that is "standard." aspx ". From solution explorer, double-click "Standard". aspx "file to markup (also known as inline code) as follows. //************************ ***************** *******//

< ; / p>
 

//***** *********************** ********************//

Copy Now "AspFlash. swf "and" AspFlash. html files in your web root directory. I should find my ASPX, SWF files in the same directory. Open 'AspFlash. html "file and copy the following lines, and paste it into the tag 'default. aspx" file. //***************************************** ** *****//

//******* ** ***************************************// After Paste the above code requires little change to 'AspFlash. swf "parameter like this. Look at the line 'AspFlash. swf? mydata =' '', what we have. _url Flash read data mydata by ASP is delivered. Net later. //************************************* **** *******//

width = "550" height = "400" id = "AspFlash" align = "middle" >

"" />

"quality =" high "bgcolor = "# FFFFFF"
width = "550" height = "400" name = "AspFlash" allowfullscreen align = "middle" allowScriptAccess = "sameDomain"
= "false" type = "application / x-shockwave-flash" pluginspage = "http://www. Macromedia. com / go / getflashplayer" />
//************* ************************ ***********// Finally, add two ASP. NET standard controls on the 'Default. aspx page (such as TextBox and Button). Modify button to send text property to "data". The full "standard". aspx is as follows. looks like //************************************ ***** *******//

;

width = "550" height = "400" id = "AspFlash" align = "middle">

"" />

"quality =" high "bgcolor =" # FFFFFF "
width = "550" height = "400" name pluginspage = "AspFlash" allowfullscreen align = "middle" allowScriptAccess = "sameDomain"
= "false" type = "application / x-shockwave-flash" = " http://www. Macromedia. com / go / getflashplayer "/>

 

//********************************** ************ **// Step 7 In this step, you have to open 'default. cs "file by clicking" View Code "points to" default. "aspx" Solution Explorer of VS. By default, VS has Page_Load event procedure. You must add a text on Page_Load event procedure with the Button1_Click event procedure like this. //***************************************** ** *****// protected void Page_Load (object sender, EventArgs e) (

if (IsPostBack)
if (Request [ "mydata"]! = null)
TextBox1. Text = Request ["mydata"]. ToString ();)

protected void button1_Click (object sender, EventArgs e) (

Response. Redirect ("~ / default. Aspx? Mydata =" + TextBox1. Text);
) / / * ***************** ******************************//< ; / p> Step 8 Well construction the site with F5 (keyboard function key) and enter text in Flash movie and click on "send data" in order to send data to Flash aspx page. You will see aspx 'TextBox' changed your text with Flash 'text input text'. The same way you enter text in aspx "TextBox" and click "send data" in order to send data to aspx Flash movie. Enjoy the communication between technology ASP. Net and Flash. 

Add This! Blinkbits Blinklist Blogmarks BlogMemes BlueDot BlogLines co.mments Connotea del.icio.us de.lirio.us Digg Diigo DZone Facebook FeedMeLinks Folkd.com Fleck Furl Google Google Reader icio.de IndianPad Leonaut LinkaGoGo Linkarena Linkter Magnolia Mister Wong MyShare Ask.com MyStuff Ask.com Yahoo! MyWeb Netscape Netvouz Newsgator Newsvine Oneview.de RawSugar reddit Rojo Segnalo Shadows Simpy SlashDot Smarking Sphere Spurl Startaid StumbleUpon TailRank Technorati ThisNext yigg.de Webnews.de ReadMe.ru Dobavi.com Dao.bg Lubimi.com Ping.bg Pipe.bg Svejo.net Web-bg.com Plugin by Dichev.com

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.