We help IT Professionals succeed at work.

How can i control a library symbol from an actionscript 3 class?

linuxrox
linuxrox asked
on
Hello.  Can someone show me or point me to a tutorial that tells how to control a movieclip symbol that is in the library using an actionscript class?
what i want to do is using Adobe Flash CS5, have my movie which has a movieclip symbol in the library which has some text and an image within it, be able to be modified from a class file.  i want to be able to place the symbol on the stage using actionscript in the first frame that calls my class that ultimately controls the look and placement of it because i plan to have the class file change it's color, text, position and fading etc etc....  i've been unable to achieve this thus far and am in great need of assistance with this.  any help is greatly appreciated.

thanks.
Comment
Watch Question

Top Expert 2009
Commented:
Hello. if you give your movieclip object a ClassID in the properties say MyObject

then create a class file called MyObject.as

create your methods in there to tween / change color / update text etc.

you thne do this in your class

i. create a reference

public / private var obj:MyObject;

2. instantiate it and add to display list.

obj = new MyObject();
obj.x = whatever;
obj.y = whatever;
addChild(obj);

obj.callthefunctiontodosomething();