Once the SDK is installed, let's test is by creating a hello world project. Start by creating a new project from the Project menu. In the project manager panel choose 'Project Manager' from the view menu if not already visible , expand the src folder, and open the Main. In the Main. The project will compile and when finished a blank window should appear this is your application. Launch in Newgrounds Player.
Author Comments. The preloader works now! Hate the music? Get into one of the tutorials and mouse over menu to turn it off. Newgrounds accounts are free and registered users see fewer ads! Nice soundtracks to. Lets you type ActionScript code, which is associated with the currently selected frame. Run Script: Runs the script Pin Script: Pins the script to the pin tabs of individual scripts in the Script pane and move them accordingly.
This feature is useful if you have not organized the code within your FLA file into one central location. Or, it is useful if you are using multiple scripts. You can pin a script to retain the open location of the code in the Actions panel and toggle between the various open scripts. This feature can be useful when debugging. Insert Instance Path and Name: Helps you set an absolute or relative target path for an action in the script.
Find: It finds and replaces text in your script. Format Code: Helps to format the code. Code Snippets : Opens the Code Snippets panel that displays sample code snippets. Add using wizard: Click this button to add actions using an easy-to-use wizard without having to write code.
Help: Displays reference information for the ActionScript element that is selected in the Script pane. For example, if you click an import statement and then click Help, the reference information for import appears in the Help panel. Using actions code wizard. Select an action for which you want to create code using the code wizard. A sample screenshot displaying action code wizard options for actions. Enhance the interactivity of an Animation. In the Timeline , select the action clip. Click Add using wizard in Actions pane.
Object on which to apply the action : Select the required object. Click Next. How to add interactivity to your animations. Watch the video to learn about more actions like play, move vertically, and position the object. Using script window. Create an external file in the Script window. Edit an existing file in the Script window.
Tools in the Actions panel and script window. Find Finds and replaces text in your script. Insert Target Path Actions panel only Helps you set an absolute or relative target path for an action in the script. Help Displays reference information for the ActionScript element that is selected in the Script pane. Code Snippets Opens the Code Snippets panel that displays sample code snippets. Add using wizard Helps you to add code for actions using an interface without having to write code.
Accessing context-sensitive Help from the Actions panel. To select an item for reference, do any of the following:. Select an ActionScript term in the Actions panel in the Script pane. Place the insertion point before an ActionScript term in the Actions panel in the Script pane. To open the Help panel reference page for the selected item, do one of the following:. Press F1. Right-click the item and select View Help. Click Help above the Script pane. Set ActionScript preferences.
Set any of these preferences:. Tab Size. Specifies the number of characters a new line is indented. Code Hints. The method checks if the stage property i. If so it calls the init method. If not it sets an event listener to call the init method once the stage has been set no pun intended.
AS3 is strongly typed meaning that every variable must have a data type declared. Defining the variable type is done with the colon syntax we saw above. Declaring the init method as private means that it can only be accessed by other methods in this class. It accepts one optional argument called e of type Event and it returns nothing. If the argument is not supplied, the e variable will be set to the value null. This declares a variable called text of type TextField and assigns a new instance of a TextField to it.
Next we set a few properties of the object. The text property is the important one. Without it the TextField would be blank and invisible. The textColor property sets the text colour to hexadecimal FF, or red. Finally, we call the addChild method of the Main class which extends Sprite, remember? The Sprite automatically uses the x and y properties of the object to know where to place it.
While it is theoretically possible to use Flex components in a pure AS3 project, it would require a bunch of complicated initialisation which the Flex framework gives you for free.
0コメント