This is a scope issue. This function you wrote is in a class, but "mc"
doesn't know how to access methods of that class. You could get around
it by assigning a property to mc which is an instance of the class, and
then calling the getPlayFile() method that way. As you have it now, mc
doesn't have any reference or know about the getPlayFile() method in
your class. In fact, mc doesn't know anything about your class. So one
way to work around this, would be to do this:
private function setPlayButton(){
var mc:MovieClip = vid.toolbar.playVideoButton;
mc.classinstance = this;
mc.onRollOver = mc.onDragOver = function():Void{
this.classinstance.getPlayFile(0);
}
}
Jason Merrill
Bank of America
Learning & Organization Effectiveness - Technology Solutions
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
>>Sent: Monday, September 18, 2006 10:42 AM
>>To: Flashcoders mailing list
>>Subject: [Flashcoders] class function call onMouseAction
>>
>>please, anyone knows what's the silly error I'm not catching here?
>>when I assign the rollOver to the class instance (setPlayButton), I
>>don't getting able to access the 'getPlayFile function' thru its
>>rollOver, why?
>>
>>
>>public function create(name:String, target:MovieClip, depth:Number,
>>x:Number,y:Number):VideoThumb {
>> vid = VideoThumb(target.attachMovie("thumb", name, depth));
>> vid._files = new Array();
>>
>> setXY(x, y);
>> setPlayButton();
>> return vid;
>>}
>>
>>private function setPlayButton(){
>> var mc:MovieClip = vid.toolbar.playVideoButton;
>> mc.onRollOver = mc.onDragOver = function():Void{
>> trace(getPlayFile(0));
>> }
>>}
>>
>>public function getPlayFile(index:Number):String{
>> return vid._files[index];
>>}
>>
>>
>>_______________________________________________
>>[email protected]
>>To change your subscription options or search the archive:
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>Brought to you by Fig Leaf Software
>>Premier Authorized Adobe Consulting and Training
>>http://www.figleaf.com
>>http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com