[flexcoders] Re: VideoDisplay bug?! How to extend to change a private variable?
P.S. If it's any easier to access an mx_internal variable than a private variable (when sub-classing/extending a control) that'll work too! Cheers Bill --- In flexcoders@yahoogroups.com, beecee1977 [EMAIL PROTECTED] wrote: Hi, I would normally spend more time trying to work this out first, but I'm under a bit of pressure... There appears to be a bug in the VideoDisplay code. vid.close() = within the videoDisplay a private variable called closeCalled is set to true. vid.play() = the closeCalled variable is set to be false in the play function. Fine, but: vid.close() = closeCalled=true vid.load() = loadVideo() vid.play() = if (closeCalled==true) {loadVideo()} So if you load in the video this variable is not reset to false. This means that the video gets loaded twice; once when the video is loaded and once when the video is played... Anyway, all this is besides the point... I just want to know how to get around this. I've tried this: package libraries.utility { import mx.controls.VideoDisplay; public class NewVideoDisplay extends VideoDisplay { //private var closeCalled:Boolean = false; public function NewVideoDisplay() { super(); } override public function load():void { super.load(); closeCalled = false; } } } but naturally I cannot access the private variable closeCalled. How do I go about doing this? Thanks in advance Bill
Re: [flexcoders] Re: VideoDisplay bug?! How to extend to change a private variable?
mx_internal is easy to access because it's just a namespace. Simply import mx.core.mx_internal. After the imports type the line: use namespace mx_internal; There should be a complete discussion if you just search through the mailing list archives for 'mx_internal' specifically or you can just read up on namespaces in general in the docs. HOWEVER, mx_internal is not documented or stable. If you use it and an update to the framework is released, there is no guarantee that the update will not break your code. Use at your own risk. - Dan Freiman On 3/28/07, beecee1977 [EMAIL PROTECTED] wrote: P.S. If it's any easier to access an mx_internal variable than a private variable (when sub-classing/extending a control) that'll work too! Cheers Bill --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, beecee1977 [EMAIL PROTECTED] wrote: Hi, I would normally spend more time trying to work this out first, but I'm under a bit of pressure... There appears to be a bug in the VideoDisplay code. vid.close() = within the videoDisplay a private variable called closeCalled is set to true. vid.play() = the closeCalled variable is set to be false in the play function. Fine, but: vid.close() = closeCalled=true vid.load() = loadVideo() vid.play() = if (closeCalled==true) {loadVideo()} So if you load in the video this variable is not reset to false. This means that the video gets loaded twice; once when the video is loaded and once when the video is played... Anyway, all this is besides the point... I just want to know how to get around this. I've tried this: package libraries.utility { import mx.controls.VideoDisplay; public class NewVideoDisplay extends VideoDisplay { //private var closeCalled:Boolean = false; public function NewVideoDisplay() { super(); } override public function load():void { super.load(); closeCalled = false; } } } but naturally I cannot access the private variable closeCalled. How do I go about doing this? Thanks in advance Bill
[flexcoders] Re: VideoDisplay bug?! How to extend to change a private variable?
That did the trick thanks. For when I get a chance I should really log a bug... anyone got the url for that handy? For anyone else with this problem, so long as you know you'll be ALWAYS calling load() before play(), having done a close() this will do the job: package libraries.utility { import mx.controls.VideoDisplay; import mx.core.mx_internal; use namespace mx_internal; public class NewVideoDisplay extends VideoDisplay { public function NewVideoDisplay() { super(); } override public function close():void { //the real close sets a variable closeCalled //which causes the next video to be loaded after //both load() and play(). //because we always load before playing we can avoid //setting this variable.. mx_internal::videoPlayer.close() } } } --- In flexcoders@yahoogroups.com, Daniel Freiman [EMAIL PROTECTED] wrote: mx_internal is easy to access because it's just a namespace. Simply import mx.core.mx_internal. After the imports type the line: use namespace mx_internal; There should be a complete discussion if you just search through the mailing list archives for 'mx_internal' specifically or you can just read up on namespaces in general in the docs. HOWEVER, mx_internal is not documented or stable. If you use it and an update to the framework is released, there is no guarantee that the update will not break your code. Use at your own risk. - Dan Freiman On 3/28/07, beecee1977 [EMAIL PROTECTED] wrote: P.S. If it's any easier to access an mx_internal variable than a private variable (when sub-classing/extending a control) that'll work too! Cheers Bill --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, beecee1977 billcahill@ wrote: Hi, I would normally spend more time trying to work this out first, but I'm under a bit of pressure... There appears to be a bug in the VideoDisplay code. vid.close() = within the videoDisplay a private variable called closeCalled is set to true. vid.play() = the closeCalled variable is set to be false in the play function. Fine, but: vid.close() = closeCalled=true vid.load() = loadVideo() vid.play() = if (closeCalled==true) {loadVideo()} So if you load in the video this variable is not reset to false. This means that the video gets loaded twice; once when the video is loaded and once when the video is played... Anyway, all this is besides the point... I just want to know how to get around this. I've tried this: package libraries.utility { import mx.controls.VideoDisplay; public class NewVideoDisplay extends VideoDisplay { //private var closeCalled:Boolean = false; public function NewVideoDisplay() { super(); } override public function load():void { super.load(); closeCalled = false; } } } but naturally I cannot access the private variable closeCalled. How do I go about doing this? Thanks in advance Bill