Follow me Stepbystep Flex tutorial

Source: Internet
Author: User

Start really to do a AS3 grammar demo, the demo author did not think good topic definition for what, so call the start.

Because it is a text description, there may be some places that are less descriptive than the lecture method (as far as possible), if the reader is not clear, you can comment, the author as far as possible to reply, and thereafter.

You first use a visual component to write the following interface, naming each control name and event name:

Then write the code, as follows:

<mx:Script>
<! [cdata[
Class
Internal function Initls (): void{
var srcarr:array = new Array ();
Srcarr.push ("Soft");
Srcarr.unshift ("Boco");
Srcarr.unshift ("PCCW");
Srcls.dataprovider = Srcarr;

var desarr:array = new Array ("PM", "PL", "SE");
Desls.dataprovider=desarr;
}

Loop initialization
Internal function Forinitls (): void{
var cyclearr:array = new Array ();

for (var i:number = 0; i < 3; i++) {
Cyclearr.push ("Testls" + i);
}

Desls.dataprovider = Cyclearr;
}

Drag and drop effect
Internal function movls (): void{
Srcls.dragenabled = true;
Srcls.dropenabled = true;
Srcls.allowmultipleselection = true;

Desls.dragenabled = true;
Desls.dropenabled = true;
var testdebstr:string = new String ("Drag Success");

Trace (TESTDEBSTR); Output debugging information in flash environment;
}
]]>
</mx:Script>
<mx:list x= "WU" y= "ten" backgroundcolor= "#ED8888" height= "264" width = "" id= "Srcls" ></mx:List>
<mx:list x= "391" y= "" height= "264" width = "backgroundcolor=" "#3AA2C4" id= "Desls" ></mx:List>
<mx:button x= "278.5" y= "134" label= "cyclic initialization" width= "" id= "forinitbtn" click= "Forinitls ()"/>
<mx:button x= "278.5" y= "216" label= "drag Effect" width= "" id= "leftmovbtn" click= "movls ()"/>
<mx:button x= "278.5" y= "label=" initialized "fontsize=" "id=" "Initbtn" click= "Initls" () width=

This code is a simple analysis (if there is not yet clear to leave a comment, the author will try to reply):

<mx:Script>
<! [cdata[//If the DWR framework (Dwr.xml configuration) using AJAX technology is used, it will feel familiar

.../Here is the code to write AS3 grammar.

]]>
</mx:Script>


Definition method: If the reader used Delphi and Java, you will feel is the combination of these two, hehe

The return value is not at the front, but behind, and the method has a display definition of the function at the front

Internal function Forinitls (): void{
var cyclearr:array = new Array (); There's a var,delphi in front of the variable, right?

for (var i:number = 0; i < 3; i++) {//for Loop This is familiar to everyone.
Cyclearr.push ("Testls" + i);
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.