MACROMEDIA FLASH 8-FLASH Specifikace Strana 239

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 290
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 238
Add navigation to return to Scene 1 239
Link a button to a scene
Now that the playhead stops at Frame 1, you’ll add ActionScript that takes
the user to Scene 2 upon releasing the goScene_btn instance.
Press Enter (Windows) or Return (Macintosh) twice and type the
following comment. Then write the function that takes users to
Scene 2 upon release of the goScene_btn instance:
// This script takes the user to Scene 2 when goScene_btn
// is released.
goScene_btn.onRelease = function (){
gotoAndStop("Scene 2", 1);
};
In the script that you just typed, you used the onRelease() method
for the button object. The
gotoAndStop() function is a timeline
control function that lets you specify the scene and frame number. In
this case, you specified Frame 1.
Add navigation to return to
Scene 1
The function that you’ll add to the button in Scene 2, to return the user to
Scene 1, is similar to the function that you wrote to take the user to
Scene 2.
1. In the Scene panel, select Scene 2.
In the Timeline, create a new layer and name it Actions.
2. Select Frame 1 of the Actions layer.
In the Actions panel, enter the following in the Script pane:
// function takes user to Scene 1 when back_btn instance
// is released
back_btn.onRelease = function (){
gotoAndStop("Scene 1", 1);
};
The only differences between this function and the function in Scene 1
are the name of the button and the name of the scene.
3. In the Scene panel, select Scene 1.
Zobrazit stránku 238
1 2 ... 234 235 236 237 238 239 240 241 242 243 244 ... 289 290

Komentáře k této Příručce

Žádné komentáře