all groups > flash actionscript > march 2005 >
You're in the

flash actionscript

group:

Dynamically Assigning MediaType / ContentPath to a MediaPlayback component.


Dynamically Assigning MediaType / ContentPath to a MediaPlayback component. jelaplan
3/14/2005 8:51:07 PM
flash actionscript:
I'm extending the MediaPlayback component and want to assign the contentPath
from a variable that I set in the HTML Object tag. When I try to assign
contentPath to this value, the Flash player crashes. This happens in all
browsers. The MediaPlayback class has a setter method named set mediaType that
includes a comment that suggests that it isn't possible to assign the value
like I'm doing: public function set mediaType(aType:String):Void: //This should
only be called to configure the component initially. // * It does not work at
runtime I've tried to use setMedia(), a method that would seem to be what I
need but crash when using that too. jelaplan@yahoo.com
Re: Dynamically Assigning MediaType / ContentPath to a MediaPlayback component. jelaplan
3/15/2005 6:14:12 PM
I fixed this problem by adding the following line to the inti() method of my
class which extends MediaPlayback class. if (_root.media_file){
contentPath = _root.media_file; } super.init(); Where media_file is the
variable I set in the Object tag anc contentPath is a setter method for
_contentPath. This ensures that the assignment is done at initialization. A
question I had about this is the order of execution and reading of the Object
tag. Apparently, the Object tag is read before component classes are
initialized. I considered reading this value in through load variables. I
have the same interest in knowing the order of execution in that case as well.
AddThis Social Bookmark Button