43
網網網網網網 Web Game Design 授授授授 授授授

Les 3 ppt

Embed Size (px)

Citation preview

  • 1.
    Web Game Design

2. Chapter 3 AS3 and FlashDevelop
Using FlashDevelop 3 for ElectroServer Client Development
3. Client-side Development Environment
(Client-side Development Environment.docx)
Working with the Flash IDE
The main thing to set up when working with the IDE is the ElectroServerclasspath. Open up Flash and then go to the Edit Menu and select Preferences. Select Actionscript as the Category.
Working with the FlashDevelop
Open FlashDevelop then go to the Tools menu and select Global Classpaths. Select AS3 from the drop down list and select Add classpath.
4. ActionScript 3 and FlashDevelop
FlashDevelop is a free editing tool.
All client code discussed and found in our example files is ActionScript 3, targeting Adobe Flash Player 10. All Projects will be compiled using the Flex compiler.
If you install Flash Develop, youll be able to easily open and compile all projects.
5. Using FlashDevelop 3
Autocomplete is when the code editor anticipates what variable, function, property, or method you are trying to type and gives you a convenient list to choose from.
The Flash IDE has a very limited autocomplete built-in that by default will only work with code provided by Adobe during installation.
Autocomplete, when done right, is invaluable. It can literally save you hours of time looking things up.
6. Using FlashDevelop 3
When using a robust API such as the ActionScript 2 and ActionScript 3 ElectroServer 4 APIs you will quickly go nuts if you have to constantly look up every class name, method name, and property. That is why we suggest using an external code editor such as FlashDevelop 3.
7. Using FlashDevelop 3
By installing FD3 and adding the correct API to your classpath, you will be amazed at how much more quickly you can develop and avoid typos.
8. Chapter 3 AS3 and FlashDevelop

9.
ActionScript 3.0
ActionScript 3.0
ActionScript Java C++
10.
ActionScript 3.0 ( ) ( ) Boolean
11.
class
const
var
getter setter get set
function
new Date myBirthday
varmyBirthday:Date = new Date();
12.



13.

samples import SampleCode
import samples.*;

import samples.SampleCode;
ElectroServer4 ElectroServer
import com.electrotank.electroserver4.ElectroServer;
14.

JavaC++ C# ActionScriptActionScript classextends public
15.
class
package
public class Shape
{
varvisible:Boolean = true;
}
16. Chapter 3 AS3 and FlashDevelop
ActionScript 3Review
17.






18.

19. 20. , 21. , , (MovieClip)
22.
ActionScript 3.0 Event
Flash Player (MouseEvent)
Flash Player
23.
( )
24.

function eventResponse(eventObject:EventType):void{
//
}
//
eventTarget.addEventListener(EventType.EVENT _ NAME, eventResponse);

  • MouseEvent.CLICKeventObjecttargeteventObject.target.name