Topic: MovieClip properties shown as undefined. Pages that link to <a href="https://ozoneasylum.com/backlink?for=29931" title="Pages that link to Topic: MovieClip properties shown as undefined." rel="nofollow" >Topic: MovieClip properties shown as undefined.\

 
Author Thread
Blaise
Paranoid (IV) Inmate

From: London
Insane since: Jun 2003

IP logged posted posted 01-28-2008 11:31 Edit Quote

Hi there,

I've a MovieClip ("play_button") that acts as a button on my stage, it overlays another MovieClip ("video_player") that plays a loaded video swf using MovieClipLoader.

My problem here is that although my play_button does respond to events, I can't seem to set its properties such as _visible, when I trace out this property I get "undefined" returned.

Here's some code...

code:
private function onLoadInit() : Void {
	video_form["video_player"].stop();
	video_form["play_button"].onRelease = OnPlayReleased;
}
	
private function OnPlayReleased() : Void {
	trace("Play released pressed");
	trace("play_button._visible: "+video_form["play_button"]._visible);
	video_form["play_button"]._visible = false;
	trace("play_button._visible: "+video_form["play_button"]._visible);
	trace("making play button invisible");
	video_form["video_player"].play();
}


Now, when my play_button is pressed, I do get traces output as the OnPlayReleased function requests, so I know it's bubbling through. the interesting thing is, that firstly, my play_button does not respond to its _visible property being set to false (both traces output undefined here). and my video_player does not start to play.

I can't work out why this would be the case, and I've played with writing this in another way but I have similar results, is it a question on scope here?

Any help and pointers would be really appreciated.

Cheers,

Blaise
Paranoid (IV) Inmate

From: London
Insane since: Jun 2003

IP logged posted posted 01-28-2008 12:10 Edit Quote

Ah crap, I always forget to Delegate, I simple need to change my onRelease call to

code:
video_form["play_button"].onRelease = Delegate.create(this, onPlayReleased);


Oh well, it was a question of Scope after all, at least it's sorted.

Thanks for listening

derek122
Nervous Wreck (II) Inmate

From:
Insane since: Apr 2008

IP logged posted posted 04-18-2008 08:47 Edit Quote

spam removed. user banned.

(Edited by Tyberius Prime on 04-18-2008 11:02)



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu