Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Pass URL String From External File To AS Variable (dynamic File Names)



I have a movie player that works fine when i hard-code the url value in the video function, but when i try to pass that url/file path from an external file, the video doesn't load. I suspect that there is something i'm doing wrong with the quotes. What am i doing wrong?


Code:
var vfile:String = string("path");

supervideo = function () {
var netConn:NetConnection = new NetConnection();
netConn.connect(null);
var netStream:NetStream = new NetStream (netConn);
video.attachVideo(netStream);
netStream.setBufferTime(10);
netStream.play(vfile);

};

loadText.load(_global.text_url1);
loadText.onLoad = function(success) {
if(success){
showtitle.text = this.title1;
vfile = this.flv_name;
supervideo();
}
}
The value in the php file looks like this:

PHP Code:


&flv_name="elements/flv/superape.flv"& 



So ultimately i want to end up with netStream.play("elements/flv/superape.flv");. I know the value of vfile is being passed from the php file and getting into the supervideo(); function because i have a textbox echoing vfile. I have tried defining the variable with and without the ":String". Please let me know if you can see any errors. Thanks!



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 11-17-2004, 03:24 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Dynamic Video File Name (pass URL From External File To Variable)
I have a movie player that works fine when i hard-code the url value in the video function, but when i try to pass that url/file path from an external file, the video doesn't load. I suspect that there is something i'm doing wrong with the quotes or maybe i just don't get how to pass a variable to a function.


ActionScript Code:
var vfile = "path";supervideo = function () {    var netConn:NetConnection = new NetConnection();    netConn.connect(null);    var netStream:NetStream = new NetStream (netConn);    video.attachVideo(netStream);    netStream.setBufferTime(10);    netStream.play(vfile);    };loadText.load(_global.text_url1);loadText.onLoad = function(success) {    if(success){            showtitle.text = this.title1;        vfile = this.flv_name;        supervideo();        }    }


The value in the php file looks like this:

PHP Code:



&flv_name="elements/flv/superape.flv"& 




So ultimately i want to end up with netStream.play("elements/flv/superape.flv");. I have tried defining the variable w/ and w/out the ":String". The video portion of the code seems to not use the variable correctly when it is in a function. If you have suggestions or see any errors please let me know. Thanks!

File is here (in MX format, though i am using MX2004) if you have time to take a look.

Dynamic Video File Name (pass URL From External File To Variable)
I have a movie player that works fine when i hard-code the url value in the video function, but when i try to pass that url/file path from an external file, the video doesn't load. I suspect that there is something i'm doing wrong with the quotes or maybe i just don't get how to pass a variable to a function.


ActionScript Code:
var vfile = "path";supervideo = function () {    var netConn:NetConnection = new NetConnection();    netConn.connect(null);    var netStream:NetStream = new NetStream (netConn);    video.attachVideo(netStream);    netStream.setBufferTime(10);    netStream.play(vfile);    };loadText.load(_global.text_url1);loadText.onLoad = function(success) {    if(success){            showtitle.text = this.title1;        vfile = this.flv_name;        supervideo();        }    }


The value in the php file looks like this:

PHP Code:



&flv_name="elements/flv/superape.flv"& 




So ultimately i want to end up with netStream.play("elements/flv/superape.flv");. I have tried defining the variable w/ and w/out the ":String". The video portion of the code seems to not use the variable correctly when it is in a function. If you have suggestions or see any errors please let me know. Thanks!

File is here (in MX format, though i am using MX2004) if you have time to take a look.

Names From Extenal XML File To String Variable
I'm new to AS 3 and I have this problem:
I want to make a dynamic menu with some buttons. Names(labels) of these buttons are in external XML file. Parameters of buttons are specified in main file .fla. I have also actionscript file .as (it works without errors), which makes these buttons with parameters specified in main file .fla .And I want to GET NAMES OF BUTTONS FROM EXTERNAL XML FILE TO STRING VARIABLE, but here is the problem. How could I do that? Please help.

Here are my scripts:
------------------------------
this is in main file .fla:

import flash.events.*;
import flash.net.*;
import flash.text.*;

//declarations
var NumberofButtons:Number = 3;
var xposition:Number=25;
var textBut:String=new String;

//load XML file names.xml
var navData:XML;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
loader.load(new URLRequest("names.xml"));

