MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Especificações Página 125

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 152
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 124
Add ActionScript code 125
Add ActionScript code
You have now added all the graphic and text elements that your FMA
requires. The last step is to add the ActionScript code that displays the
proper text and image for each slide in the
slideShow movie clip.
Test an ActionScript sample
First, you’ll add some simple ActionScript code to see it work.
To add the test ActionScript:
1. In the Timeline, click the layer name actions to activate that layer.
2. Select Window > Actions to open the Actions panel.
3. In the Actions panel, type the following ActionScript code. You can
copy and paste the following code from the Flash Help panel:
function testFunc(eventObj:Object) {
menu_mc.title_txt.text = "Testing the title";
menu_mc.description_txt.text = "Testing the
description";
}
// add the event listener for the button
next_btn.addEventListener("click", testFunc);
This ActionScript code adds some text to the title and description text
boxes that you added to the
menu movie clip earlier.
4. Select Control > Test Movie.
The Flash document opens and plays in a new window.
5. In the Test Movie window, click Next.
The test title and test description text you entered as part of the
ActionScript code appears in the blue rectangle on the right side of
the document.
6. Save your document.
TIP
To add the text (in
quotes),
ActionScript refers
to the text boxes by
noting the name of
the menu movie clip
instance that is on
the Stage
(menu_mc), and then
the name of the text
box itself within the
movie clip instance,
as follows:
menu_mc.description
This syntax is called
dot syntax. It is used
throughout
ActionScript to refer
to objects that are
nested within other
objects.
000_Getting_Started.book Page 125 Friday, September 2, 2005 12:22 PM
Vista de página 124
1 2 ... 120 121 122 123 124 125 126 127 128 129 130 ... 151 152

Comentários a estes Manuais

Sem comentários