Código :
#include "archivo.as";
pero el AS3, no se como hacerlo. Alguna Asesoria?????
el AS que necesito importar es el siguente
Código :
package {
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.ui.*;
import flash.utils.*;
import flash.text.TextField;
import flash.media.Video;
public class UstreamStatus extends MovieClip {
private var myLoader :URLLoader;
private var myURL :URLRequest;
private var myXML :XML;
private var loadComplete :Boolean = false;
private var imgURL :String = "";
private var streamStatus :String;
private var picURL :String;
// FlashVars:
private var apiKey :String; // Ustream API Key
private var channelName :String; // Ustrean Channel Name
private var hostName :String; // Ustream Show Host Name
private var refreshTimer :Number; // Refresh Time
private var homepage :String; // Optional Homepage URL for button instead of Ustream Show Page
public function UstreamStatus() {
var newCM:ContextMenu = new ContextMenu();
newCM.addEventListener(ContextMenuEvent.MENU_SELECT, onContextMenuHandler);
newCM.hideBuiltInItems();
var link1:ContextMenuItem = new ContextMenuItem("nlm.net" );
link1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, grabLink1);
newCM.customItems.push(link1);
var link2:ContextMenuItem = new ContextMenuItem("Ustream.tv");
link2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, grabLink2);
newCM.customItems.push(link2);
this.contextMenu = newCM;
function onContextMenuHandler(event:ContextMenuEvent):void {
event.target.customItems[0].enabled = true;
event.target.customItems[1].enabled = true;
}
// contextMenu link1
function grabLink1(event:ContextMenuEvent) {
var myRequest:URLRequest = new URLRequest("http://www.nlm.net");
navigateToURL(myRequest);
}
// contextMenu link2
function grabLink2(event:ContextMenuEvent) {
var myRequest:URLRequest = new URLRequest("http://www.ustream.tv");
navigateToURL(myRequest);
}
// Stage
//stage.showDefaultContextMenu = false;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var keyStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (keyStr in paramObj) {
if (keyStr == "channelName") { channelName = String(paramObj[keyStr]); }
if (keyStr == "apiKey") { apiKey = String(paramObj[keyStr]); }
if (keyStr == "homepage") { homepage = String(paramObj[keyStr]); }
}
if (channelName == null)
channelName = "chirrines";
if(!refreshTimer)
refreshTimer=50;
if(apiKey == null)
apiKey="yourDevKey";
var r1A:Tween = new Tween(show_name, "alpha", Regular.easeOut, 0, 1.0, 0.25, true);
var r2A:Tween = new Tween(show_status, "alpha", Regular.easeOut, 0, 1.0, 0.25, true);
// if Ustream has not responded in 3 seconds, bail
var bailTimer:Timer = new Timer(10000, 3); // 1 = run once
bailTimer.addEventListener(TimerEvent.TIMER, killStatusUpdate);
bailTimer.start();
function killStatusUpdate(event:TimerEvent):void {
if (!loadComplete) {
trace("XML has not loaded... stop everything");
myLoader.close();
//show_status.text = myXML.result;
show_status.text = "Ustream is not responding. Try again later!";
}
}
myLoader = new URLLoader();
myURL = new URLRequest("http://api.ustream.tv/ust_api.xml/channel/"+channelName+"/getInfo/?key="+apiKey);
myLoader.addEventListener(Event.COMPLETE, onDataLoad);
// pause for 2 seconds, then load the XML request
var preTimer:Timer = new Timer(2000, 1); // 1 = run once
preTimer.addEventListener(TimerEvent.TIMER, loadXML);
preTimer.start();
function loadXML():void {
bailTimer.start();
myLoader.load(myURL);
}
};
private function loadStatus(event:Event):void{
myLoader.load(myURL);
}
private function onDataLoad(event:Event):void {
loadComplete = true;
myXML = new XML(myLoader.data);
if(myXML.result.status=="LIVE")
{
streamStatus="Status: ON AIR";
show_name.text=myXML.result.title;
picURL=myXML.result.pictureUrl;
}
else if(myXML.result.status=="OFFLINE")
{
streamStatus="Status: OFF AIR";
show_name.text=myXML.result.title;
picURL=myXML.result.pictureUrl;
}
else
{
streamStatus="Status: ERROR";
}
show_status.text = streamStatus;
if (imgURL == "") { imgURL = "http://static.ustream.tv/images/schannel_picture/th/smalls2_120_"+picURL; }
if(picURL!="")
{
var imgRequest:URLRequest = new URLRequest(imgURL);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, revealImg);
loader.load(imgRequest);
loadMe.addChild(loader);
}
// activate the button
//view_button.buttonMode = true;
loadMe.addEventListener(MouseEvent.CLICK, grabShowURL);
view_button.addEventListener(MouseEvent.CLICK, grabShowURL);
profile_button.addEventListener(MouseEvent.CLICK, grabShowURL);
var myTimer:Timer = new Timer(refreshTimer*1000, 0);
myTimer.addEventListener(TimerEvent.TIMER, loadStatus);
myTimer.start();
};
private function revealImg(event:Event):void {
var loadImgA:Tween = new Tween(loadMe, "alpha", Regular.easeOut, 0, 1.0, 0.5, true);
};
private function grabShowURL(event:MouseEvent):void {
if(homepage==null)
var myRequest:URLRequest = new URLRequest("http://ustream.tv/channel/"+channelName);
else
var myRequest:URLRequest = new URLRequest("http://"+homepage);
navigateToURL(myRequest);
};
};
};