function onComplete(evt:Event):void {
try {
navData = new XML(evt.target.data);
trace(navData);
loader.removeEventListener(Event.COMPLETE, onComplete);
loader.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
} catch (err:Error) {
trace("Could not parse loaded content as XML:
" + err.message);
}
}
function onIOError(evt:IOErrorEvent):void {
trace ("An error occured when attempting to load the XML " + err.message);
}

//parameters of buttons
for (var i:Number=0; i<NumberofButtons; i++) {
//text of button label - HERE IS PROBLEM MAYBE
textBut= navData.buttons.button[i].text();
function positions():Number {
xposition=xposition+75;
return xposition;
}
// CreationBtn(hightofButton, widthofButton, colorofButton, colorofTextLabel,
// textLabelofButton, xpositionofButton)
var btn:Sprite = new CreationBtn(25,50,0xFFFF00,0x000000,textBut,positi ons());
addChild(btn);
}
----------------------
here is XML file - names.xml
<buttons>
<button>Animations</button>
<button>Photo</button>
<button>Books</button>
</buttons>
----------------------
actionscript file is CreationBtn.as and has no errors
----------------------

Names From Extenal XML File To String Variable
I'm new to AS 3 and I have this problem:
I want to make a dynamic menu with some buttons. Names(labels) of these buttons are in external XML file. Parameters of buttons are specified in main file .fla. I have also actionscript file .as (it works without errors), which makes these buttons with parameters specified in main file .fla .And I want to GET NAMES OF BUTTONS FROM EXTERNAL XML FILE TO STRING VARIABLE, but here is the problem. How could I do that? Please help.

Here are my scripts:
------------------------------
this is in main file .fla:

import flash.events.*;
import flash.net.*;
import flash.text.*;

//declarations
var NumberofButtons:Number = 3;
var xposition:Number=25;
var textBut:String=new String;

//load XML file names.xml
var navData:XML;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
loader.load(new URLRequest("names.xml"));

function onComplete(evt:Event):void {
try {
navData = new XML(evt.target.data);
trace(navData);
loader.removeEventListener(Event.COMPLETE, onComplete);
loader.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
} catch (err:Error) {
trace("Could not parse loaded content as XML:
" + err.message);
}
}
function onIOError(evt:IOErrorEvent):void {
trace ("An error occured when attempting to load the XML " + err.message);
}

//parameters of buttons
for (var i:Number=0; i<NumberofButtons; i++) {
//text of button label - HERE IS PROBLEM MAYBE
textBut= navData.buttons.button[i].text();
function positions():Number {
xposition=xposition+75;
return xposition;
}
// CreationBtn(hightofButton, widthofButton, colorofButton, colorofTextLabel,
// textLabelofButton, xpositionofButton)
var btn:Sprite = new CreationBtn(25,50,0xFFFF00,0x000000,textBut,positi ons());
addChild(btn);
}
----------------------
here is XML file - names.xml
<buttons>
<button>Animations</button>
<button>Photo</button>
<button>Books</button>
</buttons>
----------------------
actionscript file is CreationBtn.as and has no errors
----------------------

Pass URL From External File To AS Variable (dyn. File Name)
I have a movie player that works fine when i hard-code the url value in the video code, but when i try to pass that url/file path from an external file to the video code in a function, the video doesn't load. I suspect that there is something i'm doing wrong with the quotes. What am i doing wrong?code: var vfile = "path";

supervideo = function () {
var netConn:NetConnection = new NetConnection();
netConn.connect(null);
var netStream:NetStream = new NetStream (netConn);
video.attachVideo(netStream);
netStream.setBufferTime(10);
netStream.play(vfile);

};

loadText.load(_global.text_url1);
loadText.onLoad = function(success) {
if(success){
showtitle.text = this.title1;
vfile = this.flv_name;
supervideo();
}
}
php value:
PHP Code:



&flv_name="elements/flv/superape.flv"&




So ultimately i want to end up with netStream.play("elements/flv/superape.flv");. I know the value of vfile is being passed from the php file and getting into the supervideo(); function because i have a textbox echoing vfile, but it doesn't load when called from a fuction. I have tried defining the variable with and without the ":String". When i run the function on its own, it doesn't load the video, but if i take that code out of the function it runs fine. Please let me know if you can see any errors or have better suggestions. Thanks in advance!

I've posted a zip below of the file if anyone can take a look.
Quote:




http://www.polishoperative.com/flv/videoissue.zip

Pass Variable With String From One Flash File To Another Flash File
There are two flash files which are developed in Flash MX 2004 Professional and its names are Main.fla&Child.fla.
I have created a Input text box in Main.fla and enter text during runtime. When I click a button in the same Main.fla file, the text entered should display in the dynamic text box which is created in Child.fla. But, I am not getting appropriate logic to achieve this task.
Request you to kindly send appropriate logic. It is urgent.

Can't Load External Xml File String Into Dynamic Textbox
Why won't this work?

I have a movie with a single frame. There is a dynamic textbox named "xmlDisplay". Set to multiline.

There is also a button with these actions:

on (release) {
function myOnload () {
xmlDisplay = myXML.toString();
}
myXML = new XML;
myXML.onload = myOnload;
myXML.load("xmlIntoFlashText.xml");
}
When the button is pushed, nothing is displayed in the textbox. Checked the spelling of external filename. Tested locally through Flash as well as from server, results in the same behavior.

Any ideas?

Thank you very much!!

Dynamic External File Variable Help
Hi.
I'm working on a dynamic menu interface. It works, but I need help on how to read external files from various locations. Let me explain what I got working:
I created a "menu.swf" file. In it, there's a movie clip symbol (named "scroller") with a dynamic input with the variable name "CurrentLocation". I created an external text file, "Current.txt" and in it I typed:
CurrentLocation=SectionA
In the "scroller" symbol, I put the following code (please excute me if I'm using the wrong syntax, but I'm giving you the general idea):
loadVariable ("Current.txt")
if (CurrentLocation=SectionA)
gotoAndstop (2)
if (CurrentLocation=SectionB)
gotoAndstop (3)
else
gotoAndstop (4)
The "menu.swf" file is located at "www.mysite.com/SectionA", and the "Current.txt" file is also located there. When the "scroller" symbol reads the text file, it will read that it's at "SectionA" and jump to frame 2. My section experiment is when I copy my "menu.swf" file at location "www.mysite.com/SectionB", and place the "Current.txt" file in there. However, in the text file, I changed it from "CurrentLocation=SectionA" into "CurrentLocation=SectionA". When the "menu.swf" file reads the text file, it will jump to frame 3. All of the above works perfectly. Now to get into the problem I have (and hopefully someone got a solution):
The text file will be copied to the directories I want (in this example, SectionA and SectionB). Instead of copying
the "menu.swf" file into different directories, I want to place it in "www.mysite.com/flashfiles". In SectionA
directory, I'll have an html file name "SectionAindex.html", and I'll have an html file name "SectionBindex.html" in the SectionB directory. Both html files will link to "www.mysite.com/flashfiles/menu.swf". I would like to know how can I have the "scroller" symbol link to the "current" external text files. IE: In "SectionBindex.html", it will call for the "menu.swf", and it will load the "Current.txt" file and read the variable. Then it would perform the action I want, which would be gotoAndStop (3). I'm open to any suggestions/solutions. My server supports CGI, PHP, Perl, and SSI (I think I can support MySQL, but I'm shaky on that). I would go to Javascript as the last resort, though (since Javascript can be disabled at web browsers, and that would kill the effect). If anyone have a better line of code I should use as a replacement, please let me know. If you want the source file, I'll send you a copy. Thanks.

-Dr. Neko

"We may be pirates, but we're not barbarians. We'll let them keep the toilet paper." -Teisel (Mega Man Legends 2)

Mulitiple File Names As A String In One XML Attribute, Then Spliting Into An Array
I am attempting to take an already opperational xml video player with a playlist and add the ability to assign mulitple filenames to a single description in the playlist. I want the video player to play through 6 video clips sequentially and then move on to the next title in the playlist which will also have another 6, etc.

I tried to create a String and then split that string into an Array. But I am uncertain how to tell the video object to play through each video.

PLEASE HELP!!!

Here is what I have so far... the string and array variables are not working properly.

Code:
xml.onLoad = function() {
var nodes = this.firstChild.childNodes;
for (i=0; i<nodes.length; i++) {
var myFlv:String = nodes[i].attributes.flv + "1_" +i+ ".flv";
var splitAr:Array = myFlv.split(",");
list.addItem(nodes[i].attributes.desc,myFlv[i].attributes.flv);
}
vid.play(list.getItemAt(0).data);
list.selectedIndex = 0;
};

Mulitiple File Names As A String In One XML Attribute, Then Spliting Into An Array
I am attempting to take an already opperational xml video player with a playlist and add the ability to assign mulitple filenames to a single description in the playlist. I want the video player to play through 6 video clips sequentially and then move on to the next title in the playlist which will also have another 6, etc.

I tried to create a String and then split that string into an Array. But I am uncertain how to tell the video object to play through each video.

PLEASE HELP!!!

Here is what I have so far... the string and array variables are not working properly.


Code:
xml.onLoad = function() {
var nodes = this.firstChild.childNodes;
for (i=0; i<nodes.length; i++) {
var myFlv:String = nodes[i].attributes.flv + "1_" +i+ ".flv";
var splitAr:Array = myFlv.split(",");
list.addItem(nodes[i].attributes.desc,myFlv[i].attributes.flv);
}
vid.play(list.getItemAt(0).data);
list.selectedIndex = 0;
};

How To Pass Variable From MC To ASP File?
I have a movie clip having a few buttons inside that Movie clip. User can click on each part and fill a color. I used getRGB() function to extract the filled color value of that button. I have used trace to see what the value is.

Now I want that value to transfer into a database using ASP. Can anybody please tell me, how to do that?

Any help will be appreciated!

AS2 - How To Pass A Variable To My AS Class File?
Last edited by gabrielsj : 2008-12-08 at 09:44.
























Hi there, I'll try to make this easy.

I have a xml gallery on stage wich uses a specific AS file to handle all it's functions.

This AS file starts with a:

class com.kabulinteractive.gallery extends MovieClip {
//path of the xml file
private var xmlFile:String = "gallery.xml";
private var xmlObject:XML;
...

It works fine, but I resolved to put 3 buttons on stage, and when clicked, each of them would switch the xmlFile - gallery2.xml / gallery3.xml -. So I would be using the same container, and with switching the xml.file, it would obviously, load a different content.

So my question is how to send that information, or how to write it in the AS Class that action?

I'm attaching the file.

thanks!

Appending MC Instances And Swf File Names With A Variable
Hi Everyone,

I have been working with Flash for over a year now and I'm finally taking the plunge and building an ActionScript driven Flash site. I am building an online art gallery that will display photos to a user when he or she clicks on the relevant category. ie. Clicking on "Japan" will display a selection of 20 images from Japan. Each of the photos will be stored in it's own separate swf file, so it only needs to be loaded when the user requests it. Each of the swf files is named sequentially: picture1.swf, picture2.swf, picture3.swf etc. In the main movie (main.swf), on the root timeline, I have a single movieclip instance on the stage called "container" (no quotes) which is an empty movieclip. In frame 1, a duplicateMovieClip script in the actions layer makes 20 copies of the empty "container" movieclip. On the stage, there is also a button in frame 1 to represent the gallery category: eg. Japan. When the user clicks on the button, the "on release" script starts a for loop which instructs Flash to fill each of the empty "container" movieclip instances, first with nothing (loadMovie(""); to clear them, and then with the corresponding picture1.swf, picture2.swf, picture3.swf, etc. Where I am running into problems is that I don't know the syntax for appending the "container" movieclip instance and the "picture.swf" with a variable. Here I have faked it as container(j).loadMovie("picture(j).swf"); to illustrate what I'm after. This is crucial so that Flash can increment the instance and swf file names each time the loop runs. Please advise me on the syntax that I should be using to do this.

Also, a related question here: When using the loadMovie(); script, is it possible to use a path to load a swf that is in a different directory than your main movie? Eg.: Directory structure going down the tree: container(j)loadMovie(japan/photos/"picutre(j).swf"); Directory structure going up and down the tree: container(j)loadMovie(../../japan/photos/"picutre(j).swf"); If so, please provide an example for the syntax of this. I have been pouring over all 5 of my FOE Flash books and I just can't figure these things out. Any help would be greatly appreciated.

Here are the scripts:

//main.swf, _root timeline, frame 1: duplicateMovieClip script producing 20 copies of an empty movieclip instance on the _root stage.

for (i=1; i<21; i++){
duplicateMovieClip ("container", "container"+i, i);
}
stop();

//button script, main.swf, _root timeline, frame 1. Loads 20 sequential swf files into each of the duplicated, empty movieclip instances on the _root stage.

on (release) {
for (j=1; j<21; j++){
container(j).loadMovie("");
container(j).loadMovie("picture(j).swf");
}
}

** Please note, this syntax: container(j).loadMovie("picture(j).swf"); does not work. It's just to illustrate what I'm after.

Thanks in advance for any help on this!

Ken

Can I Use File Names From Some Folder To Specisfly A Value Of A Variable
so here is the thing I want to do:
I've got like 3 variables in my swf file which value tells to the code how many picture there are to load.
So I have like
var totalPics:Number = 5
in my folder images I have 5 pics, but I want to put 3 more so I want to make suck code that will check the total files in the folder and return a value of 8 or check the name of the last file found in the foulder like pic8.swf (I've made it into swf to load in a loader) and to take that letter 8 from it as a value to put in the variable totalPics so it is = 8.
Can u tell me is this possible to make in flash.... where I should read helps or guides .. or just give me a simple example please.

Thank u a lot. If u have any more questions, just ask me..

[Flex/FMS] How To Pass Variable To Point To Video File?
Hi,

At this moment we have a FMS server running, fresh install. I've built a simple Flex App that directly communicates with the FMS server with an URL like this: rtmp://server:1935/vod/video.flv. For the test is the hard coded.

This all is working like a charm :) so that is okay.

In the near future hundreds of videos will be offered. What is the best way to set up the communication with the FMS server and request the correct video file?

Just have a variable in javascript passing the filename of the video to stream? Or is this a security leak? If so, what might be the solution for my problem?

I hope someone can help me.

E.!

External Mp3 File Names
i need to make an mp3 player that can read file names and display them as the song's info.. without using php.. is this do able?

Buttons On The Fly With Names In External File
I just started playing more with functions and arrays in Flash 5. I want to make buttons using actionscript and an external text file. I took notes from the Macromedia Flash: Actionscript for Designers seminar in which this was covered, but it's been several weeks so things are a little fuzzy and my notes are a bit messed up.

The button names are in an ascii text file named navigation.txt. I think the text file is supposed to be
&content=nav1,nav2,nav3,nav4,nav5,nav6,nav7,nav8,n av9,nav10&

I made a button with a dynamic text field with a variable name of "buttonText" into a movie clip. It's on the main timeline, and the instance name is "button". It is to be used as a template to duplicateMovieClip.

This next part is where I really need the help. I think the code is supposed to make the original button template disappear, duplicate the button 10 times, and bring in the button labels from the text file.

In frame one on the main timeline is:

button._visible=false;
for (i=0; i<10; i++){
duplicateMovieClip("button", "button" + i, i+1)
with (_root["button" + i]);{
buttonText="myArray"
if (i>0){
_y=_root["button" + i-1]._y+_root["button"+i-1]._height
}
}
}

Or maybe I'm supposed to fit the following in somewhere:

button._visible=false;
loadVariable("navigation.txt", _root);
myArray=navigation.split(",")
myArrayLength=myArray.length;

If someone could help me iron this out, I'd greatly appreciate it.

Thanks

[F8] Loading External File Names
Hi. I've been googling for a tutorial on this, and im not really sure its possible..
But i have a folder with files on my server. And i want to load the NAMES of theese files, not the files themselves. And insert theese names in a textfield in Flash.

Thanks in advance.

Read External File Names
Can actionscripts read external file names & put them in a variable?

grant

Import External File To Then Pass Data?
I want to import a .txt or .xml file (so it's real text) that has a form on it. I also want to style the text on this form (will this real text be affected by the html's css or do I have to state it in flash? I also want to pass that form information to another scene, at which point the user will add their email and name and *then* click "submit".

Any good advice?
I do this all the time outside of flash but this is the first time I've done it in flash.
Any links/tutorials/advice is appreciated!

Load Dynamic Images With Different File Names
I'm working on a project where people can upload their own images that are then inserted into a MC. With Generator it was easy as I just used a {insert jpeg} variable. What is the equivalent in Flash MX?

How To Use A Value Of A String Variable As Linkage Name Of A Sound File
Hi,

I need to use the value of a string variable as a linkage name of the sound imported in the library, I have this code:

var SoundArray:Array=new Array;
SoundArray[0]="S1";
SoundArray[1]="S2";
SoundArray[2]="S3";
var MySound = new SoundArray[0];
B1.addEventListener(MouseEvent.CLICK,PlaySound);
function PlaySound(event:MouseEvent) {
MySound.play(0,0);
}

where S1,S2,S3 is the name of the classes in the linkage name for the 3 sound files in the library.

I get this Error for the highlighted line of code:

TypeError: Error #1007: Instantiation attempted on a non-constructor.
at Untitled_fla::MainTimeline/frame1()

HELP - Using Dynamic Text File And External Image File
Dear friends

I want a help. As we all know can add text to a swf through a txt file without modify swf file with "loadvariablesum" command.

But I want to load external image file through a text by inputing a link to txt file.

please help me

i also attached a sample file

thanks

rakesh raja
dotcommakers

Pass String Variable Into XML ULR
I am trying to pass a variable through "strSource:String" so that i can dynamically tell the player to load different videos depending upon which page it is on.

This works:

Code:
var strSource:String = root.loaderInfo.parameters.playlist == null ? "includes/video1.xml" : root.loaderInfo.parameters.playlist;

function initVideoPlayer():void {

// create a new net connection, add event listener and connect
// to null because we don't have a media server
ncConnection = new NetConnection();
ncConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
ncConnection.connect(null);

// create a new netstream with the net connection, add event
// listener, set client to this for handling meta data and
// set the buffer time to the value from the constant
nsStream = new NetStream(ncConnection);
nsStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nsStream.client = this;
nsStream.bufferTime = BUFFER_TIME;

// attach net stream to video object on the stage
mcVideoControls.vidDisplay.attachNetStream(nsStream);
// set the smoothing value from the constant
mcVideoControls.vidDisplay.smoothing = SMOOTHING;

// create new request for loading the playlist xml, add an event listener
// and load it
urlRequest = new URLRequest(strSource);
urlLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, playlistLoaded);
urlLoader.load(urlRequest);
}
Doesnt work if i try it like this:

Code:
var btnContent1:String = new String("includes/video1.xml");

var strSource:String = root.loaderInfo.parameters.playlist == null ? btnContent1 : root.loaderInfo.parameters.playlist;
Does anyone know why this is?

I can even put the URLRequest in as "includes/" + "video1" + ".xml" and it will work but as soon as i try to trade the "video1" for a string Variable it cannot find it.

My End hope to pass this variable through would be to have it on the HTML page where i could then dictate the exact path for the video XML

Code:
// source variables from HTML/js param
var btnContent1:String = root.loaderInfo.parameters["vOne"];
var btnContent2:String = root.loaderInfo.parameters["vTwo"];
var btnContent3:String = root.loaderInfo.parameters["vThree"];

Thanks for any help

will

Pass String Variable Into XML ULR
I am trying to pass a variable through "strSource:String" so that i can dynamically tell the player to load different videos depending upon which page it is on.

This works:
Code:

var strSource:String = root.loaderInfo.parameters.playlist == null ? "includes/video1.xml" : root.loaderInfo.parameters.playlist;

function initVideoPlayer():void {
   
   // create a new net connection, add event listener and connect
   // to null because we don't have a media server
   ncConnection = new NetConnection();
   ncConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
   ncConnection.connect(null);
   
   // create a new netstream with the net connection, add event
   // listener, set client to this for handling meta data and
   // set the buffer time to the value from the constant
   nsStream = new NetStream(ncConnection);
   nsStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
   nsStream.client = this;
   nsStream.bufferTime = BUFFER_TIME;
   
   // attach net stream to video object on the stage
   mcVideoControls.vidDisplay.attachNetStream(nsStream);
   // set the smoothing value from the constant
   mcVideoControls.vidDisplay.smoothing = SMOOTHING;
   
   // create new request for loading the playlist xml, add an event listener
   // and load it
   urlRequest = new URLRequest(strSource);
   urlLoader = new URLLoader();
   urlLoader.addEventListener(Event.COMPLETE, playlistLoaded);
   urlLoader.load(urlRequest);
}


Doesnt work if i try it like this:
Code:

var btnContent1:String = new String("includes/video1.xml");

var strSource:String = root.loaderInfo.parameters.playlist == null ? btnContent1 : root.loaderInfo.parameters.playlist;


Does anyone know why this is?

I can even put the URLRequest in as "includes/" + "video1" + ".xml" and it will work but as soon as i try to trade the "video1" for a string Variable it cannot find it.

My End hope to pass this variable through would be to have it on the HTML page where i could then dictate the exact path for the video XML
Code:

// source variables from HTML/js param
var btnContent1:String = root.loaderInfo.parameters["vOne"];
var btnContent2:String = root.loaderInfo.parameters["vTwo"];
var btnContent3:String = root.loaderInfo.parameters["vThree"];



Thanks for any help

will

Trouble Loading A Text File When Passing The Variable In The URL String
I am trying to load variables into Flash from a text file. I pass the name of the text file as a variable in the URL string and then use that variable in the loadVariables command to pull in the text file. It works fine locally but is unreliable up on the server.

I seem to have got past this problem by moving the action to frame 2 from frame 1.

Has anyone else experienced problems with this and has found a better resolution?

Using A String To Load An External File...
hey all,

do any of you pro's know if it is possbible to open a string using an external txt file, i have files which have numerical names which need to be opened when movie clips of the same are loaded....

so i thought it'd be easiest for me if i could convert the movieclip names to strings and then use the strings to load the external clips. that way (in my head) i'd just have to write one function and pass different parameters into it.

could some one tell me def yes / no (hopefully yes...)

thank you

sian

How Do I Pass A String Variable To Javascipt?
In my actionscript, I have this variable pic="pic.jpg". I want to use it like this but it doesnt work:

getURL("javascript: OpenWindow(pic, 'newWindow','')");

It says the pic variable is undefined.

This, works:

getURL("javascript: OpenWindow('pic.jpg', 'newWindow','')");

But I do not want to use a literal directly like that.

How can I pass this variable to javascript so that it will recognize it as containing a string?

Simple Variable Pass From URL String
help! i know there is a simple solution to this, but I just can't find an answer anywhere. so i'm posting it here in hopes that some kind soul will pitty me and free me from this frustrating pothole.

What i'm trying to do is pass a variable to a flash file via a URL string... i.e.

http://www.needananswer.com?pothole=12

...and for the flash file to be able to receive and use it.

HOW?

Pass Variable Via Query String
i'll try to explain this the best I can.

I have a flash header that I need included in a shopping cart site that will have nav and the header descriptions for each site page. It has 2 navigations, top and side. Side nav only controls the flash itself to display stuff that won't be in the rest of the site, like an about us section. The top nav controls what page the shopping cart goes to AND the flash header display. For example, when I click on my top nav button 'systems' I need it to go the 'systems page' and change the flash header to display info about the systems. Now when the 'system' button is clicked the page changes to the 'systems' page but since its a header the flash just pops up on the new page reloaded to its original state. So how would I fix this? could flash pass a variable via the query string to determine what frame it should be on when going to a new page?

Loading An Array Of File Names From A Text File.
Basically I want to do the following.

Create an array of

Image[x] = "x.jpg"

from a text file where the images are listed as

x.jpg
y.jpg
z.jpg

I can't figure out how to load these in an array and I haven't been able to produce this from the closest examples I have found.

Any suggestions?

Load External Text File To String
Hello

Is there anyway to add external files to the a string? I have this one:

header_text = "SOME RANDOM TEXT";

and i would like to use an external text file instead of "some random text".

Thanks in advance!

Search And Replace A String Value In External File?
So I've searched around and found a couple of threads that gave me some pointers on how to replace certain values within a variable, but I can't find any help on how to replace a string from an external file.

The reason I'm asking is so I can load external text files created from a blogging platform and if someone should happen to type in a "&" in their entry it won't screw up the entire post.

So I'm wondering if there is a way to do a search and replace for "&" symbols and replace them with the correct "%26" value so they can be used within the text file.

Any ideas?

Loading A String From A Embed Tag Containing No Variable Names
Hi, I'm develloping a little image loading application for a client.
the same swf has to be reused over and over to load the files.
They are passing me the image location in the embed tag but they are not using the usual

flash.swf?path=folderpath&img1=image1.jpg&img2=ima ge2.jpg&img3=image3.jpg

instead they are using this format :

flash.swf?/folderpath/::SPLIT::image1.jpg::SPLIT::image2.jpg::SPLIT::ima ge3.jpg
do you know how I can read those variables into my flash file ?

any help would be greatly appreciated.

Thank you.

Create Marquee Names In Flash But Edit Names In Text File HELP
Hi all im trying something new with a website. I have looked around and havent been able to find a file or help sections on this. Maybe someone can help me on this...

The marquee is going to scroll left to right and repeat over and over. This is going to be in flash. What i need is the names that are going to be in the marquee needs to be in a text file so they can easily be edited by anyone that doesnt have flash knowlege.

Can this be done?

Load Long String Of Variables From External File
I have some variables that I am trying to load into flash using AS2. The string is relatively long (2610 characters) and I am really having trouble getting this to work. If I hardcode the variables as a text file they load fine, but if I try to read them out of a database using PHP flash can't get the variable values. I have tested the php in a browser and there are no problems with the page itself. Its like flash is unhappy with the few extra milliseconds PHP is taking to generate the page dynamically. I have even tried LoadVars onLoad success, and flash decides the page is loaded even though it doesn't have any variable values yet.

Could someone please give me the most reliable way to do this in AS2?

Loading Dynamic Text From File By Using Passed Var String
Okay, so I have a movie clip, a rotating wheel, and as the wheel rotates, it changes the value of a variable (centerBox). Clicking on the foremost part of the wheel loads a mc into a higher level that has info about that part of the wheel. On this 2nd level there's currently a button to unload (and go back to the wheel), a text box with some summary text, and a button to play a video related to the subject.

The swfs for these loaded levels (the 2nd level, and the video) are named in such a way that I am passing the centerBox variable and concatenating a string for the rest of the file name to be loaded, ie:


ActionScript Code:
var centerBox = "pac";

and so clicking on the button to load the 2nd level mc has a line that says:


ActionScript Code:
on(release) {   
    var filename = wheel.centerBox + ".swf";
    loadMovieNum (filename, 1);
}
which loads the pac.swf file...

and to load the movie from this screen, the button has a line that says:


ActionScript Code:
var vidname = _level0.wheel.centerBox + "vid.swf"
    loadMovieNum(vidname, 3);
which would load the pacvid.swf mc (going with the above declaration).

The problem is that I have a dynamic text box, instance name testText:

ActionScript Code:
myData = new LoadVars();
myData.onLoad = function(){
    testText.wordwrap = true;
    testText.autosize = "center";
    testText.text = this.pac;
    testText._y = 384 - (testText._height/2);
};
myData.load("kiosk.txt");

Which, as you can see, loads the text from a file, from after the pac= line in the file. This means that, for the 9 parts of my wheel, I have to have 9 of these template/2nd screen swf's, with the

ActionScript Code:
testText.text = this.xxxx;
line in everyone. If I could pass the centerBox variable into that line, to somehow dynamically load the appropiate part of the text by using the information from a passed variable, I could have ONE swf for all 9 parts of the wheel, and just pass one of 9 variables to call all of the information.

Understand? I hope I explained it okay... Can I do this? I've been looking the past 2 days for importing text from a .txt file using the string from a variable...

Pass Frame Variable Via Query String Bettween 2 Swf In 2 Different Html Files
Hello, I have an swf movie embedded in an HTML. One of the links calls to another HTML with a different SWF embedded. I need to link back to the original HTML/SWF but to a certain frame within that SWF using HTTP query. I understand that I can do this with Javascript and by parsing the HTTP query. Can anyone direct me to a tutorial or give me some help?

Thank you

maknenoiz

Can I Pass A Dynamic String To A URLRequest
I am wanting to use a button to change the value of a String variable, which is stored in a URLRequest, to dynamically change content loaded below the button based on which button is pressed.

Here is some AS 3.0:

var roomID:String = new String("default.swf");

var roomURL:URLRequest = new URLRequest(roomID);

var roomLoader:Loader = new Loader();

roomA10Button.addEventListener(MouseEvent.CLICK, onA10Click);

function onA10Click(event:MouseEvent):void
{
var roomID:String = String("roomA10.swf");
roomLoader.load(roomURL);
addChild(roomLoader);
}


I know some of my syntax is likely screwed up, specifically the "function onA10Click(event:MouseEvent):void" line, but I'm not in front of my code at the moment, so I'm just writing that stuff by memory. Anyway, the idea is to be able to define the String roomID a different value every time you click a button, which in turn updates the URLRequest, before the Loader kicks in and loads the content. Every time I try to do this, though, I get a URL Unknown error. I have traced the roomID String as well, and it seems to change fine with the clicking of buttons, but something's up with the URLRequest.

Any ideas?

Put A Value From An External File(txt) In A Variable
IŽd like to store a value from an external file as a numeric value ( and not as a string) in a variable and not in a dynamic text field. I need to calculate with value....Is it possible??

Variable And External Txt File
Hello there, can someone help me with this problem,
i've a swf that contains 2 scenes, in the first scene i make a choice for different languages, when the visiter click on english, it loads a specific txt file that contains english text, (txt file is external), know i want to load in the second scene in a empty mc a external swf, that has to contain txt from that first txt file that i load in the first scene. how can i use txt variable from that file and load it into that swf that i load into an empty mc in the second scene??

thx

Getting Variable From External Txt File
I am able to get a variable to come in to a dynamic text box, but can not seem to access the number even just to trace it. How do you access this number? My code looks like this:

myPics = new LoadVars();
loadVariablesNum("pics.txt",0);
trace (myPics);

Please help!

Thanks,
Brian

[F8] Dynamic Query String & Pass Variables To And Fro Php
Hi!

I have a webpage that needs to load a variable from query string and then the swf sends this variable to php to search it in databse and return respective entries.

My trouble is the page where the swf is placed in an HTML page whose URL is something like this : http://www.mysite.com/variableName=dynamicValue

Actually this is a link thats sent in an email. When clicked it loads this page. Here http://www.mysite.com/variableName= is static, but dynamicValue is a 15 letter randomly generated code.

I wanted to know is it possible to pass this dynamic value of the variable into my swf. If so, how to do that.

My second query is I wanted to send this variable from flash to a php file which will search it in a database and return related entries to flash. Now, I've done this seperately, that is, send variables to php by post method and get variables from php by get method. But I dont know how to do these two operations in one single call.

I am using Flash 8, though i'm exporting the movie to flash 6 player compatible and actionscript 2. Any help is welcome. Please let me have the feedback.

thanks

ashwin.

External .txt File Using Load Variable
I have a test field that is populated with text from a .txt file using
--------------------------------------------------------------
this.loadVariables("projekt01.txt"); // on frame 1
--------------------------------------------------------------
what i want to do is be able to include hyperlinks in the text from my .txt file is that possible.

For example right now my .txt file might say:

--------------------------------------------------------------
Check out CNN.com for current news
-------------------------------------------------------------------------------
no problem but what if i want to a a pice of hyperlinked text such as:

--------------------------------------------------------------
text = Check out http://www.CNN.com for current news.
--------------------------------------------------------------
and have the user able to click the text to be linked to the site

Text From External .txt File Via Variable - Help
i want to load text from an external textfile into a dynamic textfield using variables inside the textfield (&example = text).
i already have the code for that

_root.bgtext.textfeld.htmlText = this.example;

which works.

but instead of "example" i want to use a variable from my flash movie

>> inside .txt file:<<
&text01 = text

>> in action script: <<
myvariable = "text01";

_root.bgtext.textfeld.htmlText = this.myvariable;

... which doesn't work. does anyone know how to send variables (string) to external textfiles?

thx!
eve

Can't Get Length Of External File Variable
I am having trouble retrieving the number of characters from a variable store in an external txt file.

I can successfully get multiple variables from a text file and assign them to text fields.

Variables are:
&nextweektitle
&nextweekdate
&nextweektext

In _root>highlights - > "filetext" frame I have this code:

highlights.setMask(mask_mc);
loadVariables("hlights.txt", "highlights");

In _root>highlights>scrolltext - > 1st frame I have:

var myTxtLength = _root.nextweektitle.length;
var myTxtLength2 = _root.nextweekdate.length;
var myTxtLength3 = _root.nextweektext.length;

My problem is that I can't get the string length of these variables.

Please help, I'm at my wits end and 3 days behind!

Variable Form External File
Hello,
My problem is that when i include abc.text it changes the properties of the dynamic field which are on the main timeline. The properties are changing and the dynamic field are getting the required data form abc.txt, but the problem arises that i have one dynamic field in a movieclip named mainmovie the problem is if i include text file then it takes properties from it and if i tell mainmovie.loadVariables("abc.txt",_root) it sends data but the properties of the dynamic fields are lost.
abc.txt is an external file
which contains variable
long="something"
styleOne.color=0xFF0000;

if anyone could help in resolving the matter

Getting A Number Variable From External File
I have an external text file with a variable called total and it equals 5
total=5

what i want it to do is limit the random number by that variable, but it keeps giving me an undefined. Any suggestions?


ActionScript Code:
cardLoad = new LoadVars();
cardLoad.onLoad = function(success) {
    if (success) {
        _global.cardTotal = this.total;
        randNum = Math.ceil(Math.random()*cardTotal);
        info = this["card"+randNum];
        textBody.text = info;
    }
};
cardLoad.load("cardInfo.txt");
stop();

Load Variable From External TXT File
hi,
I want to be able to change an url on a trigger with an external .txt file.

like this:

getURL("url 1 FromTXT file");
getURL("url 2 FromTXT file");

--------
In my TXT file:

url1= http://www.apple.com
url2 = http://www.microsoft.com

--------
Result
getURL("http://www.apple.com");
getURL("http://www.microsoft.com");

Some one know if I can do that and how?

Thank you
Stephane

Copyright © 2005-08 www.BigResource.com, All rights reserved