Skip to main content
October 16, 2007
Question

Info in URL

  • October 16, 2007
  • 32 replies
  • 2207 views
Heres my story

So i have a flash file that has a text box with a scroll bar
thats all the flash file is...just a text box with a scroll bar attached

well i would like to do two different things, totally different
lol

heres number 1:
i have seen in many flash countdowns and stuff that is embeded, the url looks like this, for example:

http://i93.photobucket.com/albums/l80/bigrollerdave/flash/countdownred.swf?da=03&mo=01&words=bday"

If you look after the file is located, it says countdownred.swf?...
it has the extra info that gives the countdown what it needs
For my flash file, i would like to have something like that that would give the flash file the text it needs to be put in the flash file.
so the url would be like:
http://mysite.com/scrollbar.swf?text=this text appears in the scroll bar"


the second thing i would like to do it make a text file with the text, and make the text file in the url so that the text in the text file would be what appears in the scroll bar
so it would be somethin like:
http://mysite.com/scrollbar.swf?text=http://mysite.com/text.txt"
This topic has been closed for replies.

32 replies

October 27, 2007
sweet i tested it and it worked!!!!

but there are a couple things
when it first loads, it shows:
" http://manlaws.tripod.com/manlaw.txt"

but then loads what is in the txt file

and then the other thing
is in the url i put:
.swf?url=http://manlaws.tripod.com/oops.txt

for example, and i dont have a text file called "oops" so it says "unable to load external file"

when/if it does that, i would like it to go to the defaul text file, the manlaw.txt

how can i do that!?

and thanx for your help!
i finally got it to work
and i figured it out!
:D
October 27, 2007
Good job. That should work.
October 27, 2007
> so is that the code?
No, you're code is quite mangled now. It won't work for a number of reasons.

First of all, you need to put *all* the stuff in the LoadVars that you took out. Right now the loaded text is never applied to your textfield.

> what do you mean fix the man_laws.load code?
> whats wrong with it?
Read my previous 3 posts, I've told you several times, and in one of the posts I even gave you the exact code. All you need to do is look closely. ;-)

> lol sorry im a slow learner when it comes to this kinda stuff
I'm actually a pretty slow learner too... but you also need to follow instructions carefully when it comes to code. I gave you the code that will make it work, you put it in your code but not exactly the same way, so it won't work.
October 27, 2007
k so i read through them and i saw that you didn have quotes around the "_root.url"
so i took that out
and i added all the other external code junk
and i put the man_laws.load first instead of the undefining part

i cant work on it now, im a friends and he doesn have flash to test it
but i should be home in a couple hours and ill test it then!
October 26, 2007
Yes, that's getting there. However, you have to put back in all the other LoadVars stuff you took out, it won't work without it.

And you still haven't fixed the man_laws.load code. It won't do anything until you fix that.
October 26, 2007
so is that the code?

what do you mean fix the man_laws.load code?
whats wrong with it?

lol sorry im a slow learner when it comes to this kinda stuff
October 26, 2007
Sorry, that's not going to make a difference. ;-)

It still won't work. Your man_laws.load code is wrong, carefully read my previous post and you will see what is different.
October 26, 2007
so would that be my code?

sorry it so just clicked what you were saying about the _root.url and placing that INSIDE the load parenthesis
lol

i hope thats right!
October 26, 2007
or would it be this
cause you said
"defining the default value until *after* you are loading via man_laws.load()"
October 26, 2007
No dude, you need this:
man_laws.load(_root.url);

Makes sense? You are loading the url. Now, you have another problem. You are not defining the default value until *after* you are loading via man_laws.load().
October 26, 2007
oops i didn see 2 pages till just now, lol

so i did what you said and theres the code

but now it says
"unable to load external file"

lol i wish it would make sense what to do!!!!
October 26, 2007
WOAH
i figured somethin out own my own!

i figured that if i took out the if and else thing then it might work
so i did it
and tried it
and it worked!!!!

i feel so accomplished! lol :D
October 26, 2007
Let's think about this, because you need to learn how to figure this out, not just copy/paste code -- you'll thank me later. ;-)

You have this line:
man_laws.load(" http://manlaws.tripod.com/manlaw.txt");

Do you know what that is doing? Should be pretty obvious, it's loading the text file " http://manlaws.tripod.com/manlaw.txt".

You want to load that variable which is coming in coming through the URL, which you reference by _root.url

So the load() function needs to not load the " http://manlaws.tripod.com/manlaw.txt", it needs to load _root.url. Do that.
October 26, 2007
so should that be my code?

but when i go to it in browser it shows me the txt link in the text field and not the stuff in the txt file
October 26, 2007
heres the code
it wont let me attach it and i know it likes messes with the code
but here it is

var man_laws:LoadVars = new LoadVars();
man_laws.onData = function(src:String):Void {
if (src != undefined) {
my_txt.text = src;
} else {
my_txt.text = "Unable to load external file.";
}
};
man_laws.load(" http://manlaws.tripod.com/manlaw.txt");

if(_root.url==undefined){
_root.url = " http://manlaws.tripod.com/manlaw.txt";
}

stop();
October 26, 2007
okay so im confused as to what to do
the code i have in the actionscript is attached

here is what im trying to do
i have a text file, called "yo" on my server
i want to be able to type:
.swf?url=http://manlaws.tripod.com/yo.txt
and have it load that text file
BUT if it cant find the file or w/e
then i want it to default to:
http://manlaws.tripod.com/manlaw.txt

what did i do wrong!?
October 26, 2007
> so what is the code i would do so i can make it load the text i label in the url as url

You already have the code, you are using LoadVars to load the text file into my_txt, just replace the load() to refer to the url variable instead of the hard coded string. You currently have:
man_laws.load(" http://mysite.com/ml.txt");

Now, if _root.url contains the value you want, replace the string(" http://mysite.com/ml.txt") with _root.url.

As far as creating a default value, you could check to see if _root.url is defined, and if not, define it:

if(_root.url==undefined){
_root.url = " http://mysite.default.txt";
}

I said you don't want to try AS3 because it is obvious you are very new to programming, and AS3 is not designed for someone who doesn't know the basics of programming. It is a *lot* more complex, strict, and very unforgiving. And AS2 will continue to be used widely for a long time for basic tasks, so no worries there.