Hi everyone!
I’ve started to work with Actionscript 3.0 for a couple of weeks and I’ve just started my very first “top-to-bottom” AS3 project which I’ll be delivering (a “demo”) next Monday.
However, some basic complications are arising and I just don’t know what to do, this probably has been answered a lot of times but I can’t seem to find a single blogpost/forum/website that addresses this issue in a way that I can understand instead of “copy/pasting” code.
Ok, I’ve said enough, let me describe the problem:
Let’s say I have the following classes:
DocumentSetup.as (where all the other class instances are initiated)
NavBar.as (where the website navigation and buttons are placed)
ContentLoader.as (where the website loads external swf’s with content)
Ok, when I press a button inside the NavBar class I want it to execute a function that tells the DocumentSetup generated MovieClip(contentLoader) to load in a different SWF based on the arguments passed on the Event.
My questions are:
1 - How do I access a public function on a different class? Let’s say I have my navFunction() placed on the DocumentSetup Class, do I need to create “another” instance of the DocumentSetup Class just to tell it to do something?
2 - Let’s say you’re able to explain to me how to solve the problem above.
How can I reference a MovieClip generated by the DocumentClass through another Class? I need something to tell the contentLoader MovieClip to change contents, how do I communicate with it from another Class if the MovieClip was added to the DisplayList through code on the DocumentClass?
3 - How can I create a Variable which is identified throughout the website, let’s say I have an XML file with all the text content that’s going to fill in the content placeholder’s. How do I make this XML data accessible from all classes instead of having to re-import the XML again and again?
I know that these are probably some basic questions about OOP but I just don’t know where to turn. My external classes all work 100% themselves but I cannot get them to communicate with each other, I keep getting compiler errors…
A website in which you can’t navigate to a different page is basically useless :stare:
Anyway, sorry for the long post, any help is appreciated guys!
Thanks in advance.
[SIZE=“1”]BTW, If you read this post and have the answer to just one question that I posted, please at least give me that one so I can start figuring this out.[/SIZE]