Re: [Flashcoders] stumped video behaviour in AS2/Classes

2007-05-04 Thread sebastian chedal

doh, I'm really sorry. Silly me, thanks!
[btw the constructor had all kinds of other [irrelevant] things in it, hence
why i left it out, sorry! will include next time]

On 5/3/07, Lists [EMAIL PROTECTED] wrote:


Sebastian,

You didn't include the timeline code, but I made some assumptions. I think
the most relevant issue is that your NetConnection and NetStream variables
are local and expire after the function is called. This works:

//in class PostView.as, in com/blabla/
class com.blabla.PostView extends MovieClip {

private var _netConn:NetConnection;
private var _netStream:NetStream;

  public function playVideo () {
_netConn = new NetConnection();
_netConn.connect(null);
_netStream = new NetStream(_netConn);
_netStream.onStatus = function (infoObject:Object) {
 trace (infoObject.code);
}

_root.vid.attachVideo(_netStream);
_netStream.play(video/video.flv);
  }

}

//in timeline
import com.blabla.PostView;

var myVar:PostView = new PostView();
myVar.playVideo();

//


I'm not a fan of classes without constructors, though. If you only
included
a snippet, disregard. If not, you can unify the class and function name
above and omit the last line in the timeline. Or, even throw in a generic
constructor for clarity/possible info.

Rich Shupe


___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] stumped video behaviour in AS2/Classes

2007-05-03 Thread Lists
Sebastian,

You didn't include the timeline code, but I made some assumptions. I think
the most relevant issue is that your NetConnection and NetStream variables
are local and expire after the function is called. This works:

//in class PostView.as, in com/blabla/
class com.blabla.PostView extends MovieClip {

private var _netConn:NetConnection;
private var _netStream:NetStream;

  public function playVideo () {
_netConn = new NetConnection();
_netConn.connect(null);
_netStream = new NetStream(_netConn);
_netStream.onStatus = function (infoObject:Object) {
 trace (infoObject.code);
}

_root.vid.attachVideo(_netStream);
_netStream.play(video/video.flv);
  }

}

//in timeline
import com.blabla.PostView;

var myVar:PostView = new PostView();
myVar.playVideo();

//


I'm not a fan of classes without constructors, though. If you only included
a snippet, disregard. If not, you can unify the class and function name
above and omit the last line in the timeline. Or, even throw in a generic
constructor for clarity/possible info.

Rich Shupe


___
Flashcoders@chattyfig.figleaf.com
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