I'm making a menu, and clicking on one of the buttons would launch the program. Below is a diagram of how I set it up in Flash:

In the class "MenuRightSide" (its instance name is menuRightSide), I've placed a text link that should launch the book, called "NewStoryLink" (instance name newStoryLink). However they're on completely different classes. All the code that launches the book is in the class "Book" (instance name book), function name "StartBook". I've added a mouseclick eventlistener to "newStoryLink", but I'm lost on what to do now.
Code for the class Book:
package {
... //imports
public class Book extends MovieClip {
... //declaring variables
...
...
public function Book() {
// constructor code
}
...
public function startBook():void {
... // code for launching the book
}
}
}
Code for the class MenuRightSide:
package {
... //imports
public class MenuRightSide extends MovieClip {
public function MenuRightSide() {
newStoryLink.addEventListener(MouseEvent.MOUSE_OVER,mouseOverNewStory);
newStoryLink.addEventListener(MouseEvent.MOUSE_OUT,mouseOutNewStory);
function mouseOverNewStory(event:MouseEvent):void { //mouse over newstory link
newStoryLink.addEventListener(MouseEvent.CLICK,clickNewStory); //add listener for clicking this link
TweenMax.to(newStoryLink, 1, {glowFilter:{color:0xFFFFFF, alpha:1, blurX:30, blurY:30}}); //glow on mouseover
function clickNewStory(event:MouseEvent):void {
book.startBook() //can't call this because startBook() is in another class
}
}
function mouseOutNewStory(event:MouseEvent):void { //mouse out newstory link
TweenMax.to(newStoryLink, 1, {glowFilter:{color:0xFFFFFF, alpha:0, blurX:30, blurY:30}}); //remove blur
}
}
}
}
The "book.startBook()" can't be called because "startBook()" isn't in the MenuRightSide class. But I can't put the startBook() function in MenuRightSide class because this class doesn't have any of the movieclips in Book.
Also I'm having trouble completely fading out each class. When I click the new story link, of course the menus should completely fade out, in other words anything under "Menus" class should fade out. But I have no idea how to do this.
Thanks.

New Topic/Question
Reply


MultiQuote


|