|
-
accessing assets on stage using Document class
ok, if an asset is on stage (design time) and it has an instance name AND it's on frame 1, I can access it BUT if it's frame 2 or beyond, I get errors....any ideas on how to refer to assets on stage frame 2 and beyond within your Document class? thanks!
-
Your document class is executing on frame 1 so things on subsequent frames don't yet exist (so you cant target them)...There is a little secret called addFrameScript that might help you - here's a good writeup on it.
-
what real good is a Document class if you are limited to frame 1 for everything you have to do? that's very constricting! I read that article and it's poorly written, needs more simple "nuts & bolts" examples to illustrate the point. So what is the explanation for "addFrameScript"? what's its main purpose?
thanks!
-
Use gskinners FrameScript class...
I would recommend using the FrameScript class created by gSkinner. Read about it here: gSkinner blog>>
You can also download the class & there are some sample files included... Has been very useful for me.
Niklas
-
so what's the idea exactly? you put all your code in functions in Doc class and tell the FrameScriptManager which frame can access them? if that's the case, how do I reference different classes (not just individual functions) from a frame beyond frame 1? is there a way to make ALL your functions in ALL your classes accessible from frame 2 & beyond without manually doing it with "setFrameScript" or whatever?
-
Well...
...I'm kind of new to AS3 so I'm learning all this stuff myself as well so I might be totally of here but my guess is you do an import of your class into the documentClass and then you will have access to the functions everywhere. But the functions that you want to run from another class must be set to public...
Niklas
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|