Using ActionScript to Display Movie Clips
Updated: Apr 23, 2008
Views: 2332
Description: This tutorial will show you how to use movie clips with the Tooltip
Part I - The Completed Project
To get started, here is all of the code and an example of what we are going to build. More advanced users may only need to look at this example, while others might want to read below where I will go through the code and what each part of it does.
Part II - Setting Up the File and Adding Tooltip to a Button
The first step is to create a document, button and an instance of the Tooltip and then adding the Tooltip to the rollover states of the button.
Part III - Exporting a Movie Clip for ActionScript
The next step is prepping a movie clip for use with the Tooltip, you will need to have a movie clip in your library to continue. After you have a movie clip in your library, you need to export this movie clip for ActionScript to do this, right click the movie clip in your library panel and select and select linkage. Check the box Export for ActionScript, make sure Export for first frame is checked, and give it a Class name of mc.
Part IV - Setting up RollOver/Out Events
We will be using Mouse RollOver and RollOut events to show and hide the Tooltip.
This can also be done through ActionScript:
To get started, here is all of the code and an example of what we are going to build. More advanced users may only need to look at this example, while others might want to read below where I will go through the code and what each part of it does.
myTooltip.type = "image"
myTooltip.content = "mc_1";
myTooltip.showTooltip();
myTooltip.content = "mc_1";
myTooltip.showTooltip();
Part II - Setting Up the File and Adding Tooltip to a Button
The first step is to create a document, button and an instance of the Tooltip and then adding the Tooltip to the rollover states of the button.
Part III - Exporting a Movie Clip for ActionScript
The next step is prepping a movie clip for use with the Tooltip, you will need to have a movie clip in your library to continue. After you have a movie clip in your library, you need to export this movie clip for ActionScript to do this, right click the movie clip in your library panel and select and select linkage. Check the box Export for ActionScript, make sure Export for first frame is checked, and give it a Class name of mc.
Part IV - Setting up RollOver/Out Events
We will be using Mouse RollOver and RollOut events to show and hide the Tooltip.
This can also be done through ActionScript:
import flash.filters.BlurFilter;
button_btn.onRollOver = function (){
myTooltip.type = "image"
myTooltip.content = "mc_1";
myTooltip.showTooltip();
}
button_btn.onRollOut = function (){
myTooltip.hideTooltip();
}
button_btn.onRollOver = function (){
myTooltip.type = "image"
myTooltip.content = "mc_1";
myTooltip.showTooltip();
}
button_btn.onRollOut = function (){
myTooltip.hideTooltip();
}
