I am sure you're correct, but I wouldn't know how to actually code that.
Main Topics
Browse All TopicsI can write custom classes, but only know how to create functions within those classes that affect instances of the symbol to which the class is linked. Here's an example:
My class for a gallery thumbnail includes functions for rolling over and off the thumbnail (causing an animation of the thumbnail itself). This class is attached.As you can see, I only know how to talk to "this" - not another movie clip (one that' defined by a different class or code on the timeline).
I can certainly add a click listener to the class, but I don't know what to write in the function in order to tell my separate movie clip of the full-size images to go to the image corresponding to the selected thumbnail. Consequently, I have to instead create a separate instance name for that thumbnail in the FLA timeline - where I know how to communicate between clips. The result is having a mc symbol in the library - linked to an AS class, and also on the timeline with a separate instance name listening for CLICK, in order to move the full image clip.
I do not have a document class named, and have some idea that this may be part of my ignorance.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I am starting to understand. So in order for a given object to access code within a class, you must create a var within the class and also set the value(s) of the var in the class. Then the var name is used in the function using the value(s) specified within the class or specified in another class. Then the var value can be used as applicable by being Public static, public, and private, simply setting their value.
I don't understand variable3_p...specifically
ahh thats not exatly right...
the a function can be given parameters... ie
function example(para1,para2){
}
a variable defined inside the class can be used inside the class (any functions inside that class).
public means it is allowed to be used outside the class
private means it is not allowed to be used outside the class
static means it is the same value for all instances of the class, the class doesnt even have to have an instance.
An instance is when you initiate the class, ie,
var instancename = new classname ();
Another way of doing this (if I understand what you're trying to do) would be to access variables using the parent of the classes you're using. For example, if your document class adds to instances of a class (a circle and a square, for example) using addChild(), accessing the variables between the three things would be very easy.
if part of your document class looks like this:
var testValue:int = 5;
var circleOne:circle = new circle();
var squareOne:square = new square();
addChild( circleOne );
addChild( squareOne );
in the circle or square classes this would cause testValue to be incremented by 1, in this case causing it to go up from 5 to 6.
MovieClip(parent).testValu
Similarly, in either of the two classes, you can use values accessible by the parent (which in this case is the document class) like so; this code could be in the circle class:
MovieClip(parent).squareOn
This would double the x-coordinate of squareOne, an instance of the square class.
If you do this you may get Error #1009, since for a few frames a child added to a MovieClip might not have a value associated with MovieClip(parent). If you just test to make sure it's not null before you try to use MovieClip(parent) you be able to completely avoid this problem. You can do it like this:
if( MovieClip(parent) != null )
and then put whatever code you want within the { and } of that if() statement.
I'll be happy to explain this further, if you wish; I hope this helps you out.
Business Accounts
Answer for Membership
by: iamlfetchPosted on 2008-12-04 at 12:23:46ID: 23098978
yo access data in a class i beilve there are 3 ways of doing so:
1) defining the varible in the class as static and refering to it as className.variable
2) similarly define the varible in the class and refering to it as instance.varible
3) passing the variable to the function eg: var instance = new className(varible);