[Flashcoders] Re: difference between coding in classes and in root directly

2007-08-23 Thread Tom Huynen
 Apologies, underneath the exact code I'm using.

class Test
{
static var root_p:MovieClip = _root;


function Test()
{
display();
setInterMezzo()
}

function display()
{
var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
videoHolder_mc, 0);

//setup netstream
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);


//movies
var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
videoHolder_mc, 0);
videoHolder_p.video.attachVideo(stream_ns);
   stream_ns.play(bokk1.flv);

}

function setInterMezzo()
{
setInterval(this, checkOnMove, 2000);
}

function checkOnMove()
{
trace(ok)

}
}


On 8/23/07, Tom Huynen [EMAIL PROTECTED] wrote:

 Hi,

 My goal is to play an FLV and use the setInterval method without problems
 at the same time.
 This works fine when my code is placed on the timeline.

 When the EXACT same code is placed in an external class however the FLV
 gets interrupped soon as the setInterval is invoked.

 Also an onEnterFrame interferes with the flv when using an external class.

 How is this possible?

 Kind regards,

 Tom


 class Test
 {
 static var root_p:MovieClip = _root;


 function Test()
 {
 display();
 setInterMezzo()
 }

 function display()
 {
 var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
 videoHolder_mc, 0);

 //setup netstream
 var connection_nc:NetConnection = new NetConnection();
 connection_nc.connect(null);
 var stream_ns:NetStream = new NetStream(connection_nc);


 //movies
 var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
 videoHolder_mc, 0);
 videoHolder_p.video.attachVideo(stream_ns);
 root_p.stream_ns.play(bokk1.flv);

 }

 function setInterMezzo()
 {
 setInterval(this, checkOnMove, 2000);
 }

 function checkOnMove()
 {
 trace(ok)

 }
 }

___
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] Re: difference between coding in classes and in root directly

2007-08-23 Thread Marcelo de Moraes Serpa
This is the same code you sent in your first message. You can't have a class
in a keyframe's code if you're using AS2, so, what I would like to know is
where in your FLA you are creating this class' instance.

You might be creating it in the first keyframe, like this:

Keyframe1:

var teste = new Test();

So, how are you doing it ?

On 8/23/07, Tom Huynen [EMAIL PROTECTED] wrote:

 Apologies, underneath the exact code I'm using.

 class Test
 {
 static var root_p:MovieClip = _root;


 function Test()
 {
 display();
 setInterMezzo()
 }

 function display()
 {
 var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
 videoHolder_mc, 0);

 //setup netstream
 var connection_nc:NetConnection = new NetConnection();
 connection_nc.connect(null);
 var stream_ns:NetStream = new NetStream(connection_nc);


 //movies
 var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
 videoHolder_mc, 0);
 videoHolder_p.video.attachVideo(stream_ns);
stream_ns.play(bokk1.flv);

 }

 function setInterMezzo()
 {
 setInterval(this, checkOnMove, 2000);
 }

 function checkOnMove()
 {
 trace(ok)

 }
 }


 On 8/23/07, Tom Huynen [EMAIL PROTECTED] wrote:
 
  Hi,
 
  My goal is to play an FLV and use the setInterval method without
 problems
  at the same time.
  This works fine when my code is placed on the timeline.
 
  When the EXACT same code is placed in an external class however the FLV
  gets interrupped soon as the setInterval is invoked.
 
  Also an onEnterFrame interferes with the flv when using an external
 class.
 
  How is this possible?
 
  Kind regards,
 
  Tom
 
 
  class Test
  {
  static var root_p:MovieClip = _root;
 
 
  function Test()
  {
  display();
  setInterMezzo()
  }
 
  function display()
  {
  var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
  videoHolder_mc, 0);
 
  //setup netstream
  var connection_nc:NetConnection = new NetConnection();
  connection_nc.connect(null);
  var stream_ns:NetStream = new NetStream(connection_nc);
 
 
  //movies
  var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
  videoHolder_mc, 0);
  videoHolder_p.video.attachVideo(stream_ns);
  root_p.stream_ns.play(bokk1.flv);
 
  }
 
  function setInterMezzo()
  {
  setInterval(this, checkOnMove, 2000);
  }
 
  function checkOnMove()
  {
  trace(ok)
 
  }
  }
 
 ___
 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] Re: difference between coding in classes and in root directly

