All examples
"go to movie" in StarMenu Xtra
| Downloads |
StarMenuExample_1.zip
- Description:
- Associated source files
- Size:
- 120 kB
- Requirements:
- Director MX
StarMenu Xtra
|
If in the function handling the menu item click you place the direct Lingo command
go to movie, every several clicks (undetermined amount) you can get an error message "Access violation at address 06CCC80E in module 'starmenu.x32'. Read of address FFFFFFFF". It is due to the fact that every time you go to a new movie, the current one is closed and the StarMenu Xtra cast member deleted from the memory, although one of its functions (i.e. the click handling one) is still being executed. To eliminate this you should use some trick in Director.
The solution is to caused the
go to movie command inside other event handler than menu item click handler. The best would be to use
exitFrame event, as it is raised tens times per second and the user will not notice any delay between the menu item click and application reaction. We can use additional global variables (of Boolean type) named for instance GoToMovieX allowing to communicate between events. Every new movie will then have its own variable set on
true in menu item click handler and tested in
exitFrame handler. The
true value will make the presentation go to the other movie.
Below is the contents of StarMenu Xtra cast member script. Let's assume we have 3 menu items named "Articles", "Pictures" and "Movies" and each one of them is to launch a .dir movie named respectively "art.dir", "pict.dir" and "mov.dir".
-- StarMenu Xtra cast member script
global GoToMovie1, GoToMovie2, GoToMovie3
on menuClick menuItem
if menuItem[#Name] = "Articles" then GoToMovie1 = true
else if menuItem[#Name] = "Pictures" then GoToMovie2 = true
else if menuItem[#Name] = "Movies" then GoToMovie3 = true
end
on exitFrame
if GoToMovie1 then
GoToMovie1 = false
go to movie "art"
end if
if GoToMovie2 then
GoToMovie2 = false
go to movie "pict"
end if
if GoToMovie3 then
GoToMovie3 = false
go to movie "mov"
end if
end
Note. In order for
exitFrame event to be raised in a cast member, in the current frame there should be a sprite for the given one. Therefore, using the StarMenu Xtra cast member the developer should create a sprite for the whole range of frames for which the script is to work in. Sprite associated with StarMenu is used to display the menu automatically, but if this option is not used (because either
Popup or
ModalPopup function is used), then this sprite can have 0x0 size and can be put in any place of the stage, as shown below.
For more information on the StarMenu sprite and menu display see the
Manual.
Any comments? -
All examples