>From: Sarah Allen
>Subject: [Laszlo-dev] getting at the moveClip of a view
>
>So, I wanted to get at the movieClip of a view (prototyping something 
>before actually diving into the LFC), and I couldn't figure it out.  I 
>swear I've done this before. [...]

Are you trying to do the same thing I want to do? I've been noodling around
with trying to get Laszlo to play streaming flv files, but so far have only
been able to get their audio streams to play, without any video displayed.

I think the reason you're not finding an __LZmovieClipRef is that they're
only created under certain circumstances, like the view having a resource or
background color, or containing other views. There's a method called
makeContainerResource that seems to make a __LZmovieClipRef, which I think
gets called when you dynamically set the resource or add sub-views. Setting
the background color of a view also creates its __LZmovieClipRef. 

Here's a snippet from my latest attempt, for a top secret "SimCheney"
project I'm working on, big time. Don't leak the source or I'll blast you in
the face with a shotgun! (No actually, feel free to leak the source! Just
please let me know if you get it to work!) 

It just plays the audio from the flv, but doesn't show the video. The
resource="gofuckyourself_res" causes the __LZmovieClipRef to be defined,
otherwise it's undefined, which causes warnings, but the audio plays anyway
for some reason. 

        -Don


    <view name="movieplayer" id="gMP"
      x="${canvas.leftEdge}"
      y="${canvas.topEdge}"
      width="${parent.width - (canvas.leftEdge + canvas.rightEdge)}"
      height="${parent.height - (canvas.topEdge + canvas.bottomEdge)}"
      stretches="both"
      resource="gofuckyourself_res"
    >

      <attribute name="connection" value="null"/>
      <attribute name="stream" value="null"/>

      <method event="oninit"><![CDATA[
          var ref = this.__LZmovieClipRef;
          Debug.write("oninit", this, this.__LZmovieClipRef);
          this.connection = new NetConnection();
          Debug.write("connection", connection);
          this.connection.connect(null);
          this.stream = new NetStream(this.connection);
          Debug.write("stream", stream);
          this.stream.onStatus = function(info) {
            Debug.write("status", this, info, info.level, info.code);
          }
          ref.attachVideo(this.stream);
          this.stream.setBufferTime(5);
          this.stream.play("MaherCheney.flv");          
        ]]>
      </method>

    </view>

Here's the debugger output (I also clicked on the interesting objects to
show them, with "Debug.showInternalProperties = true" of course):

oninit #gMP<MovieClip#1| _level0.$m0.$m0.$m0> 
connection <object#2| {contentType: application/x-fcs}> 
stream <object#3| {}> 
status <object#3| {}>{level: status, code: NetStream.Play.Start} status
NetStream.Play.Start 
status <object#3| {}>{level: status, code: NetStream.Buffer.Full} status
NetStream.Buffer.Full 
status <object#3| {}>{level: status, code: NetStream.Buffer.Flush} status
NetStream.Buffer.Flush 
status <object#3| {}>{level: status, code: NetStream.Buffer.Flush} status
NetStream.Buffer.Flush 
status <object#3| {}>{level: status, code: NetStream.Play.Stop} status
NetStream.Play.Stop 
status <object#3| {}>{level: status, code: NetStream.Buffer.Empty} status
NetStream.Buffer.Empty 
<MovieClip#1| _level0.$m0.$m0.$m0> { 
  __proto__: <Object#10| MovieClip.prototype> 
  _currentframe: 1 
  _opacity: <undefined> 
  _rotation: 0 
  _visible: true 
  _x: 40 
  _xscale: 1102 
  _y: 40 
  _yscale: 874 
  constructor: MovieClip 
} 
<MovieClip#1| _level0.$m0.$m0.$m0> 
<object#2| {contentType: application/x-fcs}> { 
  __constructor__: <Function#12> 
  __proto__: <Object#13| undefined#12.prototype> 
  contentType: application/x-fcs 
  isConnected: true 
  uri: null 
} 
<undefined#12#12#2| {contentType: application/x-fcs}> 
<object#3| {}> { 
  __constructor__: <Function#14> 
  __proto__: <Object#15| undefined#14.prototype> 
  _bytesTotal: 2949922 
  audiocodec: 2 
  bufferLength: 0 
  bufferTime: 5 
  bytesLoaded: 2949922 
  bytesTotal: 2949922 
  currentFps: 0 
  decodedFrames: 0 
  liveDelay: 0 
  onStatus: <Function#16| this.stream.onStatus> 
  time: 49.52 
  videocodec: 0 
} 
<undefined#14#14#3| {}>


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sarah Allen
Sent: Monday, February 27, 2006 12:46 PM
To: OpenLaszlo development development
Subject: [Laszlo-dev] getting at the moveClip of a view


So, I wanted to get at the movieClip of a view (prototyping something 
before actually diving into the LFC), and I couldn't figure it out.  I 
swear I've done this before.

Simple test case:
<canvas>
   <view id="v" oninit="Debug.write(this.__LZmovieClipRef)"/>
</canvas>

shows in the debugger:
WARNING: test.lzx:2: reference to undefined property '__LZmovieClipRef'
<undefined>

Adding width, height and bgcolor to the view didn't help.  If I set 
Debug.showInternalProperties = true, I see __LZbgRef:, but no 
__LZmovieClipRef

What's up?

Thanks,
Sarah



_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to