2007-08-23 Thread Tom Huynen
Hi Marcelo,

var test:Test = new Test(); on the first keyframe indeed.
When I'm executing the code from the timeline I leave out the class
definition and so.

the make things a bit more clear:

--- situation one (first keyframe):

 //setup netstream

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);

//movies
var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
videoHolder_mc, 0);
videoHolder_p.video.attachVideo(stream_ns);
stream_ns.play(bokk1.flv);

--- situation two (first keyframe):

var test:Test = new Test();
 in combination with an externat class Test:

class Test
{

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);

//movies
var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
videoHolder_mc, 0);
videoHolder_p.video.attachVideo(stream_ns);
stream_ns.play(bokk1.flv);

}


The second gives problems when using an onEnterFrame of setInterval
function.
I discovered a work around when using an external class by doing the
following

class Test
{

var connection_nc:NetConnection = new NetConnection();
_root.connection_nc = connection_nc
_root.connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(_root.connection_nc);
_root.stream_ns = stream_ns

//movies
var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
videoHolder_mc, 0);
videoHolder_p.video.attachVideo(_root.stream_ns);
_root.stream_ns.play(bokk1.flv);

}

Now it works. So by defining everything in the root no problems arise.

The weird thing is that when not defining everything in the root works as
well but soon as an onEnterFrame or seInterval is invoked the FLV stops
playing.

Any idea why this happens?

Tom












On 8/23/07, Marcelo de Moraes Serpa [EMAIL PROTECTED] wrote:

 This is the same code you sent in your first message. You can't have a
 class
 in a keyframe's code if you're using AS2, so, what I would like to know is
 where in your FLA you are creating this class' instance.

 You might be creating it in the first keyframe, like this:

 Keyframe1:

 var teste = new Test();

 So, how are you doing it ?

 On 8/23/07, Tom Huynen [EMAIL PROTECTED] wrote:
 
  Apologies, underneath the exact code I'm using.
 
  class Test
  {
  static var root_p:MovieClip = _root;
 
 
  function Test()
  {
  display();
  setInterMezzo()
  }
 
  function display()
  {
  var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
  videoHolder_mc, 0);
 
  //setup netstream
  var connection_nc:NetConnection = new NetConnection();
  connection_nc.connect(null);
  var stream_ns:NetStream = new NetStream(connection_nc);
 
 
  //movies
  var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
  videoHolder_mc, 0);
  videoHolder_p.video.attachVideo(stream_ns);
 stream_ns.play(bokk1.flv);
 
  }
 
  function setInterMezzo()
  {
  setInterval(this, checkOnMove, 2000);
  }
 
  function checkOnMove()
  {
  trace(ok)
 
  }
  }
 
 
  On 8/23/07, Tom Huynen [EMAIL PROTECTED] wrote:
  
   Hi,
  
   My goal is to play an FLV and use the setInterval method without
  problems
   at the same time.
   This works fine when my code is placed on the timeline.
  
   When the EXACT same code is placed in an external class however the
 FLV
   gets interrupped soon as the setInterval is invoked.
  
   Also an onEnterFrame interferes with the flv when using an external
  class.
  
   How is this possible?
  
   Kind regards,
  
   Tom
  
  
   class Test
   {
   static var root_p:MovieClip = _root;
  
  
   function Test()
   {
   display();
   setInterMezzo()
   }
  
   function display()
   {
   var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
   videoHolder_mc, 0);
  
   //setup netstream
   var connection_nc:NetConnection = new NetConnection();
   connection_nc.connect(null);
   var stream_ns:NetStream = new NetStream(connection_nc);
  
  
   //movies
   var videoHolder_p:MovieClip = _root.attachMovie(videoHolder,
   videoHolder_mc, 0);
   videoHolder_p.video.attachVideo(stream_ns);
   root_p.stream_ns.play(bokk1.flv);
  
   }
  
   function setInterMezzo()
   {
   setInterval(this, checkOnMove, 2000);
   }
  
   function checkOnMove()
   {
   trace(ok)
  
   }
   }
  
  ___
  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