Answered
class files and movie clips in AS2.0
Hello forum members,
I have a real lack of understanding on how to perform some actions on a movie clip using
a class file. I like to concept of using a class in lieu of actionscript (2.0 for this app) on the timeline of my fla file.
I am using AS2.0 TweenLite from greensock.
I have a movieclip in the fla library, linkage for the clip is "quiz_bg"
I would like to be able to place the clip on the stage in the class file using "attachMovie"
Once on the stage, I would like to move it.
My questions are: How do I correctly reference the movie clip in the library in the class file?
How do I correctly instantiate the class in the fla? It is one thing to put a trace statement in a constructor, and see the trace displayed, it is something else to put a movieclip on the stage, and then do something with it! (at least for me). Here is the code I am trying to use to accomplish this task:
class RdoRotate extends MovieClip
{
private var clip:String;
private var rdo_mc:MovieClip;
rdo_mc = this;
public function RdoRotate(mc:String)
{
rdo_mc.attachMovie(mc,"xdo",getNextHighestDepth());
TweenLite.to(mc, 4, {_alpha:0,_xscale:50,_yscale:50,_x:0,_y:0, onComplete:showMe});
clip = mc;
mc._x = 50;
trace("built");
}
function showMe()
{
TweenLite.to(clip, 2, {_alpha:100,_xscale:45,_yscale:45,_x:225,_y:150,onComplete:turnMe});
}
function turnMe()
{
TweenLite.to(clip, 4, {_rotation:366, ease:Elastic.easeOut, onComplete:turnBack});
}
function turnBack()
{
TweenLite.to(clip, 4, {_rotation:-360, ease:Elastic.easeIn,overwrite:true});
}
}
and in the fla file I am using: var x_mc:RdoRotate = new RdoRotate("quiz_bg");
I know there is something basic here I am missing. Any tips will help me do this correctly.
Thanks,
eholz1
I have a real lack of understanding on how to perform some actions on a movie clip using
a class file. I like to concept of using a class in lieu of actionscript (2.0 for this app) on the timeline of my fla file.
I am using AS2.0 TweenLite from greensock.
I have a movieclip in the fla library, linkage for the clip is "quiz_bg"
I would like to be able to place the clip on the stage in the class file using "attachMovie"
Once on the stage, I would like to move it.
My questions are: How do I correctly reference the movie clip in the library in the class file?
How do I correctly instantiate the class in the fla? It is one thing to put a trace statement in a constructor, and see the trace displayed, it is something else to put a movieclip on the stage, and then do something with it! (at least for me). Here is the code I am trying to use to accomplish this task:
class RdoRotate extends MovieClip
{
private var clip:String;
private var rdo_mc:MovieClip;
rdo_mc = this;
public function RdoRotate(mc:String)
{
rdo_mc.attachMovie(mc,"xdo",getNextHighestDepth());
TweenLite.to(mc, 4, {_alpha:0,_xscale:50,_yscale:50,_x:0,_y:0, onComplete:showMe});
clip = mc;
mc._x = 50;
trace("built");
}
function showMe()
{
TweenLite.to(clip, 2, {_alpha:100,_xscale:45,_yscale:45,_x:225,_y:150,onComplete:turnMe});
}
function turnMe()
{
TweenLite.to(clip, 4, {_rotation:366, ease:Elastic.easeOut, onComplete:turnBack});
}
function turnBack()
{
TweenLite.to(clip, 4, {_rotation:-360, ease:Elastic.easeIn,overwrite:true});
}
}
and in the fla file I am using: var x_mc:RdoRotate = new RdoRotate("quiz_bg");
I know there is something basic here I am missing. Any tips will help me do this correctly.
Thanks,
eholz1
