Viewers: in countries Watching now:
In ActionScript 3.0 in Flash Professional CS5 Essential Training, Todd Perkins shows Flash designers how to incorporate ActionScript code into their projects and create interactive presentations and applications. The course includes a review of ActionScript language basics and the object-oriented programming (OOP) methodology, a tour of those Flash Professional CS5 features designed for developers, such as code hinting and the Code Snippets panel, and instructions on interacting with objects in the Library and placing code on the Timeline. Exercise files are included with the course.
Text fields support simple HTML code. If I test the movie, you'll see that I have some HTML code that links to explorecalifornia.org in my text field. This is a standard HTML link. If you're curious about HTML code, you can watch Dreamweaver Essential Training. Close the window, go to the first keyframe of the actions layer, and open the Actions panel. Note that I'm loading a file called bear_html.txt.
That file has the HTML code inside of it. So, if you want to have Flash render simple HTML code, you can scroll down and change text in info_txt.text inside of the textLoaded function, to html all lowercased and then Text with a capital T. That's it, test the movie, and then explorecalifornia.org will be a link. So you can click that, and the web site will open.
Now, Flash doesn't support all HTML, just parts of it. If you want to find more information about what specific HTML tags are supported, you can look htmlText up in Flash Help by highlighting it and pressing F1 on your keyboard. Let's take this to the next level. Let's say that when you roll over the link, you want an underline to appear. To do that, you can apply a CSS style. This works pretty close to how it works in HTML, except for we're going to use CSS using ActionScript only.
So, scroll to the top of the code and above the var textLoader line of code, create a new line of code and type var space css. We'll datatype that to a StyleSheet, capital Ss. I'll set that equal to a new instance of the StyleSheet class, so some parentheses and a semicolon. So, I'm creating in the new StyleSheet, and then I'm going to apply a style to it.
So go to the next line and type css.set, capital S for Style, and in the parentheses, Flash is asking for two things: styleName and styleObject. The name is like what the CSS rule would be for. So a: hover would be for a link when you hover over it. So that's a string, so I'll type a string here, two quotes, and then inside of the quotes, I'll type "a:hover." Now this is standard CSS for styling a link.
Again, I'll refer you to Dreamweaver Essential Training for more information about that. After the quotes, type a comma and a space, and then we're going to create a styleObject. And this is where we specify that there is going to be an underline. To create the styleObject, type curly braces, so open and closed curly braces, and make sure to close up the parentheses and type a semicolon. Now put your cursor inside of the curly braces.
These curly braces are shorthand notation for creating an ActionScript object. Inside of the curly braces, type textDecoration with a capital D; this is all one word. So textDecoration. This is not going to turn blue this time, but it is something that Flash already knows. Then type a colon, add some quotes, and in the quotes, type underline, all lowercase.
So here is how you set a CSS style. If you wanted to set additional styles, you can highlight the setStyle method and then press F1 on your keyboard to read about the supported styles, and then you can add them by typing a comma after the quotes and underline and adding the additional styles. For now, we're just going to leave it at textDecoration underline, so this is only going to apply when you roll over the link, or in other words when you hover over the link.
Scroll all the way to the bottom of your code, and now we'll need to connect the text field to the CSS style. So right below this htmlText line of code, we'll create a new line. So on the next line, type info_txt.styleSheet, capital S for Sheet, space, equals, space, css, and then a semicolon. That's it. Test the movie, and now when you roll over explorecalifornia.org, you'll see that underline.
You can also click it to see if the link still works. Now, I'll close the Preview window. So you can have Flash render simple HTML code by changing the Text property to htmlText. Remember that Flash doesn't support all HTML, just a few specific tags. Then you can create an ActionScript StyleSheet by using the new StyleSheet command. Then you use the setStyle method to set a style. You specify the styleName as a string and then the specifics of the style inside of an ActionScript Object, which you can create like this.
Finally, you set the StyleSheet property of the text field to the StyleSheet that you created.
Find answers to the most frequently asked questions about ActionScript 3.0 in Flash Professional CS5 Essential Training .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.