Which actionscript should i use
Clear: Clears the content of the output panel. Show Output: Displays the content of the output panel. Lock: Locks the panel. You can only resize the panel but you cannot move or drag the panel. Help: Loads the online Help for the output panel. Close: Closes the output panel. Close Group: Closes the whole panel group.
You can simultaneously dock multiple panels such as timeline, output panel, and compiler errors panel. Actions panel. Looking for the Language Reference? Type the language element in the Actions panel, select it, then press F1 Press F1 immediately.
Learning ActionScript. To learn about writing ActionScript, use these resources:. Overview of the Actions panel. The Actions panel consists of two panes:. Script pane. 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. Basic Button: Go to and Stop. First, we are going to code the triangle on the home page to take us to the "Triangle" page.
Select the triangleSymbol on the home page. In the Properties panel is an "Instance Name" field. Remember that we can have multiple copies of a symbol on our stage. For ActionScript to know which instance of a symbol to work with, each instance needs a unique instance name. Click on the keyframe on frame 1 of the "actions" layer. In the Actions window, enter the following code beneath "stop ;".
Now clicking the triangle should take you to the Triangle page. You've just coded your first button! Basic Button: Code Breakdown. Let's take a moment to see what's going on. Comments do not have any effect. Use them to organize your code. You can also comment out different parts of the code to help trouble shoot if there is a problem.
You can add multiple things inside the brackets. The instance name must be the instance name you gave your button in the Properties panel. The function name can be whatever makes sense as long as it doesn't have spaces, periods, etc. The same function name MUST be used in both places of the button code. Making Page Symbols. We are going to animate our second page. However, to keep our project and our timeline tidy, we want our page content to be on one layer, the "pages" layer.
We can do that by creating movie clip symbols for each page. Go to frame 20 in the "pages" layer this is page 2, the circle page. Name this symbol page2Symbol. Note: Again, I am adding "symbol" to the name in this tutorial for the sake of clarity. Set the type to Movie Clip. For this tutorial, we will simply have the page slide in. Add a keyframe at frame 25 with the page in place. Go back to the keyframe at frame 20 and move the page off stage.
Add a tween by right-clicking in the timeline and choosing "Create Classic Tween. Scrub through the timeline to see the page symbol slide in. Go to frame one of the "actions" layer and add button code for the circleBtn the same way we coded the triangleBtn.
Remember to give the button the instance name "circleBtn" and give the function an appropriate name like "gotoCircle" or "gotoPage2. We have a problem. The button takes us to page2, the circle page, but stops on frame 20 when the page is off-stage. Let's fix that. Go back to the circleBtn code in frame 1 of the "actions" layer. Replace "gotoAndStop" with "gotoAndPlay". We have a new problem. The button now plays our animation for the circle page, but then continues and plays the square page as well.
We can easily fix that with a stop command. Go to frame 29 in the "actions" layer, right before "page3. Create a keyframe, and add a stop command in the Actions window.
Test again. Interactivity and coding requires a lot of testing. Now our second page is working properly. Clicking the circle on the home page plays the timeline from "page2" on frame 20 to the stop command on frame Working Inside Page Movie Clips. Our circle button and page are working properly, but we have animation on the "pages" layer in the main timeline, which could get messy. Let's try to keep all of our animation and content inside the page movie clip. Create a movie clip symbol "page3Symbol" from the text and square on frame 30 in the "pages" layer.
Double click the symbol to enter inside of it. Copy and paste the square to its own layer, and make it a symbol. Now we can animate it. Animate the square so it slides around. Because movie clip timelines play independent of the main timeline, this animation can be as long or as short as you want. Return to the main timeline. Add button code for the squareBtn. You can just copy and paste the code for the triangleBtn, but change the instance name, the function name, and the frame label in the "gotoAndStop" from "page1" to "page3.
Notice that when we click the square button, it takes us to the square page and stops. Because movie clips play independently of the main timeline, the square animation will continuously loop. We can leave it like that, or if we want it to only play once, we can add another stop command. Double click the page3Symbol to open its timeline this is where we animated the square.
Create a new layer at the top of the stack, "actions. More importantly, every time I visit my code it will save me a huge amount of time on searching if all codes are on the top layer. Enough talking on project organization, let us get back on the coding.
Double click on the movie clip "button" in the library to open the movie clip symbol; basically, it is an animation of the background color goes from grey to green then comes back to grey again. On each keyframe, there is a stop function to make it stop, so we will be able to control it with our own action script. Then we need to have a function that controls the timeline in the "mcBouncing" movie clip, so when we click on the button the animation will play. Also, we need to put a stop in the bouncing animation.
In the final part of this workshop, you are going to use the knowledge you have learned on AS3. Notes that evt. Site Map Download Guide Contact. Instances and Naming Convention As I mentioned before, in order to access a stage element, we need to give it an instance name; you might find we already give it a name when we convert it to a movie clip.
The major advantages of conforming to a certain set of naming convention are: 1. To enhance the aesthetic and professional appearance of work product wikipedia The typical naming convention in AS3. For example, a movie clip contains an animation of jumping bunny we could name it "mcBunny" or "mcJumpBunny" If you have multiple scenes, then elements on different scenes should be able to be identified from the name.
A function is a reusable block of code that will perform certain actions. Events and Event Listener If we ever want to add interactivities to the buttons, we need to define an Event that happens and link the event to our buttons. Finally, link the timeline control function to "myButton". Before you start it, here is a brief explanation 1. Creating buttons btnImage1. Resource Links CartoonSmart.
0コメント