PDA

View Full Version : FLV stops on rollover


kleezy
04-12-2008, 12:20 AM
Hi All,

I have a AS3 program that among other things, loads a video based on a path passed in through XML. The video (a child of a class inheriting from Sprite) runs fine, until I do something totally unrelated (add objects to an array in a Sprite object that is a display ancestor to the video Sprite). These objects aren't even display objects of any sort, just data objects. Once I create these objects, the Video plays fine until I roll over it -- then it stops in its tracks. It's a very bizarre behavior, and I've racked my brain trying to figure out why its happening. I haven't wired up any mouse over events that might be causing this behavior. I'm thinking maybe it has to do with Memory issues?

Anyway, here's the class that creates the video in question. Again, this code works fine until I add the objects to this class' display anscestor. I hope this isn't too confusing. It's a small segment of an otherwise large program, so I'm trying to explain a complex issue in just a short space :) Thanks in advance!

package display.components {
public class Video extends Component {

import flash.net.*;
import flash.media.Video;
import flash.events.*;

private var path:String;


public function Video(path:String) {
this.path = path;
}

public override function draw() {

var customClient:Object = new Object();
customClient.onCuePoint = cuePointHandler;
customClient.onMetaData = metaDataHandler;
\
var myVideo:flash.media.Video = new flash.media.Video();

addChild(myVideo);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.client = customClient;

myVideo.attachNetStream(ns);

ns.play(path);
}

function cuePointHandler(infoObject:Object):void {
trace("cuePoint");
}

function metaDataHandler(infoObject:Object):void {
trace("metaData");
}

}
}

kleezy
04-12-2008, 01:30 AM
I found out that the problem is actually caused by adding objects elsewhere that are subclasses of the same class that the Video class inherits from. Specifically, the problem occurs once I call "super()" in the constructor of a sister class of video. If I temporarily remove the inheritance from the other class, the Video class then functions properly. Very strange.