Here's a structural question:
Background:
I have an Index.SWF that loads a Home.SWF.
The website has essentially three layers, top layer is menu bar, middle layer is content, bottom layer is links to home page and e-mail.
All the buttons on the top and bottom layers work.
When I go to add a new button to the middle layer of Home.swf. I get all kind of errors associated with not referencing the right objects or having undefined objects.
I believe my structure is as follows:
> Index
>> Home
>>> Any other SWF through "myLoader" object and buttonclick function
Here's the code:
Code:
Code: Select all
var myLoader:Loader = new Loader();
addChild(myLoader);
function buttonClick(event:MouseEvent):void
{
gotoAndStop(event.target.name);
this.myLoader.load(new URLRequest(event.target.name + ".swf"));
}
thepitch.addEventListener(MouseEvent.CLICK, buttonClick);
services.addEventListener(MouseEvent.CLICK, buttonClick);
aboutus.addEventListener(MouseEvent.CLICK, buttonClick);
marketplace.addEventListener(MouseEvent.CLICK, buttonClick);
contactus.addEventListener(MouseEvent.CLICK, buttonClick);
var homeLoader:Loader = new Loader();
addChild(homeLoader);
function home(event:MouseEvent):void
{
this.homeLoader.load(new URLRequest("main.swf"));
}
home_btn.addEventListener(MouseEvent.CLICK, home);
var contact_req:URLRequest = new URLRequest("mailto:aaron@casenterprises-llc.com");
function contact(event:MouseEvent):void
{
navigateToURL(contact_req,"_blank");
}
contact_btn.addEventListener(MouseEvent.CLICK, contact);
So here's the structural question, "where do I define my new button?" and what code do I use so that the new button is placed on the home page works with the myLoader and buttonclick function located in the parent page?
I have the same structural question, if I decide to add a loading status message for "thepitch.swf"...where do I define and code my loader script?
Any advice on coding scripts is appreciated.