Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-01-2009, 05:06 PM   PM User | #1
mikegraves24
New to the CF scene

 
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
mikegraves24 is an unknown quantity at this point
Pass textbox value as variable for URL/Filename to NetStream.play(url)

To anyone who can provide assistance:
I would like to pass a value from a text box on stage as the URL or filename to the NetStream.play() argument. example:

var url:String = url_text.text;

var conn:NetConnection = new NetConnection();
conn.connect(null);

var stream:NetStream = new NetStream(conn);

stream.play(url); //Receive error "Error #2044: Unhandled NetStatusEvent:. level=error, code=NetStream.Play.StreamNotFound
at FileName_fla::MainTimeline/frame1()"


If I provide the filename in the url declaration it works but when try to pass the string value from the text box it doesn't seem to be able to recognize the value. Is it possible a type conversion issue or timing issue as to when the NetStream.play receives the value (before the value is available)

var url:String = "filename.mp4" //hardcoded
...
stream.play(url); // This takes the value of the variable

The point of the matter is that I'm pulling the values from JavaScript/HTML using the ExternalInterface which changes as the user selects next on a HTML page. The page name (URL) is being parsed and passed back as the video filename. I'm using the text boxes currently just to test/view the values being received and sent to JavaScript. The value send and receive fine, I just can not seem to pass the value into the NetStream.play(JavaScriptValue). Thanks in advance

function getTextFromJavaScript(str:String):void {
sending_ti.text = str;
var jsArgument:String = sending_ti.text;
var result:Object = ExternalInterface.call("getTextFromFlash", jsArgument);
received_ti.text = "Returned: " + result;
}
ExternalInterface.addCallback("sendTextToFlash", getTextFromJavaScript);
mikegraves24 is offline   Reply With Quote
Reply

Bookmarks

Tags
actionscript3, javascript, netstream.play(), textbox.text, variable

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:47 AM.


Advertisement
Log in to turn off these ads.