Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loadVariablesNum

Status
Not open for further replies.

biry

Technical User
Nov 5, 2004
127
CA
hope i'm posting my flash 6 published swf question on the correct board.

on thE main stage i have many frames on with this in it:

Code:loadVariablesNum("page.html", 1);

message_array = output1.split(",");
message_length = message_array.length;

message.html=true;

message.htmlText += "<font color=\"#0000FF\" size=\"13\"><a href='"+ message_array +"' target='_blank'><b><u>"+ message_array +" </u></b></a></font><br><br>";




on the main stage i have a dynamic text field with instance named:
message

when i view the html on the web the message text box displays:
_level0.message

in the html of the page.html i have this JS script:

Code:var mess = location.href;
window.document.movie.SetVariable("message", mess);




What i'm trying to do is display the browser url in the "message" dynamic text box on the main stage, i am also using this message box in a form submission back to a server side page, so i have set the var properties of the box to message as well.

maybe there is an easier way to do this?
any suggestions appreciated, thanks!
 
You can get the URL of the movie within Flash. You don't have to load it in as a variable.

Code:
[highlight]theURL = this._url;[/highlight]
message.html=true;
message.htmlText += "<font color=\"#0000FF\" size=\"13\">";
message.htmlText += "<a href='"+ theURL +"' target='_blank'>";
message.htmlText += "<b><u>"+ theURL +" </u></b></a></font><br><br>";

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Why are you loading on level 1, rather than 0?

Code:loadVariablesNum("page.html", 1);
 
pixl8r, that is a much easier way, except url returned is of the format where the file extension is .swf, like so:

how could i have it so it has an .asp extension instead of .swf

thanks
 
ok this is what i have so far to append a .asp extension to the URL

i'm using pixl8r's and Mkop's code to take the url string and set it to a variable while stopping the string at the perior of the url. I'm trying to display the url in a dynamic text box on the main stage, below is what i have which doesn't seem to work, i get underfined at the trace....? any thoughts on this
Code:
var myURL:String = this._url;
trace (myURL);
var myURLLength:Number = myURL.length;
var mySubLength:Number = 0;

for (i:Number = myURLLength;i>=0;i--) {

	if (myURL.charAt(i) == "."){
	
		this.mySubLength = i;
	break;
	}
}

var myNewURL:String = myURL.substr(0,mySubLength);
theURL = myNewURL + ".html";
message.html=true;
message.htmlText += "<font color=\"#0000FF\" size=\"10\"><a href='"+ theURL +"' target='_blank'><b><u>"+ theURL +" </u></b></a></font>";
 
Your code is correct and works fine for me. I just made a simple movie with a dynamic text field called "message" and pasted your code into the first frame.

You may be having an addressing problem with the this._url string. How is your movie constructed? Is this script on the main timeline or is it within a MC on the main timeline. You might have to use
Code:
this._parent._url;

Can you post your .fla?

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
i got it working as well, i think it was a server cache issue. another think, if you don't mind,

calling the swf with this code in it (for reference sake url.swf), into another level of another.swf. Now the url.swf
is located in another directory on the same web site. So the this._url in the url.swf is is picking up path to itself, i thought it would pick up the path of the url that it is loaded into, so my question is:

Can a little manipulation of the actionScript be enough to handle my situation, of displaying the url of the movie on level0? I really want to try to do this all from within flash, no passing of server side variables.

Here's the working code:



code:--------------------------------------------------------------------------------

var myURL = this._url;
trace (myURL);
var myURLLength = myURL.length;
var mySubLength = 0;

for (i:Number = myURLLength;i>=0;i--) {

if (myURL.charAt(i) == "."){

this.mySubLength = i;
break;
}
}

var myNewURL = myURL.substr(0,mySubLength);
theURL = myNewURL + ".html";
message.html=true;
message.htmlText += "<font color=\"#0000FF\" size=\"10\"><a href='"+ theURL +"' target='_blank'><b><u>"+ theURL +" </u></b></a></font>";


 
Sure.

Use _level0._url.

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top