views:

314

answers:

0

Hello everyone. i am trying to load a swf coded in as2 into an fla that is in as2. When i import the code, certain components are missing.

The first set of code is for the video player. The second block of code is the code i am using to embed it (unsuccessfully)

----Code Used To Create Video----

import cn.com.webstudio.util.*;
Stage.scaleMode = "noscale";
Stage.align = "TL";
//Stage.showMenu = false;
stop();
/**********---------- Variable Part ----------**********/
var dataArr:Array = [];
var curItem:Number = 0;
//sound volume setting
var volume:Number = 50;
//buffer time setting
var bufferTime:Number = 10;
var locked:Boolean = false;
//please set these fellowing value from external xml file.
var autoPlayFirst:Boolean = false;
var autoPlayAll:Boolean = false;
var autoNext:Boolean = false;
var mainStyleColor:Number = 0x090909;
// 
var titleItem, videoItem, thumbList, controlItem, scrollItem;
/**********---------- Function Part ----------**********/
// Load the xml file.
function loadXML(url:String, callback:Function) {
var myxml:XML = new XML();
myxml.ignoreWhite = true;
myxml.onLoad = function(success) {
if (success) {
 if (callback != null) {
 callback(this);
}
}
};
myxml.load(url);
}
loadXML("config.xml", parseXML);
// parse xml data
function parseXML(xml:XML) {
 curItem = -1;
 dataArr = [];
 var i, j, temp1, temp2, temp3;
 temp1 = xml.firstChild.firstChild.childNodes;

 // config part
 autoPlayFirst = temp1[0].firstChild.nodeValue=="true";
 autoPlayAll = temp1[1].firstChild.nodeValue=="true";
 autoNext = temp1[2].firstChild.nodeValue=="true";
 mainStyleColor = int(temp1[3].firstChild.nodeValue);

 // item data
 temp2 = xml.firstChild.childNodes[1].childNodes;
 for (i in temp2) {
  dataArr[i] = {};
  temp3 = temp2[i].childNodes;
  for (j in temp3) {
   dataArr[i][temp3[j].nodeName] = temp3[j].firstChild.nodeValue;
  }
 }
 init();
    }
    function init() {
 // title item
 titleItem = this.attachMovie("titleItem", "titleItem", 1);
 titleItem._x = 3;
 titleItem._y = 3;
 // video list
 videoItem = this.attachMovie("videoItem", "videoItem", 2);
 videoItem._x = 160;
 videoItem._y = 35;
 videoItem.posX = videoItem._x;
 videoItem.posY = videoItem._y;
 videoItem.posW = videoItem._width;
 videoItem.posH = videoItem._height;
 // thumb list
 thumbList = this.attachMovie("thumbList", "thumbList", 3);
 thumbList._x = 646;
 thumbList._y = 35;
 // control item
 controlItem = this.attachMovie("controlItem", "controlItem", 4);
 controlItem._x = videoItem._x-1;
 controlItem._y = videoItem._y+videoItem._height+12;
 controlItem.posX = controlItem._x;
 controlItem.posY = controlItem._y;
 // scroll item
 scrollItem = this.attachMovie("scrollItem", "scrollItem", 5);
 scrollItem._x = thumbList._x+thumbList._width-scrollItem._width+3;
 scrollItem._y = thumbList._y+thumbList.mask._y;

}
    function setStyle() {
 wEffect.setRGB(thumbList.back, mainStyleColor);
 wEffect.setRGB(controlItem.back, mainStyleColor);
 wEffect.setRGB(titleItem.back, mainStyleColor);
    }

----Code Used To Attempt Import----

import cn.com.webstudio.util.*;
stop();

///this creates an mc to hold my swf

this.createEmptyMovieClip("loady",0);
loady._x = 100;///whatever x coordinate you want
loady._y = 350;///whatever y coordinate you want

//event that calls the load function
loady.onEnterFrame = loadIt;

///function that loads into the mc I created

function loadIt()
{
loady.loadMovie('preview.swf');

}

(This is code for a dynamic video player that is connected to a config.xml file which calls different videos and accompanying titles for each respective video.)

Now I am trying to embed this video player into my flash website using the following code: