Reputation: 1267
I have a layer named "splash" and a layer named "home". On the splash layer I want to call a function which is stored on a layer named "navigation" inside a MovieClip called "page" on the home layer.
How can I do this?
Thanks.
Upvotes: 0
Views: 774
Reputation: 4870
You should just do this:
page.whateverYourFunctionIsCalled();
because as ToddBFisher already said, layers are only present in Flash while editing, an exported SWF doesn't have them anymore. You didn't tell what the function is you want to call inside the page
MovieClip so I can't be more specific here.
Upvotes: 0
Reputation: 2631
Try using this from splash:
//Look at my parent, look into home, look into page, look into navigation, call myFunction() Object(parent.getChildByName("home")).getChildByName("page").getChildByName("navigation").myFunction()
The Object casting is to allow chaining all the children queries without additional casting. This is because getChildByName returns a DisplayObject which does not have the method for child searching.
Upvotes: 0
Reputation: 11590
As far as I understand, layers are strictly for a convenience factor while editing as well as setting the initial Z order of objects on the stage. When the swf is actually run layers no longer exist.
If they are on the same frame number I would assume you could just call the function itself.
Personally I would store ALL the code at the same frame on one layer. It is easier to maintain as you do not have to go hunting down code. I hope that helps.
Upvotes: 2